<div dir="ltr">Thanks Fons,<br>It&#39;s clear now.<br><br><div class="gmail_quote">On Sun, Oct 19, 2008 at 8:21 PM, Fons Adriaensen <span dir="ltr">&lt;<a href="mailto:fons@kokkinizita.net">fons@kokkinizita.net</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">On Sun, Oct 19, 2008 at 08:00:26PM +0300, Arda Eden wrote:<br>
<br>
&gt; note_frqs[i] = (2.0 * 440.0 / 32.0) * pow(2,<br>
&gt; (((jack_default_audio_sample_t)i - 9.0) / 12.0)) / srate;<br>
&gt;<br>
&gt; I couldn&#39;t catch the relationship in the calculation above.<br>
<br>
</div>Midi note numbers are just a count in semitones.<br>
There are twelve semitones in an octave, which<br>
is a frequency ratio of 2:1.<br>
<br>
So given two note numbers that are N semitones apart,<br>
the ratio of their frequencies is<br>
<br>
2 ^ (N / 12), or in C: &nbsp;pow (2.0, N / 12.0)<br>
<br>
Now MIDI note number 9 (an &#39;A&#39;, note number 0 is the &#39;C&#39;<br>
below that) has the frequency 880 / 32 Hz, five octaves<br>
below the 880 Hz &#39;A&#39;.<br>
<br>
So to get the scale right we use<br>
<br>
F = 880.0 / 32 * pow (2.0, (i - 9) / 12.0)<br>
<br>
For i = 9 this becomes<br>
<br>
F = 880.0 / 32 * pow (2.0, 0)<br>
 &nbsp;= 880.0 / 32 * 1<br>
 &nbsp;= 880.0 / 32<br>
<br>
as required.<br>
<br>
Ciao,<br>
<br>
<br>
--<br>
FA<br>
<br>
Laboratorio di Acustica ed Elettroacustica<br>
Parma, Italia<br>
<br>
Lascia la spina, cogli la rosa.<br>
<br>
_______________________________________________<br>
Linux-audio-user mailing list<br>
<a href="mailto:Linux-audio-user@lists.linuxaudio.org">Linux-audio-user@lists.linuxaudio.org</a><br>
<a href="http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user" target="_blank">http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Arda EDEN<br>Cumhuriyet University<br>Faculty of Fine Arts<br>Department of Music Technology<br>Sivas/TURKEY<br>
</div>