Created
September 2, 2011 00:47
-
-
Save edeleflie/1187688 to your computer and use it in GitHub Desktop.
Xenakish
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( | |
SynthDef("Xenakish", { arg out = 0, soundFile, t_ramp = 0, | |
triggerGrainEvery = 1, // how often to trigger the grains. Start with 0.05 (every 50 msec). | |
goTo = 0, // position in file 0 to 1. | |
goIn = 0, // time to get to the position (in seconds). | |
randomPosSpread = 0, // random spread in seconds. Start with 0.01. | |
grainLength = 1, // length of grain in seconds. typically 10-50msec. Start with 0.05 (50 msec). | |
speed = 1, // how fast to play the grain. Affects pitch. | |
vol = 1; // volume. | |
var soundFileLengthInSamples = BufDur.ir(soundFile); // length of file in samples | |
var randomSpreadSize = randomPosSpread / soundFileLengthInSamples ; // translates randomSpread into a | |
var triggerSignal = Impulse.ar(1 / triggerGrainEvery); | |
var pos = EnvGen.ar( Env([0, goTo], [goIn/1000], \lin), t_ramp ) + TRand.ar(0.0, randomSpreadSize, triggerSignal ); | |
var signal = GrainBuf.ar(1, | |
triggerSignal, // trigger rate | |
grainLength, // grainLength | |
soundFile, | |
speed, // or speed | |
pos, // where to start playing | |
4); | |
Out.ar( out, signal * vol); | |
}).store(); | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment