home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / pocketbk / developmen / oplexamp / NOTECONV.OPL < prev    next >
Text File  |  1994-05-07  |  818b  |  23 lines

  1. >      As a side issue (Well, it has no relevance at all really), how do you
  2. > convert a note into a frequancy for IOC to SND: ? Assuming that middle C
  3. > is note 1?
  4.  
  5. The following procedure will return the frequency of a note when given
  6. an argument in semitones away from the A below middle C (440 Hz).
  7. If you want C to be note 1, use the frequency of B instead of the
  8. number 440 -> you can find this by calling the given procedure
  9. with an argument of 2.
  10.  
  11. PROC n2f%:(note%)
  12.         RETURN INT(440*(1.0594630943593**note%))
  13. ENDP
  14.  
  15. BTW, the odd number (1.05...) comes from the fact that there are
  16. 12 semitones in the standard tempered western mnusical scale, and that
  17. the frequency of notes doubles with each octave, hence
  18.  
  19. x^12 = 2 
  20.  
  21. where x is the constant....and the 12th root of 2 is 1.0594...
  22.  
  23.