Checking current time


Hi all,

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?

Thanks for any help!!


Hi there,

nice question. You can always access time with:

You can then convert that to a number to use as a random seed with:

Hope that this helps :slight_smile: