home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 3
/
PDCD_3.iso
/
pocketbk
/
developmen
/
oplexamp
/
NOTECONV.OPL
< prev
next >
Wrap
Text File
|
1994-05-07
|
818b
|
23 lines
> As a side issue (Well, it has no relevance at all really), how do you
> convert a note into a frequancy for IOC to SND: ? Assuming that middle C
> is note 1?
The following procedure will return the frequency of a note when given
an argument in semitones away from the A below middle C (440 Hz).
If you want C to be note 1, use the frequency of B instead of the
number 440 -> you can find this by calling the given procedure
with an argument of 2.
PROC n2f%:(note%)
RETURN INT(440*(1.0594630943593**note%))
ENDP
BTW, the odd number (1.05...) comes from the fact that there are
12 semitones in the standard tempered western mnusical scale, and that
the frequency of notes doubles with each octave, hence
x^12 = 2
where x is the constant....and the 12th root of 2 is 1.0594...