Once or asap in Strudel

Hi everyone, is there a Strudel function equivalent to Tidal Cycles' "once" or "asap" that allows instructions to be executed just once?

1 Like

A very late reply! So far there isn’t, but now that the strudel ‘warm’ beta version (https://warm.strudel.cc) has tidal-style block-based evaluation (turn it on in the settings to try it out), it would be easier to implement I think.. So hopefully soon.

1 Like

what I see myself doing from time to time when I want to do some intro (not livecoding, but arrangements)

$: s("ballwhistle").when(time.gte(1),x=>x.mask(0))
$: s("bd sd bd <oh hh>").when(time.lt(1),x=>x.mask(0)).late(1)

The late makes sure your non-intro patterns (re)start at time = 1. You don’t need that if you work with pickRestart

Switch angel’s prebake has the following function in it that might be what you’re looking for:

/* Plays a sound once (when the REPL is updated) but locked to a provided grid/quantize

So doing

s("downlifter").oneshot(4)

will play it, but only at the next 4-divisible cycle (t = 0, 4, 8, etc)
Useful for locking it into relevant parts of the arrangement

*/
register('oneshot', (grid, pat) => {
const t = getTime();
const qt = Math.ceil(t / grid) * grid;
return pat.filterWhen((t) => t >= qt && t < qt + 1);
});
1 Like

is the general idea of “once”, that it always plays the first event, or is it based on the time, that it uses the next event at the current time?