Sirens - Supercollider


























LFPulse è un oscillatore di impulso, l'ampiezza varia da 1 a zero, non limitato in banda;
la frequenza del suono "son", freq, è un segnale impulsivo di controllo, un LFO con rate di default a 0.1 con smoothing esplonenziale ottenuto grazie a lagud;
il suono "son" è a sua volta un segnale impulsivo con frequenza modulata dalla variabile "freq";

il tutto viene clippato per introdurre distorsione e fatto passare in un filtro passbanda per imitare
il megafono di plastica della sirena; poi abbiamo un delay e un reverb;

In SuperCollider we can provide an almost-direct physical model: the LFPulse represents a "raw" on/off signal before smoothing by capacitors, and the "lagud" provides exponential smoothing, with the handy feature of allowing different time-periods for the "on" and "off" convergence. This one-line example will plot the curve for you:

This is essentially the same as Lag except that you can supply a different 60 dB time for when the signal goes up, from when the signal goes down. This is useful for smoothing out control signals, where "fade in" should be different from "fade out".

ar (in: 0, lagTimeU: 0.1, lagTimeD: 0.1, mul: 1, add: 0)
kr (in: 0, lagTimeU: 0.1, lagTimeD: 0.1, mul: 1, add: 0)

Arguments:
in input signal.
lagTimeU 60 dB lag time in seconds for the upgoing signal.
lagTimeD 60 dB lag time in seconds for the downgoing signal.
mul
add


{LFPulse.ar(1, 0.99, 0.4).lagud(0.3, 0.7)}.plot(2)

(
SynthDef(\dsaf_horn1, { |rate=0.1|
        var freq = LFPulse.kr(rate, 0.99, 0.4).lagud(0.4 / rate, 0.6 / rate) * 800 + 300;
        var son  = LFPulse.ar(freq, 0.99, 0.2).lagud(0.4 / freq, 0.6 / freq) * 2 - 1;

        // This filtering is a simple approximation of the plastic horn acoustics:
        son = BPF.ar(son.clip2(0.2), 1500, 1/4) * 4;

        // delay and reverb, to simulate the environment in which we hear the siren
        son = son + DelayC.ar(son, 0.1, 0.1, 0.3);
        son = son + FreeVerb.ar(son);

        Out.ar(0, Pan2.ar(son * 0.4));
}).add;
)

x = Synth(\dsaf_horn1);

s.scope

// Choose a rate
x.set(\rate, 3);
x.set(\rate, 0.1)


LFPulse     pulse oscillator

LFPulse.ar(freq, iphase, width, mul, add)
LFPulse.kr(freq, iphase, width, mul, add)

A non-band-limited pulse oscillator. Outputs a high value of one and a low value of zero.

freq - frequency in Hertz
iphase - initial phase offset in cycles ( 0..1 )
width - pulse width duty cycle from zero to one.



BPF             2nd order Butterworth bandpass filter

Inherits from: Object : AbstractFunction : UGen : Filter


BPF.ar(in, freq, rq, mul, add)
BPF.kr(in, freq, rq, mul, add)


A second order Butterworth bandpass filter.
     
in - input signal to be processed
freq - centre frequency in Hertz.
rq - the reciprocal of Q. bandwidth / cutoffFreq.


DelayC  simple delay line with cubic interpolation

DelayC.ar(in, maxdelaytime, delaytime, mul, add)
DelayC.kr(in, maxdelaytime, delaytime, mul, add)

Simple delay line with cubic interpolation. See also DelayN which uses no interpolation, and DelayL which uses linear interpolation. Cubic interpolation is more computationally expensive than linear, but more accurate.

See also BufDelayC.
     
in - the input signal.
maxdelaytime - the maximum delay time in seconds. used to initialize the delay buffer size.
delaytime - delay time in seconds.

FreeVerb    A reverb

FreeVerb.ar(in, mix, room, damp, mul, add)

coded from experiments with faust.

Valid parameter range from 0 to 1. Values outside this range are clipped by the UGen.

in - input signal.
Mix - dry/wet balance. range 0..1
room - room size. rage 0..1
damp - Reverb HF damp. range 0..1




Categories: , Share

Leave a Reply