I’m still getting my head around sonic pi, have just run through the tutorials. So perhaps there’s a different approach to this I haven’t thought of/come across yet. Or perhaps there is a solution…
Here are 3 questions stemming from the same issue:
- Is it possible to have new values “applied” to a live loop (eg, say I want to change the playback rate of a loop sample), without having to press the ‘run’ button? (some kind of live variable memory space even?)
- Alternatively is it possible to ‘quantise’ the run button (say, so that the run button will only trigger on the beginning of every 4th bar from the beginning of my session)
- Alternatively is it possible to control the “run” button with OSC or call it from within the code itself?
An example is as follows::
I have a 1 bar sample playing once every loop.
I alter the rate of the sample (and the corresponding sleep sample_duration rate) to be say 2. meaning it’s now a 1/2 bar loop.
Then I want to change back to a rate of 1, but I only want it to happen if the time from beginning of ‘song’ is a multiple of whole bars (to maintain the timing of the entire ‘song’).
1 bar + 1 bar + 1 bar + 1 bar = 4 bars, a nice musical number for 4/4 music.
1 bar + 1 bar + 1/2 bar + 1/2 bar + 1 bar = 4 bars. nice again.
1 bar + 1 bar + 1/2 bar + 1 bar = 3.5 bars. Not so nice.
Also ideally I want to operate the entire system without having to refer back to the mouse UI (using OSC messages preferably) and so having to go and ‘click’ run with my mouse is kind of blocking what I’d like to achieve.