A tuning table is a text representation of a scale that can be interpreted by an external program. This is usually used to tune a synthesizer or other sound source so that the scale can be used in a musical composition.
Some tuning tables – such as that used by Scala – describe the scale in absolute terms, but most need to have a reference defined so that the scale degrees can be mapped to a frequency. For this purpose the PyTuning package has adopted the MIDI standard for note numbers and frequencies.
So, for example, note number 69 corresponds to middle A, whereas 60
corresponds to middle C. The frequency standard is 12-EDO, and the note
69 is pegged to 440 Hz. Thus if you passed
69 as the reference note,
the 69’th entry in the table would be 440 Hz and this would correspond to the
first degree of the scale.
60 would cause the first degree of the scale
to be assigned to that note number (with a corresponding frequency of
about 261.6 Hz). The timidity soft synth
is an example of a synthesizer that needs this reference note and frequency.
In general the table will need to be output to disk so that it can read by the program. This can be done with something like:
from pytuning.tuning_tables import create_timidity_tuning from pytuning.scales import create_euler_fokker_scale reference_note = 60 scale = create_euler_fokker_scale([3,5],[3,1]) tuning = create_timidity_tuning(scale, reference_note=reference_note) with open("timidity.table", "w") as table: table.write(tuning)
This will cause the generated scale:
to be written to a disk file,
timidity.table, which can be understood
timidity -Z timidity.table score.mid
The Scala tuning table can be used with the Scala package, but it can also be used to tune the soft synth Zynaddsubfx, as well as its derivative Youshimi. With the soft synths you will need to explicitly set the reference note and frequency in the scale GUI.
For use in Csound PyTuning will generate a
table of frequencies that can be used as a table lookup, mapped to MIDI note
number. As mentioned in the basic concepts, the easiest way to use this
is via the
inote init p4 iveloc init p5 ifreq table inote, 1 a1 oscil iveloc, ifreq, 2 outs a1, a1