
The calculation will be repeated every k-period since that is the rate at which k1 varies. Since the argument is constant over the duration of the note, this conversion will take place at i-time, before any samples for the current note are produced.īy contrast, the conversion cpsoct(8.75 + k1) which gives the value of A440 transposed by the octave interval k1. Heres a BASIC program to calculate an array with all of the. Thus cpspch(8.09) will convert the pitch argument 8.09 to its cps (or Hertz) equivalent, giving the value of 440. MIDI Note Number to Frequency Conversion Chart. The mnemonics of the pitch conversion units are derived from morphemes of the forms involved, the second morpheme describing the source and the first morpheme the object (result).

Microtonal divisions of the pch semitone can be encoded by using more than two decimal places. Thus A440 can be represented alternatively by 440 ( cps), 69 ( midinn), 8.09 ( pch), or 8.75 ( oct). Midi note number values range between 0 and 127 (inclusively) with 60 representing Middle C, and are usually whole numbers. In both forms, the fraction is preceded by a whole number octave index such that 8.00 represents Middle C, 9.00 the C above, etc. Below is a portion of a piano with the keys labeled as a MIDI Device would refer to them. So, a MIDI note number of 69 is used for A440 tuning. (ie, There are 59 other keys below middle C upon a MIDI controller). The two fractional forms are thus related by the factor 100/12. The D note above that would have a note number of 2. For oct, the fraction is interpreted as a true decimal fractional part of an octave. For pch, the fraction is read as two decimal digits representing the 12 equal-tempered pitch classes from. The first two forms consist of a whole number, representing octave registration, followed by a specially interpreted fractional part. With cpsmidi, the Midi note number value is taken from the Midi event associated with the instrument instance, and no location or expression for this value may be specified.Ĭpsmidinn and its related opcodes are really value converters with a special function of manipulating pitch data.ĭata concerning pitch and frequency can exist in any of the following forms: On the other hand, the cpsmidi opcode only produces meaningful results in a Midi-activated note (either real-time or from a Midi score with the -F flag). You must specify an i-rate or k-rate expression for the Midi note number that is to be converted.

The input value for cpsmidinn might for example come from a p-field in a textual score or it may have been retrieved from the real-time Midi event that activated the current note using the notnum opcode. The cpsmidinn opcode may be used in any Csound instrument instance whether it is activated from a Midi event, score event, line event, or from another instrument.
