Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (
- /*
- MODULAR DESIGN PATTERN INSPIRED BY SUPERDIRT
- Note:
- - They all share the same audio bus (reading from it and then replacing its content)
- - Using ReplaceOut for the effects is necessary
- - The envelope frees the group
- */
- // Synths
- SynthDef(\soundgen, {|bus, freq=444|
- Out.ar(bus, SinOsc.ar(freq).dup )
- }).add;
- SynthDef(\fold, {|bus, lo=0.01, hi=0.6|
- ReplaceOut.ar(bus, In.ar(bus, 2).fold(lo,hi))
- }).add;
- SynthDef(\ar_env, {|bus, atk=1, rel=1, dur|
- ReplaceOut.ar(bus, In.ar(bus, 2)
- * EnvGen.kr(Env.perc(atk,rel), timeScale:dur, doneAction: 14)
- )
- }).add;
- SynthDef(\out, {|bus|
- ReplaceOut.ar(0, In.ar(bus,2))
- }).add;
- /*
- Events, groups and patterns
- */
- // Create a new eventtype, this is called every time a pattern plays a "note"
- // The "environment variables" with the tildes as prefix become arguments in the
- // Event (see Pbind below)
- Event.addEventType(\testEvent, {
- var busss = Bus.audio(s,2);
- // Organise the synths in group with the sound generator
- // first and then the effects at the tail
- var testgroup = Group.new;
- Synth.head(testgroup, \soundgen, [\freq, ~freq, \bus, busss]);
- Synth.tail(testgroup, \fold, [\lo, ~lo, \hi, ~hi, \bus, busss]);
- Synth.tail(testgroup, \ar_env, [\dur, ~dur, \atk, ~atk, \rel, ~rel, \bus, busss]);
- Synth.tail( testgroup, \out, [\bus, busss]);
- });
- // Play a pattern
- Pbind(\type, \testEvent,
- \degree, Pwhite(-14,7,inf),
- \octave, 4,
- \scale, Scale.minor,
- \lo, 0.1,
- \hi, Pwhite(0.15,0.8,inf),
- \atk, Pseq([0.05, 0.15, 0.75],inf),
- \rel, 1 - Pkey(\atk),
- \dur, Pstutter(20, Pseq([1, 0.25, 0.125],inf)),
- ).play;
- /*
- // UNCOMMENT THIS TO FUCK UP THE SOUND
- Pbind(\type, \testEvent,
- \degree, Pwhite(-14,7,inf),
- \octave, 5,
- \scale, Scale.minor,
- \lo, 0.1,
- \hi, Pwhite(0.15,0.8,inf),
- \atk, Pseq([0.05, 0.15, 0.75],inf),
- \rel, 1 - Pkey(\atk),
- \stretch, 0.5,
- \dur, Pstutter(20, Pseq([1, 0.25, 0.125],inf)),
- ).play;
- */
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement