Designing Sound in SuperCollider/Phone tones
Fig 25.2: CCITT dialing tone
edit(
Ndef(\dialtone, {
// Note: the array here specifies two frequencies, so we get two separate channels.
// We sum the two channels so they combine into one signal - otherwise we
// would hear one note on left, one note on right.
Pan2.ar(SinOsc.ar([350, 440], 0, 0.2).sum)
}).play
)
// To stop:
Ndef(\dialtone).free;
Fig 25.3: Filter to approximate the transmission medium
edit// Doesn't make any sound in itself, but
// filters whatever we put in Ndef(\phonesource) and outputs that
(
Ndef(\transmed, {
var sig = Ndef(\phonesource).ar.clip2(0.9);
sig = BPF.ar(sig, 2000, 1/12);
sig =
BPF.ar(sig * 0.5, 400, 1/3)
+
(sig.clip2(0.4) * 0.15);
HPF.ar(HPF.ar(sig, 90), 90) * 100;
}).play
)
Leave it running while you run the other blocks of code below...
Fig 25.4: The filter applied to the dialing tone
edit(
Ndef(\phonesource, {
var onoff;
onoff = if(MouseX.kr > 0.2, 1, 0);
SinOsc.ar([350, 440], 0, onoff).sum * 0.2
})
)
Fig 25.5a: Ringing tone
edit(
Ndef(\phonesource, {
var onoff;
onoff = LFPulse.ar(1/6, width: 1/3);
SinOsc.ar([480, 440], 0, onoff).sum * 0.2
})
)
Fig 25.5b: Busy tone
edit(
Ndef(\phonesource, {
var onoff;
onoff = LPF.ar(LFPulse.ar(2), 100);
SinOsc.ar([480, 620], 0, onoff).sum * 0.2
})
)
Fig 25.6: Pulse dialling, before DTMF
edit// First run this block to create the synth... (the filter from earlier on should still be running!)
(
Ndef(\phonesource, { |t_trig=0, number=0|
var onoff, trigs, son;
number = if(number < 0.5, 10, number); // zero is represented by 10 clicks!
onoff = Trig1.ar(t_trig, number * 0.1);
trigs = Impulse.ar(10) * onoff;
son = Trig1.ar(trigs, 0.04);
son;
});
)
// ...then dial some numbers by repeatedly running this line:
Ndef(\phonesource).set(\t_trig, 1, \number, 10.rand.postln);