|Home · Standalone · rtcmix~ · iRTcmix · Tutorials · Reference|
an open-source digital signal processing and sound synthesis language
|about · links · contact|
octmidi - convert midi note # to linear octaves
linoct = octmidi(midinote)
octmidi returns a corresponding linear octave value for a given midi note number. Linear octaves are similar to octave.pitch-class (oct.pc) notation in that 8.00 is middle C, 9.00 is the C an octave above, etc. The difference is that the fractional part of the specification represents a direct mapping onto the notes of the scale between octaves. For example, in oct.pc notation the value 8.06 represents F-sharp (the tritone, 1/2 the chromatic scale between 8.00 and 9.00). This would be represented as 8.5 in linear octaves.
octmidi will not do fractional midi note values. Any fractional midi note number will be truncated prior to conversion (i.e. 62.78 -> 62).
NOTE: With the exception of boost, The RTcmix conversion functions follow a pattern. The command isdivided into two halves, the one closest to the argument represent the format of the argument, and the one closest to the assignment represents the format to be returned. For example, "cpspch" is divided into "cps" and "pch". The argument is in oct.pc form ("pch") and the return value will be in cps ("cps").
The various format specifiers are:
amp = absolute amplitude (16-bit, 0-32768) cps = cycles per second (Hz) db = decibels midi = midi note # (60 is middle C) oct = linear octaves (8.5 is halfway between octave 8.00 [middle C] and 9.00) pch = octave.pitch-class (oct.pc; 8.00 is middle C, 8.02 is D, 8.12 = 9.00 = C above middle C) let = note-letter specification ("C4" is middle C, "C#4" is C-sharp above middle C, "Gb5" is G-flat the octave above middle C octave. [see pitch-reps for more info])
loct = octmidi(72) loct = octmidi(60.0)