tidalcycles / strudel

Web-based environment for live coding algorithmic patterns, incorporating a faithful port of TidalCycles to JavaScript
https://strudel.cc/
GNU Affero General Public License v3.0
677 stars 119 forks source link

cycle oriented delay time #1051

Open felixroos opened 7 months ago

felixroos commented 7 months ago

instead of seconds, there could be a delay control that uses cycles as a unit. maybe delay could be reused with a special suffix, like delay('.25c'), which would also allow one to keep using combo notation delay(".5:.25c:.9").

felixroos commented 7 months ago

naturally, this leads to a more general design where c could be used on any other seconds based control like envelopes

yaxu commented 7 months ago

How could "0.25c".mul(2) do the expected?

felixroos commented 7 months ago

How could "0.25c".mul(2) do the expected?

i'd say that should return "0.5c" . so _c would be an artificial number type, similar to how hex numbers are prefixed with 0x

yaxu commented 7 months ago

So mul would take care to do the multiplication while preserving the suffix? Or would something parse it into an object like {value: 0.25, _type: cycle}?

I guess ideally "0.25c".fmap(x => x*2) would work too.