Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///////////////// Dynamic Amplitude, Part 3 /////////////////
- // You can find a YouTube demonstration here: https://www.youtube.com/watch?v=dDwRqWm9Qss&t=630s&ab_channel=SoundEngraver
- s.boot;
- s.plotTree;
- s.meter;
- s.scope;
- s.reboot;
- s.quit;
- // Add Sound File
- ~ice = Buffer.read(s, "insertaudiohere");
- // Note: ~ice is the name I gave my original sound file, for its icy atmosphere.
- ~ice.play;
- ~ice.free;
- ~ice.duration;
- ~ice.numChannels;
- ~ice.sampleRate;
- (
- Env.new(
- {rrand(0.1, 1)}!5,
- {rrand(4, 12)}!4,
- {rrand(-8.0, 8.0)}!4
- ).plot
- )
- // Apply it to the ~icePulse Synth.
- (
- ~iceSaw = SynthDef.new(\play, {
- arg saw=1, minAmp=0.001, maxAmp=1,
- buf=0, rate=1, spos=0, pan=0, amp=1, out=0;
- var sig, env, modAmp;
- env = Env(
- {rrand(0.1, 1.0)}!10,
- {rrand(1, 8)}!9,
- {rrand(1, 8)}!9
- ).kr(2);
- modAmp = Saw.kr(saw).exprange(minAmp, maxAmp);
- sig = PlayBuf.ar(
- 2,
- buf,
- BufRateScale.ir(buf) * rate,
- spos
- );
- sig = sig * env * modAmp;
- pan = Pan2.ar(sig, pan, amp);
- Out.ar(out, sig);
- }).add;
- )
- ~iceSaw = Synth(\play, [\buf, ~ice]);
- ~iceSaw.set(\saw, 12);
- ~iceSaw.free;
- (
- {
- EnvGen.kr(
- Env(
- levels: [0, 0.1, 0.2, 0.3],
- times: [0.1, 0.1, 0.1],
- curve: 8
- ),
- gate: Impulse.kr(3)
- );
- }.plot(duration: 4);
- )
- (
- ~iceSaw = SynthDef.new(\play, {
- arg saw=1, minAmp=0.001, maxAmp=1,
- buf=0, rate=1, spos=0, pan=0, amp=1, out=0;
- var sig, env, modAmp;
- env = EnvGen.kr(
- Env(
- levels: [0, 0.1, 0.2, 0.3],
- times: [0.1, 0.1, 0.1],
- curve: 12
- ),
- gate: Impulse.kr(3)
- );
- modAmp = Saw.kr(saw).exprange(minAmp, maxAmp);
- sig = PlayBuf.ar(
- 2,
- buf,
- BufRateScale.ir(buf) * rate,
- spos
- );
- sig = sig * env * modAmp;
- pan = Pan2.ar(sig, pan, amp);
- Out.ar(out, sig);
- }).add;
- )
- ~iceSaw = Synth(\play, [\buf, ~ice]);
- ~iceSaw.set(\saw, 4);
- ~iceSaw.free;
- (
- {
- EnvGen.kr(
- Env(
- levels: [0, 0.5, 0.1, 1, 0.8, 0.3, 0.9, 0.1, 0],
- times: [1, 1, 1, 1, 1, 1, 1, 1],
- curve: [-3, 3, -2, -3, 1, -1, 3, -2]
- )
- );
- }.plot(duration: 8);
- )
- (
- ~iceSaw = SynthDef.new(\play, {
- arg saw=1, minAmp=0.001, maxAmp=1,
- buf=0, rate=1, spos=0, pan=0, amp=1, out=0;
- var sig, env, modAmp;
- env = Env(
- [0, 0.5, 0.01, 1, 0.8, 0.03, 0.9, 0.1, 0],
- [4, 4, 4, 4, 4, 4, 4, 4],
- [-3, 3, -2, -3, 1, -1, 3, -2],
- ).kr(2);
- modAmp = Saw.kr(saw).exprange(minAmp, maxAmp);
- sig = PlayBuf.ar(
- 2,
- buf,
- BufRateScale.ir(buf) * rate,
- spos
- );
- sig = sig * env * modAmp;
- pan = Pan2.ar(sig, pan, amp);
- Out.ar(out, sig);
- }).add;
- )
- ~iceSaw = Synth(\play, [\buf, ~ice]);
- ~iceSaw.set(\saw, 8);
- ~iceSaw.free;
- // Remember, the synth will only last as long as the duration of the sound file. You might need to work with loopNode and releaseNode in the Env.
- // See Help example for releaseNode (see Part 4)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement