sctutorial ch 3.2

This commit is contained in:
Dan Buch 2017-11-20 17:59:13 -05:00
parent f9a9fb0ccb
commit f68979b85e
Signed by: meatballhat
GPG Key ID: 9685130D8B763EA7

View File

@ -202,3 +202,99 @@
(
a.set(\gate, 0);
)
(
SynthDef(\sine,
{
Out.ar(
0, SinOsc.ar(
Rand(440, 880), 0, 0.1
)
)
}
).add;
)
(
Synth(\sine);
)
(
a = Synth(\sine);
a.writeDefFile("synth.out");
)
(
SynthDef(\sine, {
arg freq=440, amp=0.1;
Out.ar(
0,
SinOsc.ar(freq, 0, amp)
)
}).add;
)
(
Synth("sine");
Synth("sine", [\freq, 880])
)
(
a = Synth(\sine);
b = Synth(\sine, [\freq, 550]);
c = Synth(\sine, [\freq, 660, \amp, 0.5]);
)
(
c.set(\freq, 1000);
b.set(\amp, 0.3, \freq, 100);
)
(
a.free;
b.free;
c.free;
)
(
SynthDef(\hum, {
arg freq=440;
var finaloutput = Mix(
[
SinOsc.ar(freq, 0, 0.3),
SinOsc.ar(freq*2, 0, 0.2),
SinOsc.ar(freq*3, 0, 0.1),
SinOsc.ar(freq*3.33, 0, 0.01),
SinOsc.ar(freq*4, 0, 0.1),
SinOsc.ar(freq*4.5, 0, 0.01),
SinOsc.ar(freq*4.75, 0, 0.02)
]
);
Out.ar(0, finaloutput);
}).add;
)
(
Synth(\hum, [\freq, 220]);
)
(
Synth(\hum, [\freq, 880]);
)
(
Synth(\hum, [\freq, 440]);
)
(
SynthDescLib.global.synthDescs[\sine].def.func.postcs
)
(
SynthDescLib.global.synthDescs.do { |desc|
if(desc.def.notNil) {
"\nSynthDef %\n".postf(desc.name.asCompileString);
desc.def.func.postcs;
};
}
)