logo

bytemedia

Home to byte-level sounds, images, videos, … git clone https://hacktivis.me/git/bytemedia.git

misc.h (309B)


  1. #include <math.h> // pow
  2. #include <stdio.h> // putchar
  3. // https://pages.mtu.edu/~suits/NoteFreqCalcs.html
  4. #define TWELTH_ROOT_2 1.059463094359
  5. double
  6. note_to_hertz(double ref_tune, int steps) {
  7. return ref_tune*pow(TWELTH_ROOT_2,steps);
  8. }
  9. void
  10. silence(int dur) {
  11. for(int t = 0;t<dur;t++)putchar( 0x00 );
  12. }