Hi,
For some kind of thesis I'm currently working on physical modelling algorithms (mainly Digital Waveguide) and I'm trying to implement some of this on a Axoloti board. It works quite well so far but since I code everything in float, I sometimes struggle with conversions to fixed point.
Basically I want to convert a pitch parameter (which should be a midi note) to the corresponding frequency in float. I want to use MTOFEXTENDED() for that to avoid a power calculation but I wasn't able to get good results there. Here is my piece of code:
uint32_t p = midi_note*(1<<27);
MTOFEXTENDED(p, freq);
freq_float = freq*(float)(1.0f/(1<<27))*sample_rate;
LogTextMessage("freq = %f \n", freq_float);
So in the first line I want to convert a midi note (integer range 0 to 127) to q5.27 fixed point, then I call mtofextended and in the third line I convert to float and multiply with the sampling frequency to get from a phase increment to an actual frequency. As an output I just get super high numbers, which don't make sense at all. Can anyone tell me what I'm getting wrong here? Is mtofextended probably expecting an other fixed point format than q5.27?
Thanks in advance for your help!
Best, Flori