Skip to content

Instantly share code, notes, and snippets.

@edeleflie
Created September 15, 2011 23:29
Show Gist options
  • Save edeleflie/1220792 to your computer and use it in GitHub Desktop.
Save edeleflie/1220792 to your computer and use it in GitHub Desktop.
Composition template start
~orchestra= Buffer.read(s, "/Users/etiennedeleflie/Documents/teaching/music_synthesis/08/classical_long.wav");
~bass= Buffer.read(s, "/Users/etiennedeleflie/imagesynth/audio/DoubleBass.wav");
(
~first_filter = Synth("auditory_s_s", [ \in, 100, \out, 0, \pan, 0 ]); // try a rate of 0.1
~xenakish_1 = Synth("Xenakish", [ \out, 100, \soundFile, ~orchestra, \speed, 1.0, \goTo, 0.5, \t_ramp, 1 ]);
~second_filter = Synth("auditory_s_s", [ \in, 101, \out, 0, \pan, 0 ]); // try a rate of 0.1
~xenakish_2 = Synth("Xenakish", [ \out, 101, \soundFile, ~bass, \speed, 1.0, \goTo, 0.5, \t_ramp, 1 ]);
~xenakish_2.set(\vol, 0.2);
// do some auditory ss separation
~first_filter.set(\room, 0.8, \pan, 0.7, \mix, 0.3, \source_vol, 0.1, \stereoWidthVol, 1.0, \stereoWidthAmount, 0.01);
~second_filter.set(\room, 0.1, \pan, -0.5, \mix, 0.1, \source_vol, 1.0, \stereoWidthVol, 1.0, \stereoWidthAmount, 0.02);
// get a granular texture going (50msec grains, triggered every 10msec, small random position to smooth out texture)
~xenakish_1.set(\grainLength, 0.05, \triggerGrainEvery, 0.01, \randomPosSpread, 0.008);
~xenakish_2.set(\grainLength, 0.08, \triggerGrainEvery, 0.01, \randomPosSpread, 0.01);
// create a Lindenmeyer system pattern
~linden_1 = Prewrite(0, ( 0: #[0, 1, 2, 3],
1: #[1, 0, 1, 1.2],
2: #[2, 0, 2.3, 1],
3: #[0.2, 0, 0.3, 0]),
3);
)
// check what the lindenmeyer system gives me
// x = ~linden_1.asStream; 40.do({ ((x.next)).post; "-".post });
// run the patterns together
(
// this one uses the lindenmeyer pattern to set granular position
p = Pbind( \type, \set, \id, ~xenakish_1.nodeID,
  \args, #[goTo, goIn, t_ramp],
\goTo, ~linden_1 / 4.0,
\goIn, 1000,
\t_ramp, 1,
\dur, 1
).play;
// These are patterns of values for triggerGrainEvery...
// Values near 0.01 will give a smooth texture
// Higher values will start to create perceivable short bursts of sound.
~p1 = Pseq( [0.125, 0.125, 0.125, 0.0125], 1);
~p2 = Pseq( [2.0, 0.25, 0.0125, 0.0125], 1);
~p3 = Pseq( [0.125, 2.0, 0.250, 0.075 ], 1);
~p4 = Pseq( [0.25, 0.125, 0.075, 0.0375], 1);
// this pattern just changes the volume on the xenakish synth, creates structure
q = Pbind( \type, \set, \id, ~xenakish_1.nodeID,
  \args, #[triggerGrainEvery],
\triggerGrainEvery, Pseq( [ ~p1, ~p2, ~p3, ~p4 ], 4),
\dur, 1
).play;
Pbind( \type, \set, \id, ~xenakish_1.nodeID,
  \args, #[vol],
\vol, Pseq( [ Pseq( [1], 8), Pseq( [0], 2) ], inf),
\dur, 1
).play;
r = Pbind( \type, \set, \id, ~xenakish_2.nodeID,
  \args, #[goTo, goIn, t_ramp, vol],
\goTo, Pseq( [ 0.1, 0.4, 0.1, 0.7, 0.2, 0.23, 0.5, 0 ], 8),
\goIn, 500,
\t_ramp, 1,
\dur, 0.5
).play;
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment