-
-
Save furenku/c3f7043d1af82fbd281d29f60358ca46 to your computer and use it in GitHub Desktop.
Wait based sequencing
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
var index = 0; | |
var totalPatternTime = 0; | |
var testSynth; | |
var events=[ | |
( | |
value: 0, | |
time: 0 | |
), | |
( | |
value: 1, | |
time: 1/4 | |
), | |
( | |
value: 2, | |
time: 1/2 | |
), | |
( | |
value: 3, | |
time: 1/8 | |
), | |
( | |
value: 4, | |
time: 1 | |
), | |
( | |
value: 5, | |
time: 2 | |
), | |
( | |
value: 6, | |
time: 1/4 | |
), | |
]; | |
Tdef(\seqTest, { | |
inf.do { | |
var current; | |
var next; | |
var nextIndex; | |
var currentValue; | |
index = index + 1; | |
index = index % events.size; | |
("current event index: "++index).postln; | |
nextIndex = index + 1; | |
nextIndex = nextIndex % events.size; | |
next = events[nextIndex]; | |
current = events[index]; | |
currentValue = current['value']; | |
if( testSynth.isKindOf(Synth) ) { | |
testSynth.free; | |
}; | |
testSynth = Synth('default', [ | |
\freq, (60 + currentValue).midicps | |
]); | |
totalPatternTime = totalPatternTime + next.time; | |
if( index == 0 ) { | |
totalPatternTime = 0; | |
}; | |
("totalPatternTime: "++(totalPatternTime)).postln; | |
next.time.wait; | |
} | |
}).play; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment