Skip to content

Instantly share code, notes, and snippets.

@atzkey
Created July 9, 2010 10:28
Show Gist options
  • Save atzkey/469328 to your computer and use it in GitHub Desktop.
Save atzkey/469328 to your computer and use it in GitHub Desktop.
/* Routine that generates frequencies for all 128 MIDI notes */
#include <stdio.h>
#include <math.h>
int main()
{
float midi[127];
int a = 440; // a is 440 hz...
int x;
for (x = 0; x < 128; ++x) {
midi[x] = (a / 32.0) * pow(2, ((x - 9.0) / 12.0));
printf("%f\n", midi[x]);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment