ntof — Convert note name to frequency


Plugin opcode in emugens.

Convert note name to frequency (Hz). It allows note name to include microtones or a deviation in cents.


kfreq ntof Snote
ifreq ntof Snote


Snote -- Note name

kfreq -- Frequency

[Note] Note

The frequency returned depends on the value of the global variable A4

[Note] Note

4C is the central C in the piano.


Here is an example of the ntof opcode. It uses the file ntof.csd.

Example 667. Example of the ntof opcode.



Example for ntof: notename to frequency 

A notename is a string of the form


Example notenames are:

"4A"     -> A in the 4th octave
"5C+31"  -> C5, 31 cents higher
"4Db-13" -> D flat, 4th octave, 13 cents lower
"7F#+"   -> F# quarter tone higher 
"5G-"    -> G5 a quarter tone lower

NB: the frequency returned by ntof depends on the value of A4


A4 = 442

instr 1
    ifreq ntof "4A"
    print ifreq

    koctave = 1
    while (koctave <= 8) do
        Snote sprintfk "%dC", koctave
        kfreq ntof Snote
        printf "notename: %s  freq: %.2f \n", koctave, Snote, kfreq
        koctave += 1



i 1 0 1


See Also

mtof, ftom, mton mton


By: Eduardo Moguillansky 2019

New in 6.13