[sdiy] Vocoder dabblings
Richie Burnett
rburnett at richieburnett.co.uk
Tue Oct 23 14:05:10 CEST 2012
Hi Eric,
> Very nice samples. Impressive that you were able to get that many
> 8th-order IIR filters running on a 24MHz dsPIC.
Thanks Eric. It wouldn't be possible without multi-rate tricks. All of the
filters for the top two octaves (the top 6 analysis and synthesis bands) run
with a sampling rate of 24kHz, then carrier and modulator inputs are both
downsampled by four. The remaining 14 analysis and synthesis bands run with
a sample rate of 6kHz. All of their envelope detection, envelope filtering
and modulation are done at the reduced sample rate, which saves
three-quarters of the CPU cycles for 14-bands. These bands are then mixed
together and upsampled by four before adding to the top 6 bands that ran at
full rate.
The reduced sample-rate for the lower bands really helps with minimising
coefficient and state quantisation issues too in the high-Q IIR filters.
The extra CPU cycles freed up by the multi-rate processing also let me use
modified state-variable filters instead of Direct Form-1 biquads. This
makes a huge difference on a 16-bit CPU because I can keep the filter states
in the 32-bit accumulators.
The hardest part is accounting for the group delay in the decimation and
interpolation steps so that everything is aligned properly when you add it
back together!! The 8th order filters are actually "Butterworth Squared"
(like Linkwitz Riley crossover filters) so should exhibit perfect
reconstruction when recombined if everything is time aligned. I'm not sure
that this is actually the case though at the moment as there's about 8 dB of
a notch where the full-rate bands meet the 1/4 rate ones!
I probably could fit in a lot more vocoder bands using the polyphase
decimation and interpolation. Theoretically you can decimate the audio by 2
for every successive octave you go down, so that each bunch of analysis and
synthesis sections run at half the sample rate of the previous bunch, then
upsample again before mixing it all back together at the output. There
comes a point though where the CPU cycles burned implementing the FIR
sample-rate conversions are more than those saved by running the vocoder
bands at the new reduced rate. Then you might as well just run all the
remaining bands at this sample rate. I did a few rough calculations and it
seemed that one rate change of 1/4 would be sufficient to make it fit the
dsPIC on my dev board so I stopped there.
> Are you doing any kind of nonlinear processing on the detected envelopes?
> I found that can also help with intelligibility.
Not at the moment. What type of non-linear processing do you mean? Do you
mean like dynamic range compression? I found management of the
gain-structure very difficult because if either the carrier or modulator
aren't near maximum amplitude then the output signal is very weak. And if I
turn up the gain, then an internal filter state will most likely clip
somewhere if presented with a 0dBFS sinewave input! I had thought that
something like a 2:1 dynamic range compression on both the carrier and
modulator inputs might work well to tame the output's strong dependence on
_BOTH_ inputs amplitudes.
> Being able to control the attack and release rates is also a nice
> variable - long release times sound almost like reverb and while they
> knock down the intelligibility they sound rather dreamy.
I'll have to try that. At the moment the code is a bit of a mess and i'm
not even sure what the attack and release times are on the different bands
due to the sample-rate changes! Definitely something to try though.
Would also like to try simple AGC on all of the carrier bands to "whiten"
the carrier spectrum before vocoding. This should make the output spectrum
more like the modulator alone, instead of being like the modulator spectrum
multiplied by the carrier's own spectrum. Might sound clearer? ...but
might also boost noise in carriers with a sparse spectrum!
Did you do any broadband compression on either the modulator, carrier or
both inputs in your vocoder Eric?
tHanks for the feedback,
-Richie,
More information about the Synth-diy
mailing list