Warning that I’m a noob.
One of my goals is to make a sampler that can offer different pitch interpolation algorithms from past samples (so drop sample and divide-by-n clock for example). I’ve heavily referenced this thread for various numbers and formulas to play around with; https://gearspace.com/board/electronic-music-instruments-and-electronic-music-production/826280-taxonomy-early-digital-synthesizers-samplers.html
In attempting to mess with divide-by-n clock algos (using an approxmation of the fairlight’s clock speed and waveform resolution), I’ve implemented this midi implementation of pitch:
if (message.isNoteOn())
{
double wavSampleRate = readerSource->getAudioFormatReader()->sampleRate;
int noteNumber = message.getNoteNumber();
double frequency = 440.0 * std::pow(2.0, (noteNumber - 69) / 12.0);
const int m = 128;
double adjustedSampleRate = frequency * m;
//const double Fclk = 20e6; // 20 MHz Emulator III
const double Fclk = 17e6; //Fairlight
//const double Fclk = 195313; PPG
// Calculate n using floor(Fclk/fp)
int n = static_cast<int>(std::floor(Fclk / adjustedSampleRate));
// Calculate pitch resolution in cents
double pitch_resolution = 1200 * std::log2(static_cast<double>(n + 1) / n);
double speed = 1.0/pitch_resolution;
transportSource.setSource(readerSource.get(), 0, nullptr,
readerSource->getAudioFormatReader()->sampleRate / speed);
transportSource.setPosition(0.0);
if (isTransportSourcePrepared)
{
transportSource.start();
}
isFadingOut = false;
fadeOutFactor = 1.0f;
}</code>
It does give a result, but I don’t actually know if this is the correct way of implementing this formula. I don’t even know if this formula is correct, I’m simply trusting the OP of that gearspace thread. I guess I’m looking for more resources/information about these older sampler pitch algorithms. The end goal is to program something on a microcontroller and eventually develop an analog output stage, but for now I’m trying to learn/practice with JUCE plugins.