I’d like to have Sonic Pi play something different based on the time of day (for example, if the time is between 12am and 1pm, play loop A, between 1pm and 2 pm, play loop B, etc). Is there a way to access the current date/time in sonic pi? Or alternatively, the time since sonic pi was launched?
That is a great answer to question 1.
The second question “time since sonic pi was launched” could be resolved by saving the launchtime in a variable and substract it from current time in each loop.
But i think time is here more a question of “beats”.
And there i have no answer how to access the current “beattime”.
It is printed out in the console
{run: 1, time: 0.0}
Hi @synchron There are two options for getting the beat time of the current thread/loop - beat and vt. (You can find these described in the lang help section).
The difference between these is that beat does not have any concept of ‘rate’, while vt does.