SuperCollider/电话音调中的声音设计
外观
(
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;
// 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
)
在运行下面的其他代码块时,让它继续运行...
(
Ndef(\phonesource, {
var onoff;
onoff = if(MouseX.kr > 0.2, 1, 0);
SinOsc.ar([350, 440], 0, onoff).sum * 0.2
})
)
(
Ndef(\phonesource, {
var onoff;
onoff = LFPulse.ar(1/6, width: 1/3);
SinOsc.ar([480, 440], 0, onoff).sum * 0.2
})
)
(
Ndef(\phonesource, {
var onoff;
onoff = LPF.ar(LFPulse.ar(2), 100);
SinOsc.ar([480, 620], 0, onoff).sum * 0.2
})
)
// 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);