Vocoder Design

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

Hi,

Iv been trying to create a vocoder in Csound. All is ok, but it thought Id ask the experts for a few tips! So far i have a 'soundin' audio file going into 50 Butterworth BP filters, and then into 50 envelope followers. Then I have an square oscillator and a noise generator, going into 50 identical filters, whose amplitudes are controlled by the env followers. Finally, the outputs are mixed and balanced.

This sounds alright, but not quite the ticket. I think this is down to one or both of the following:

- Inappropriate choice of filters

- Wrong filter frequencies.

Could anyone suggest a good choice of filter type for the analysis and subtractive filters? And also possibly give me some advice on selecting a useful distribution of cutoff frequencies?

Thanks! Appreciate any advice, Im new to this coding biz! :oops:

Post

If this is a second-order IIR butterworth BP filter, the Q is probably 0.707, which gives a fractional bandwidth of 1.414. Q = 1.0 / FractionalBandwidth.

Yer filters are overlapping too much, so the vocoder effect is 'watered down'.

You could make some kind of calculation to determine the desirable bandwidth, or just fiddle with the bandpass filter Q until you like the sound. Some calculation for desirable bandwidth still might not sound right, so experimentation is probably better.

With this many filters, perhaps start with a Q of 10.0?

Post

JCJR wrote:With this many filters, perhaps start with a Q of 10.0?
...and don't forget to pull down the gain accordingly - a typical 2nd order IIR has gain approximately equal to Q for Q > 2 or so.
Image
Don't do it my way.

Post

Ok, initially i set the filters from 0 to 10000Hz with 200Hz intervals. Each filter was given a bandwidth of 200Hz for the modulator, but i then experimented with different bandwidths for the carrier filters. Im not sure if this is a desirable distribution of the filters or not, but it seemed a fair place to start.

I think id probably be best off trying to find some specs for some classic analog designs. And perhaps replace the carrier filters for some kind of resonant bandpass?

Thanks the for advice btw!

Post

Hi Tee

If attempting to evenly spread X bandpass filters over the audio band, the distance between band centers should increase as the frequency is increased.

If you evenly space the filters every XX Hz, you are likely to get too-few filters in the bass, and too-many filters in the highs.

For instance, your first 200 Hz filter (0 -> 200 Hz) spans over 3 octaves in the 'audible range' of 20 -> 20,000 Hz! Oct 1 = 20 -> 40, Oct 2 = 40 -> 80, Oct 3 = 80 -> 160.

But your highest target top octave span of 5,000 -> 10,000 Hz gets 25 filters! Half yer filters are assigned to a freq range too high to have much effect on vocal intelligibility.

Here is one way to exponentially lay out your filter frequencies so they are approximately 'evenly spaced' according to the ear's expectations--

HighestFreq = 10000; //or whatever you like
LowestFreq = 40; //or whatever
NumFilters = 50; //or whatever
FreqMul = pow((HighestFreq / LowestFreq), (1.0 / NumFilters));
FilterFreq[0] = LowestFreq;
for (i = 1; i < NumFilters; ++i)
{
FilterFreq = FilterFreq * FreqMul;
}

This would give you frequencies that look like

40, 44.7, 49.9, 55.7,.... 7179.9, 8013.3, 8954.5, 10000
=====

Re the bandwidth of bandpass filters--

HiCutoff //the high -3 dB cutoff frequency
LoCutoff //the low -3 dB cutoff frequency
CenterFreq = pow((HiCutoff * LoCutoff), 0.5);
Bandwidth = HiCutoff - LoCutoff;
FractionalBandwidth = Bandwidth / CenterFreq;
Q = 1.0 / FractionalBandwidth;

FractionalBandwidth can be more useful than absolute bandwidth. For instance, a third-octave bandpass filter has the same Q and FractionalBandwidth regardless of the filter's CenterFrequency.

However, the absolute bandwidth is not as useful, because a high frequency third-octave filter is wider than a low frequency third-octave filter, because high octaves are wider than low octaves.

If you can find some IIR second-order bandpass filter code you like, which can be specified in terms of CenterFrequency and Q, it is very convenient for specifying filter banks.

I enjoy the RBJ Cookbook Filters, and you can google many good hits on those.

Post

Fella, you are a star :)

I didnt consider the octave / Hz relationship at all. But after reading your post it makes perfect sense. Obviously an exponential distribution of the filters is the order of the day.

At the moment im relying totally on the builting opcodes in Csound for my filters. When I learn how to create new opcodes I'll undoubtable be checking out those you mentioned. But for now Im using 'reson' and 'butterworth' filters (usually the later).

Thanks again!

Post

You really want to position all you bandpass filters exponentially in the 200 - 3.5kHz region where most of the 'information' for how we articulate different sounds is. Bandpass filters outside this region would be pretty much redundant in a vocoder..

Butterworth filters should be fine, but I've read somewhere that bessel filters may be more ideal, not really sure why though..

If using butterworth invert the phase of every second filter, this stops frequencies cancelling in between filters filter, this is to do with the phase response of butterworth filters.

Hope this helps

Good luck

Post

Hi Tee

I'm very ignorant of Csound. Long ago read a book about it, and looked at some of the code a couple years ago. Hopefully others will chime in.

From the sound of it, Reson might be what you are looking for, if it can specify a bandpass with CenterFrequency and Q. Resonance and Q are 'kinda synonymous', but I don't know if there is a strict numerical definition of the term 'resonance' as there is with Q, which is a common-as-dirt old electrical engineering term.

I recall looking at the CSound Hilbert Transform code, which used pretty ordinary IIR Allpass filters. CSound is such a huge bag of tricks, it only makes sense that there must be some ordinary old biquad IIR filters in there somewhere!

A second-order Butterworth filter would usually have a Q of 0.707. Alternatively, if you want a pretty wide passband, one might cascade a Butterworth Hipass and a Butterworth Lopass filter. Maybe you could snoop the Butterworth object and see what the heck its trying to do.

IIR Bandpass filters are good at bandwidths less than a couple of octaves. At Q's higher than 2, they start getting very narrow and pointy at the center frequency. With very high Q's, they want to become oscillators, which is why you might call them a resonant filter.

Post Reply

Return to “DSP and Plugin Development”