Musical notes in MMBASIC


Author Message
rodent59
Newbie

Joined: 02/03/2012
Location: Australia
Posts: 7
Posted: 05:58am 15 Mar 2012      

Hi Dave,

For the equally tempered scale, the frequency ratio of adjacent notes (one semitone) is the twelfth root of two. 2^(1/12) ~= 1.05946.

So, rather than enter note frequencies individually, they could be calculated by, for example (not tested!),

C1=32.703196 ' Frequency of C1 in Hz (Note: A4=440Hz, concert pitch)
dim freq(8,12)
for octave=1 to 8 ' octave 4 is middle C to B above it
for note=1 to 12 ' 1=C, 2=C#, 3=D,..., 12=B
freq(octave,note)=C1*(2^(octave-1))*2^((note-1)/12)
next
next


Perhaps write it as a subroutine 'PitchInit'

Rod.