Very cool. I did a tuning algorithm for one of my projects, and I was able to get it going pretty quick. A: there are(on my dac anyway) two dead zones - eg the dac doesn’t start to change level until around 0x023 or so and it hits the ceiling before 0xFFF - at around 0xFEE etc - so I firstly find those ranges as the values below and above are useless and will affect your scaling calcs. Secondly, once I find the minimum frequency, I will use a binary search to find the dac value that gets me closest to the next octave. Frequency is too low? Move up by half the range. Too high? Now move down by a quarter. And so on moving up and down by half of the previous amount. As I’m using a 12 bit dac this only requires 12 frequency checks per octave, and once the dead zone search is complete it is completed fairly quickly, I just have to let the oscillator run long enough to get enough pulses counted per frequency check. I don’t have a list of values for each note, I just need the scale factor / offset as it’s linear. Good luck!
Very cool. I did a tuning algorithm for one of my projects, and I was able to get it going pretty quick.
A: there are(on my dac anyway) two dead zones - eg the dac doesn’t start to change level until around 0x023 or so and it hits the ceiling before 0xFFF - at around 0xFEE etc - so I firstly find those ranges as the values below and above are useless and will affect your scaling calcs.
Secondly, once I find the minimum frequency, I will use a binary search to find the dac value that gets me closest to the next octave. Frequency is too low? Move up by half the range. Too high? Now move down by a quarter. And so on moving up and down by half of the previous amount. As I’m using a 12 bit dac this only requires 12 frequency checks per octave, and once the dead zone search is complete it is completed fairly quickly, I just have to let the oscillator run long enough to get enough pulses counted per frequency check.
I don’t have a list of values for each note, I just need the scale factor / offset as it’s linear.
Good luck!