grame-cncm / faustlibraries

The Faust libraries

Home Page:https://faustlibraries.grame.fr

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pm.flute_ui_MIDI is not in tune

prithviKantanAAU opened this issue · comments

While experimenting with this function, I found that the synthesized fundamental frequency is only correct at 440 Hz and shows increasing error with increasing frequency input.

I managed to manually tune it by adding the following transformation using some crude polynomial fitting, so it is approximately in tune from 440 Hz to 1320 Hz. It would be great if a more robust fix were possible.

// f_Hz is the original input frequency
// freqFactor is a transformation applied to correct the final output
freqDiff = f_Hz - 440;
freqFactor = 0.999999999999 + freqDiff * 0.0080951 - freqDifffreqDiff * 0.00002777 + freqDifffreqDiff*freqDiff * 0.00000004097;
tubeLength = 440 + (f_Hz - 440) * freqFactor : pm.f2l; // from original function