« Return to Thread: Vocoders

Re: Vocoders

by James Harkins-2 :: Rate this Message:

Reply to Author | View in Thread

Even easier is to use BPF instead of a LPF --> HPF pair. Then you have control over the bandwidth.

I've found amplitude control to be tough -- with a narrower bandwidth, you get a cooler, more robotic sound but since you're filtering out most of the sound's energy, the amplitude winds up very low. I tried a bunch of things to adjust it automatically but nothing worked well -- so I just added an amp argument to the synthdef and set it as high as needed (sometimes 100 or more).

Also you can make the code easier to read using multichannel expansion.

This is my vocoder. Note that I use a function to be able to generate a new synthdef if I need to use it on a 2+ channel signal.

(
var makeVocoderDef = { |numbands = 20, inChannels = 1, lowBand = 100, hiBand = 10000|
SynthDef(\vocoder, { |inbus, vocbus, rq = 0.07, amp = 1|
var sig, centerFreqs, splitFilt, bandamps;
var sig2, inSplit;
// analysis phase
sig = In.ar(vocbus, 1);
centerFreqs = Array.geom(numbands, lowBand, (hiBand / lowBand) ** (numbands-1).reciprocal);
splitFilt = BPF.ar(sig, centerFreqs, rq);
bandamps = Amplitude.ar(splitFilt);


// resynthesis phase
sig2 = In.ar(inbus, inChannels);
inSplit = sig2.asArray.collect({ |channel| BPF.ar(channel, centerFreqs, rq, bandamps) });
Mix.ar(inSplit.flop) * amp
});
};

makeVocoderDef.value.send(s);
)

hjh

On Jan 13, 2007, at 2:41 PM, hans wrote:

hi

vocoder is very simple. it did it with this code:



s = 0;

15.do ({arg i;
x = HPF.ar(LPF.ar(y,75*(1.5**i)),50*(1.5**i));
z = HPF.ar(LPF.ar(l,75*(1.5**i)),50*(1.5**i));
z = PeakFollower.ar(z, 0.5);
x = x*z;
s = s+x; });


y is the audiosignal that u want to modify, and l is the audiosignal you
want to analyse. they are split in 15 bands. s contains the output.

greez hans


: H. James Harkins

: jamshark70@...

: http://www.dewdrop-world.net

.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:


"Come said the Muse,

Sing me a song no poet has yet chanted,

Sing me the universal."  -- Whitman



_______________________________________________
sc-users mailing list
sc-users@...
http://www.create.ucsb.edu/mailman/listinfo/sc-users

 « Return to Thread: Vocoders