Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (
- ~direct = Group.new();
- ~effect = Group.after(~direct);
- ~effectReverb = Bus.audio(s, 2);
- ~effectReverbD = Bus.audio(s, 2);
- )
- (
- //Sound out of Sine waves of the whole tones of the major scale
- SynthDef(\ScaleSound, {arg freq = 440, amp = 0.5, pan = 0.5, time = 1,
- effectBus = ~effectReverb, directsound = 0.5;
- var source, envelope, toneMult;
- //Variables for the sound source
- toneMult = [1, 3/2, 4/3, 5/4, 6/5, 7/6, 8/7];
- amp = amp/7;
- //Envelope and sound source
- envelope = EnvGen.ar(Env([0, amp*0.5, amp, amp*0.6, 0], [time*0.3, time*0.1, time*0.2, time*0.4], 'lin'), doneAction: 2);
- source = Mix.fill(7, {| iterate |
- SinOsc.ar([freq*toneMult[iterate]+Rand(1, 5),
- freq*toneMult[iterate]+Rand(1, 5)], 0, envelope);});
- //Panning and outs
- source = Pan2.ar(source, pan, 1);
- Out.ar(effectBus, source-(source*directsound));
- Out.ar(0, source*directsound);
- }).add;
- //Filter shaped fluty (maybe) tones
- SynthDef(\GrainFlute, {arg freq = 440, amp = 0.5, pan = 0.5, att = 1,
- rel = 1, curve = 0, effectBus = ~effectReverb, directsound = 0.5;
- var source, envelope, time, vibration, rq, bwr;
- //Envelope and sound source
- envelope = EnvGen.ar(Env.perc(att, rel, amp, curve), doneAction: 2);
- source = PinkNoise.ar([envelope, envelope]);
- time = att+rel;
- //Filter variables
- vibration = Dust2.kr(1/time, 0.6, 0.25);
- freq = SinOsc.kr(vibration, 0.1, Rand(1, 10), freq);
- vibration = Dust2.kr(1/time, 0.6, 0.25);
- rq = SinOsc.kr(vibration, 0.1, Rand(0.01, 0.05), 0.1);
- source = BPF.ar(source, freq, rq);
- bwr = EnvGen.kr(Env([0.0001, 0.5, 0.0001], [att, rel], 'welch'));
- source = Resonz.ar(source, freq, bwr);
- source = source*6;
- //Filter variables end
- //Panning and outs
- source = Pan2.ar(source, pan);
- Out.ar(effectBus, source-(source*directsound));
- Out.ar(0, source*directsound);
- }).add;
- //Deep, soft wide bass, not too complicated
- SynthDef(\WideBass, {arg freq = 110, amp = 1, pan = 0.5, time = 1, directsound =
- 0.5, effectbus = ~effectReverb;
- var source, env;
- //Envelope
- amp = amp/10;
- env = EnvGen.ar(Env.perc(time*0.1, time*0.9, amp, -10),
- doneAction: 2);
- //Source signal with filter
- source = Mix.fill(20, {|iterate|
- VarSaw.ar(freq+Rand(0.1, 10), Rand(0, pi*2), Rand(0.0, 1.0),
- env);});
- source = LPF.ar(source, EnvGen.ar(Env([500, 400, freq], [time*0.1,
- time*0.9], 'lin')));
- //Panning and output
- source = Pan2.ar(source, pan);
- Out.ar(effectbus, source-(source*directsound));
- Out.ar(0, source*directsound);
- }).add;
- //Plays a chord or a riff out of a base note
- //440, 440, 550, 582.7, 550, 440, 880
- SynthDef(\RunChord, {arg freq = 440, amp = 2, pan = 0.5, time = 1,
- directsound = 0.5, effectbus = ~effectReverb;
- var source,
- //Frequence, envelope and filter multipliers
- run = [1, 1, 1.25, 1.324, 1.25, 1, 2],
- runt = [0.1, 0.1, 0.2, 0.2, 0.1, 0.3],
- runf = [1,1,1,1,1, 200];
- //Source signal out of 7 frequencies
- source = Mix.fill(6, { |iterate|
- LPF.ar(Saw.ar(freq*run[iterate]+Line.kr(0, runf[iterate] ! 2,
- time),
- EnvGen.ar(Env.perc(time*runt[iterate],
- time-(time*runt[iterate]), 1/7*amp, -10), doneAction: 2)),
- Line.ar(50, 800, time))});
- source = SinOsc.ar(freq)*source;
- //Panning and output
- source = Pan2.ar(source, pan);
- Out.ar(effectbus, source-(source*directsound));
- Out.ar(0, source*directsound);
- }).add;
- //A melodic synth built out of fourths
- SynthDef(\Fourth, {arg freq = 440, amp = 1, pan = 0.5, time = 1, directsound =
- 0.5, effectbus = ~effectReverb;
- var source, env;
- //4 sources grouped into 2 fourths;
- env = EnvGen.ar(Env.perc(0.01, time, 1, 5), doneAction: 2);
- source = SinOsc.ar(freq, 0, env)*(1/2);
- source = source + SinOsc.ar(freq*(4/3), 0.1, env)*(1/3);
- source = source + SinOsc.ar(freq*(18/8), 0.1, env)*(1/4);
- source = source + SinOsc.ar(freq*3, 0.1, env)*(1/5);
- source = source * amp;
- //Panning and output
- source = Pan2.ar(source, pan);
- Out.ar(effectbus, source-(source*directsound));
- Out.ar(0, source*directsound);
- }).add;
- )
- (
- //The low bassy drum
- SynthDef(\Bdrum, {arg freq = 440, amp = 1, pan = 0.5, directsound =
- 0.5, effectbus = ~effectReverbD;
- var source, env;
- env = EnvGen.ar(Env.perc(0.05, 0.3, amp, 10), doneAction: 2);
- source = PinkNoise.ar(env);
- source = LPF.ar(source, Line.kr(freq, 100, 0.1));
- source = Pan2.ar(source, pan);
- Out.ar(effectbus, source-(source*directsound));
- Out.ar(0, source*directsound);
- }).add;
- //The kick
- SynthDef(\Kick, {arg freq = 880, amp = 1, pan = 0.5, directsound =
- 0.5, effectbus = ~effectReverbD;
- var source, env;
- env = EnvGen.ar(Env.perc(0.05, 0.2, amp, 20), doneAction: 2);
- source = WhiteNoise.ar(env);
- source = Resonz.ar(BPF.ar(source, Line.kr(freq, 50, 0.1), Line.kr(4, 0.01, 0.15)), 440, 1);
- source = source * Saw.ar(Rand(10, 100), 0, 1);
- source = Pan2.ar(source, pan);
- Out.ar(effectbus, source-(source*directsound));
- Out.ar(0, source*directsound);
- }).add;
- //The high hat
- SynthDef(\HighHat, {arg freq = 1000, amp = 1, pan = 0.5, directsound =
- 0.5, effectbus = ~effectReverbD;
- var source, env;
- env = EnvGen.ar(Env.perc(0.05, 0.3, amp/10, -5), doneAction: 2);
- source = Mix.fill(10,{SinOsc.ar(freq+Rand(0, 200), 0, env)});
- source = source * BPF.ar(PinkNoise.ar(2), 1000, SinOsc.ar(0.5, 0, 1.4, 1.5));
- source = Resonz.ar(source, 2000, 3);
- source = Pan2.ar(source, pan);
- Out.ar(effectbus, source-(source*directsound));
- Out.ar(0, source*directsound);
- }).add;
- )
- //Interesting noise thing
- SynthDef(\Backwardnoise, {arg freq = 440, amp = 1/7, pan = 0.5
- }).add;
- (
- //Reverb
- SynthDef(\Reverb, {arg room = 1, damp = 0.5, sourceBus = ~effectReverb;
- var source;
- source = In.ar(sourceBus, 2);
- source = FreeVerb.ar(source, 1, room, damp);
- Out.ar(0, source);
- }).add;
- //Reverb
- SynthDef(\ReverbD, {arg room = 1, damp = 1, sourceBus = ~effectReverbD;
- var source;
- source = In.ar(sourceBus, 2);
- source = FreeVerb.ar(source, 1, room, damp);
- Out.ar(0, source);
- }).add;
- Synth(\Reverb, [\room, 0.5], ~effect);
- Synth(\ReverbD, [\room, 0.5], ~effect);
- )
- Synth(\GrainFlute, [\freq, 1000, \amp, 0.1, \pan, 0.5, \att, 5,
- \rel, 6, \directsound, 0.5], ~direct);
- //Main theme
- //Rythms [0.5, 0.5, 1, 0.2, 0.8, 0.5, 0.5, 0.5, 4.5]
- j = Routine({var freqs =
- [440, 440, 550, 582.7, 550, 440, 880, 830, 932.3, 987.74, 1975.47, 1975.47];
- loop { Synth(\GrainFlute, [\freq, freqs[0], \amp, 0.1, \pan, 0.5, \att, 0.6,
- \rel, 0.1, \directsound, 0.5], ~direct);
- 0.5.yield;
- Synth(\GrainFlute, [\freq, freqs[1], \amp, 0.1, \pan, 0.5, \att, 0.5,
- \rel, 0.1, \directsound, 0.5], ~direct);
- 0.5.yield;
- Synth(\GrainFlute, [\freq, freqs[2], \amp, 0.3, \pan, 0.5, \att, 1,
- \rel, 1, \directsound, 0.5], ~direct);
- Synth(\WideBass, [\freq, 55, \amp, 1, \pan, 0.5, \time, 10,
- \directsound, 0.5], ~direct);
- 1.yield;
- Synth(\GrainFlute, [\freq, freqs[3], \amp, 0.1, \pan, 0.6, \att, 1,
- \rel, 1, \directsound, 0.5], ~direct);
- 0.2.yield;
- Synth(\RunChord, [\freq, 582.7, \amp, 2, \pan, 0.4, \time, 5,
- \directsound, 0.5], ~direct);
- 0.8.yield;
- Synth(\GrainFlute, [\freq, freqs[4], \amp, 0.2, \pan, 0.5, \att, 1,
- \rel, 1, \directsound, 0.5], ~direct);
- 0.5.yield;
- Synth(\ScaleSound, [\freq, freqs[5], \amp, 0.1, \pan, 0.5, \time, 3,
- \directsound, 0.5], ~direct);
- 0.5.yield;
- Synth(\GrainFlute, [\freq, freqs[6], \amp, 0.05, \pan, 0.5, \att, 2,
- \rel, 2, \directsound, 0.5], ~direct);
- 0.5.yield;
- Synth(\WideBass, [\freq, 110, \amp, 0.5, \pan, 0.5, \time, 10,
- \directsound, 0.5], ~direct);
- 4.5.yield;
- }});
- j.play(quant: 4);
- j.stop;
- //Melodic content
- p = Routine({var freq =
- [440, 440, 550, 582.7, 550, 440, 880, 830, 932.3, 987.74, 1975.47, 1975.47];
- loop {
- Synth(\Fourth, [\freq, freq[0], \amp, 0.3, \pan, 0.55, \time, 2
- ,\directsound, 0.7], ~direct);
- 1.yield;
- Synth(\Fourth, [\freq, freq[1], \amp, 0.3, \pan, 0.45, \time, 2
- ,\directsound, 0.7], ~direct);
- 1.yield;
- Synth(\Fourth, [\freq, freq[2], \amp, 0.1, \pan, 0.65, \time, 2
- ,\directsound, 0.7], ~direct);
- 2.yield;
- Synth(\Fourth, [\freq, freq[3], \amp, 0.2, \pan, 0.35, \time, 0.5
- ,\directsound, 0.7], ~direct);
- 0.5.yield;
- Synth(\Fourth, [\freq, freq[4], \amp, 0.2, \pan, 0.5, \time, 3
- ,\directsound, 0.7], ~direct);
- 1.5.yield;
- }});
- p.play;
- p.stop;
- u = Routine({
- var amp = 1;
- loop {
- amp.postln;
- //if (amp<1){amp = amp + 0.1}{amp};
- Synth(\Bdrum, [\amp, amp],target: ~direct);
- 0.5.yield;
- }});
- j.play;
- u.play;
- u.stop;
- j.stop;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement