I’m working on writing generator functions to help me compose music. I’ve recently written a polyrhythm generator that generates a thread for each subrythm, using duration and sleep with some math to keep timing proportional. It takes two arguments; an array for polyrhythms, and an integer for # of iterations. It’s just triggering the same sample for each rhythm.
I’m thinking instead of having a sample trigger, I could generate cues in each thread, have the function return an array of cue names, and then write another function to handle voicing/sampling that uses the array to prompt user input, or take a predefined selection of samples. I was thinking I’d like sampling/voicing to be independent from the rhythm; that way I’d have the ability, to say, alternate between a snare and a kick for one rhythm, and keep another rhythm voiced to just a hi hat.
I’m wondering if maybe there’s a better way to do this, or if this would even be possible with cues – I haven’t really touched cues yet, but I was reading the tutorial last night and scavenging for ideas on github. Any ideas or suggestions are welcome!
If I follow what you’re describing it sounds reasonable. It sounds like you’re thinking of generating a thread per rhythm that would cue beats, and one or more threads sync’ed to each rhythm thread that would contribute an audio part?
Using sync and cue should work. live_loops can be sync’ed together so you might be able to take advantage of that as well. There’s probably few different ways to achieve this…
One caveat to be aware of with syncing and cues is that you can occasionally hit a quirk with how the thread scheduler manages the list of threads and have symptoms like one thread not being ready for its cue or not syncing to its parent even though they are theoretically at the same execution point in time.