Modulating sample rates for realtime audio processing

houtson

Well-known member
I'm starting a project to emulate a vintage digital music effects and looking for advice. A key element of project is being able to change and modulate the rate sample rate smoothly while processing the audio in real time.

I've experience using the audio library and have built a few custom effects, all using I2S codecs. I'm aware of the techniques for changing sample rates by varying I2S clock frequency, these all seem to change rates in distinct steps.

What I'm looking to do is process audio in real time and smoothly change sample rate (of input and output) and to modulate that quickly - say working over a range of sample rates from 22kHz to 66kHz and modulating (within a smaller band) at up to 500Hz.

I'm thinking of a custom board with a dedicated ADC and DAC clocked at a variable rate.

Areas where I'd appreciate some advice:
  1. Are there any go to ADCs and DACs that support variable clocking/sample rates in the range above
  2. Would I be able to create a smooth variable clock pulse from teensy or would I be better doing that in hardware
  3. Is creating a custom audio ADC / DAC with a reasonable quality attainable (doesn't need to be hifi but low noise and say >10bit)
  4. Are there software techniques to emulate sample rate modulation of input and output while working at a fixed rate that I should be looking at rather than hardware?

Anything else that I should be thinking about or any general advice very welcome, Cheers Paul
 
Are you trying to emulate a bucket-brigade delay line by any chance?

I2S doesn't support dynamically varying clock rates, in fact many devices demand ultra-stable (quartz-derived) clocks to work properly, as they use complicated sigma-delta pipelines and rely on low-jitter clocking to prevent distortion.

A non-I2S DAC and ADC are probably the way to go to do this, although it may be much simpler to run over-sampling and try to be clever in the digital domain using arbitrary multi-rate techniques (sinc interpolation, basically).
 
@MarkT

Emulating a delay but not bucket brigade, early digital (think lexicon Super Prime Time or Deltalab Effectron). In these models they are clocking in and out samples direct to ram at variable rates (to get more delay time with limited RAM) and modulating the clock rate to get desired effects (flangers/chorus etc).

I'm leaning towards a hardware solution, I'll have a look for non-I2S DAC/ADCs but I'll also have a look at since interpolation. Most of the dsp stuff I've come across for sample rate modification has been based on combination of upsample then decimate and not sure that would suit small fast changes in rate.

Thanks for the quality input, Cheers Paul
 
To get a stepless variable samplerate you have to use 'external' generation of the bitclock and wordclock and run the Teensy, ADC and DAC in slave-mode. You can use a VCO and dividers for this.

For the DAC part, it is easy: There are some simple DAC that use no oversampling and Sigma-Delta-Modulation that will work with a variable sample rate, for example PT8211.

For the ADC it is more difficult to find usable parts. Take a look in the DS to see how they work. I think most need a Master-Clk that is in a fixed ratio to the bit-clock/word-clock. It should be possible to use the VCO to generate the Master-Clock and derive the other clocks from this.
 
To get a stepless variable samplerate you have to use 'external' generation of the bitclock and wordclock and run the Teensy, ADC and DAC in slave-mode. You can use a VCO and dividers for this.

For the DAC part, it is easy: There are some simple DAC that use no oversampling and Sigma-Delta-Modulation that will work with a variable sample rate, for example PT8211.

For the ADC it is more difficult to find usable parts. Take a look in the DS to see how they work. I think most need a Master-Clk that is in a fixed ratio to the bit-clock/word-clock. It should be possible to use the VCO to generate the Master-Clock and derive the other clocks from this.

I'm looking at these for ADC, MCP3201, surprisingly available and look straight forward. Any obvious reasons not to use these as a starting point?

As an alternative, I'm using Teensy 4, any thoughts on using the on-chip ADC with and external timing circuit to sample the audio. I've read a few comments about low quality fo the ADC output but also read it has been improved. Would using the internal ADC clocked by an external trigger be a potential route?

Cheers, Paul
 
I'm looking at these for ADC, MCP3201, surprisingly available and look straight forward. Any obvious reasons not to use these as a starting point?

As an alternative, I'm using Teensy 4, any thoughts on using the on-chip ADC with and external timing circuit to sample the audio. I've read a few comments about low quality fo the ADC output but also read it has been improved. Would using the internal ADC clocked by an external trigger be a potential route?

Cheers, Paul

According to the RM of the µC the ADC can be triggered by an external event. If you use the wordclock for the DAC to trigger the ADC it should be possible to run the ADC and DAC in lockstep with an external clock source (if the I2S output is running in slave-mode from an external clock source).
 
Back
Top