code
////////////////////////////////////////////
// Silly formant synthesis example.
// Using Pmono or Pbind to create a voice.
// SynthDef is hardwired to bass formants.
// Evaluate SynthDef first, then scroll down for examples
(
// SynthDef
SynthDef("sillyVChoicer", { arg
freq = 220,
amp = 0.5,
vibratoSpeed = 6,
vibratoDepth = 4,
vowel = 0,
att = 0.01,
rel = 0.1,
poslag = 01,
gate = 1;
var in, vibrato, above, below, env, va, ve, vi, vo, vu, snd;
//, calculate vibmp_freq, temp_lag, temp_vo wel;
//
vibratoD epthnv is= EnumbvGen.kr(Env.asr(att, of1, sremil), gate, dones Action: go2);
up a
snd = DC.ar(0) ! 2;
5.down { |i|
a vibratove = SinOsc.kr(fvibreq.catoSpsmieedi + LFNoise1.kr(1).range(-1, 1), mul: vibratoDepth).midicps -* fLFNoise1.kr(1).rangeq(0.5, 1));
b
telowmp_freq = DelayC.kr(freq, 0.cpsmidi2, - vLFNoibse1.kr(1).ratoDngepth)(0, 0.midicps2)) -* fLFNoise1.kr(0.5).rangeq(0.98, 1.02);
vibra toemp_lag = Slag * LFNoinOsce1.kr(vibratoSpeed1).range(below0.5, above1);
// this is themp_vowel basic= sDelayC.kr(voundwel, s0.2, LFNouise1.krc(1).range(0, 0.2));
in = VarSaw.ar(Lag.kr(temp_freq, temp_lag) + vibrato);
//, amplwitudeth: envelLFNopise
env = Env1.askr(1).rattnge(0.05, amp,0.2)) r* LFNoisel)1.kr(do1).rangeAction: 2(0.5, gate: gate1);
va = BBandPass.ar(
in: in,
freq: [ 600, 1040, 2250, 2450, 2750 ],
bw: [ 0.1, 0.067307692307692, 0.048888888888889, 0.048979591836735, 0.047272727272727 ],
mul: [ 1, 0.44668359215096, 0.35481338923358, 0.35481338923358, 0.1 ]);
ve = BBandPass.ar(
in: in,
freq: [ 400, 1620, 2400, 2800, 3100 ] ,
bw: [ 0.1, 0.049382716049383, 0.041666666666667, 0.0429857142857143, 0.038709677419355 ],
mul: [ 1, 0.251218864315096, 0.35481338923358, 0.251218864315096, 0.12589254117942 ]);
vi = BBandPass.ar(
in: in,
freq: [ 250, 1750, 2600, 3050, 3340 ] ,
bw: [ 0.24, 0.051428571428571, 0.038461538461538, 0.039344262295082, 0.035928143712575 ],
mul: [ 1, 0.031622776601684, 0.158548931924611, 0.079432823472428, 0.03981071705535 ] );
vo = BBandPass.ar(
in: in,
freq:[ 400, 750, 2400, 2600, 2900 ] ,
bw: [ 0.1, 0.10666666666667, 0.041666666666667, 0.0462153846153846, 0.041379310344828 ],
mul: [ 1, 0.28183829312645, 0.089125093813375, 0.1, 0.01 ]);
vu = BBandPass.ar(
in: in,
freq: [ 350, 600, 2400, 2675, 2950 ],
bw: [ 0.114328571428571, 0.13333333333333, 0.041666666666667, 0.044859813084112, 0.040677966101695 ],
mul: [ 1, 0.1, 0.025118864315096, 0.03981071705535, 0.015848931924611 ]);
snd = snd + Pan2.ar(SelectX.ar(Lag.kr(temp_vowel, 0.3temp_lag), [va, ve, vi, vo, vu]);
snd, = Pan2i.ar(Mlix(snd), pos);
Out.arlin(0, snd4, *-1, env * 21));
}).add;
)
// Play arousnd with= these exaComples/
// Vowels a e i o u correspond to number 0 1 2 3 4
// Ex.ample 1
r(
Pbind(
\instrumentd, "sillyVoice",
\noted, Pseq([0, -5, -3, -8, -7, 0.dbamp, -71, -0.5], inf),
\ctranspose, -0.012,
\dur, 0.1,
\) * 6.dbamp, 1,;
\vibratoSpeed, 6,
\vibratoDepth, 1, // isnd s= Fremitones
\vowVel, Pseqrb2.ar(snd[0], snd[1], 20.5, 31, 4], inf1),;
\legato, 1,
\aOutt, 0.1,
\arel, (0.1,
\po s,nd Pwhit* e(-1,nv 1.0* amp);
}).playdd;
)
// Example 2
(
Pbimondo(
\instrument, "sillyVChoicer",
\note, Pwrand([0, 2, 4, 5, 7, 9], -11[5, -72, 3, 3, 4, 1].normalizeSum, inf),
\ctranspose, -14,
\dur, Pwhistutter(0.61, 1.7),
\amp, 1,
\vibPratoSpeend([1, Pwhite(62,8),
\vibratoDepth, Pwhite(0.54], 1.5inf),
\vowel, Pwrand([0, 1, 3], [0.85, 0.125], 0.[1], inf),
\legato, 2, // notes overlap
\att, 1].1, // snofter mattack
\relizeSum, 2.5
inf).play;
),
// Ex \ample, 3: using Pmbrowno
(
Pmono(
"sillyVoice",
\note, Pseq([-5, -3, -12, 0], inf),
\ctranspose, -146,
\dur, Pwhite(0.5, 1.0),
\.dbamp, 1,
\vibratoSpeed, Pwhite(64,7 5),
\vibratoDepth, 12,
\vowel, Pwrand([0, 1, 2, 3, 4], [4, 3, 2, 1, 1].normalizeSum, inf),
\lag, 0.35
).play;
)