[sdiy] Flangelicious noises - some queries about NCO jitter and resampling and similar
rburnett at richieburnett.co.uk
rburnett at richieburnett.co.uk
Thu Jan 23 15:36:26 CET 2020
This is an interesting way of digitally implementing the Flanger LFO and
> The LFO runs at a 25KHz sample rate and modifies the NCO frequency
> increment at this rate. The NCO will only accept the new increment
> when the current cycle has ended (the freq inc is double-buffered).
> This leads to an uncertain “resampling” period of the LFO output
> by the NCO clock. This isn’t so bad when the NCO output is high,
> since the NCO will be updated at close to 500KHz (2usecs max), but
> when the modulation wave sweeps low, the clock output is getting close
> to 25KHz and the “update discrepancy” between two rates of near
> 25KHz could be significant (40usecs max).
I see your point about the NCO irregularly sampling the LFO waveform,
and these sampling instants being quantized to the nearest 40us.
However, my gut feeling is that this isn't the cause of your problem.
The LFO waveform is a low frequency waveform by definition, so it's rate
of change will be small. I doubt that 40us jitter in where you sample
the LFO waveform makes a great deal of difference for typical LFO rates.
But I might be wrong. (I guess you could theoretically re-sample the
LFO waveform at each instant that the NCO calls for a new value by using
linear interpolation between the two closest samples, but it might not
be trivial to program it in practice!)
> Another potential source of error is the NCO jitter. Even without any
> LFO modulation, the NCO doesn’t produce a fixed frequency. Instead
> there is a certain amount of jitter, and this jitter is regular and
> can occur at audio rates.
I think this is where the problem probably lies. At the top of the
"VCO" frequency range, you are effectively generating a 500kHz
*squarewave* at a sample rate of 16MHz. This is going to alias pretty
badly because the harmonics of a 500kHz square wave go on up well beyond
8MHz with appreciable amplitude. (Or alternatively you can think of the
transitions in the output waveform being quantized to the 16MHz clock
edges.) The proper way to do this would be to synthesise a *sinewave*
with your NCO, then pass that through an analogue reconstruction filter
to smooth out the steps and remove the images from the sampling process.
Then use an analogue comparator to produce a nice clean squarewave free
of any jitter on its switching edges. I'm guessing the PICs NCO doesn't
have a sinewave LUT ROM built in though?
> The sonic effect of these various effects is odd bird-like chirps or
> “watery” noises in the background.
I'm not surprised by this. Any jitter in the BBD clock will modulate
the BBD delay time, and essentially result in FM sidebands either side
of spectral lines present in the audio input.
> There is now a newer chip available (the PIC 16F18313) which allows a
> 32MHz clock for the NCO. The NCO is still 24-bit, but the frequency
> increment is now 24-bit too, which enables higher frequency outputs.
You could double the clocking rate of the NCO, but I don't think the
difference will be that dramatic. It'll probably gain you 6dB SNR at
best. Oversampling is quite a poor way to combat aliasing.
> Another thing I've tried is to add dithering to the NCO phase
> accumulator to break up the jitter cycles. This seems to work,
> sort-of, but replaces toned noise with hiss. It's not a huge
That would have been my suggestion. Add some dither noise to the NCO
frequency variable in an attempt to break up any audible patterns in the
NCO output waveform.
More information about the Synth-diy