I’m working on a module that’s a set of 8 samplers triggered by a sequencer. When the sequencer advances during recording, the input is recorded into the next sampler, and during playback each sampler plays out it’s recording sequentially. There’s a global pitch control that affects the playback speed/pitch of all the samples.
The way the sampling works is that the input is copied into a buffer (a vector of floats). If the pitch control is in it’s default position, then that input buffer is copied directly to an output buffer, which is iterated through and sent to the output. If some pitch control is applied, I’m using dsp::SampleRateConverter to copy the input buffer to the output buffer at a different sample rate to achieve the pitch shifting.
The problem I’m having is that when I change the pitch parameter from pitching the buffer up to pitching it down, the playback of the lower pitch only seems to work for the number of samples that the preceding higher pitch had - thus the output is abruptly cut short. The confusing thing is, this only happens for the first time the buffer is played at that lower pitch - the next time the sequencer comes around it plays all of the samples without cutting the end off.
Anyone have any ideas?