[LAU] Calculating the sine wave frequencies from the midi key

From: Arda Eden <ardaeden@email-addr-hidden>
Date: Sun Oct 19 2008 - 20:00:26 EEST

Hi there,
There's a line in the midisine.c code at jack's example client directory.
In this code, Ian Esten has calculated note frequencies in the function
below:

void calc_note_frqs(jack_default_audio_sample_t srate)
{
    int i;
    for(i=0; i<128; i++)
    {
        note_frqs[i] = (2.0 * 440.0 / 32.0) * pow(2,
(((jack_default_audio_sample_t)i - 9.0) / 12.0)) / srate;
    }
}

after that, a variable called ramp is used to form the sine wave samples in
the function process:

ramp += note_frqs[note];
        ramp = (ramp > 1.0) ? ramp - 2.0 : ramp;
        out[i] = note_on*sin(2*M_PI*ramp);

I actually understood what the code does. But can someone show me a place to
read information about the equation:

note_frqs[i] = (2.0 * 440.0 / 32.0) * pow(2,
(((jack_default_audio_sample_t)i - 9.0) / 12.0)) / srate;

I couldn't catch the relationship in the calculation above.
Thanks.

-- 
Arda EDEN
Cumhuriyet University
Faculty of Fine Arts
Department of Music Technology
Sivas/TURKEY

_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user
Received on Sun Oct 19 20:15:02 2008

This archive was generated by hypermail 2.1.8 : Sun Oct 19 2008 - 20:15:02 EEST