|
|
I get often
asked about simple things like MIDI note/frequency conversion,
(for example what frequency in equal-tempered tuning
a certain MIDI number has) so I thought I could as well post some source code
about this. This stuff also releveant if you want
to tune an oscillator of your self-made VSTi synth
according to the MIDI notes.
Therefore I have
written a fully MPEG4-SA (Structured Audio) compliant Delphi
class of pitch converters! The four representations for pitch in MPEG4-SA
are:
- MIDI pitch number representation. A pitch is represented
as an integer number of semitones above or below middle
C, representedas 60. For example, 57 is the A below middle C.
- frequency, or cps representation. A pitch is represented
as some number of cycles per second. For example, 220 Hz is the A below middle C.
- pitch-class, or pch representation. A pitch is
represented as an integer part, which represents the octave number,
where 8 shall be the octave containing middle C (C4); plus a fractional
part, which represents the pitch-class. For example, 7.09 is the A below middle C.
- octave-fraction, or oct representation. A pitch
is represented as an integer part, which represents the octave number,
where 8 shall be the octave containing middle C
(C4); plus a fractional
part, which represents a fraction of an octave, where each step
of 1/12 represents a semitone. For example, 7.75 is the A below middle C, in equal-tempered
tuning.
I also added routines for converting from/to note
strings (like "C#2"), see example code for
usage.

As
if that weren't enough, I also wrote a class that allows
adding of microtuning ability to
any of your
Delphi projects! This class can easily load/import the
widely spread Scala, VAZ and Anamark formats for
scales and tunings!
Considering that the Scala
archive contains currently more than 3000 scales from
all over the world, this is definitely a reason
to include microtuning in your projects, it is a
useful
feature that more and more people want and you
now have the chance to get it all for free and in one
easy package!
|