[LAD] Quantise MIDI note/frequency to musical scale: algorithm?

Fons Adriaensen fons at linuxaudio.org
Fri Dec 31 00:12:04 CET 2021


On Thu, Dec 30, 2021 at 02:49:45PM -0800, Yuri wrote:

> Mapping is strictly logarithmical, i.e. log(F) would have notes equally
> distributed. One note and other note begins in the middle of such interval.
> The rest is simple math.

That would be true for 'equal temperament', which is more or less
tne standard for electronic instruments. But there are hundreds of
other temperaments. 

In equal temperament a musical fifth would be the ratio 2^(7/12)
= 1.498307 and a third would be 2^(4/12) = 1.259921.

In natural or pythagorean temperament those would be 3/2 resp.
5/4 exactly. But of course such simple ratios are possible only
in a limited set of keys.  

Which is why a lot of other temperaments exist. All of them are
some compromise between exact musical intervals and the ability
to play in any key. Organs for example are almost never tuned
in equal temperament.

-- 
FA










More information about the Linux-audio-dev mailing list