-
-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
block based evaluation #34
Comments
somewhat related: https://extemporelang.github.io/docs/overview/using-extempore/ |
before it gets forgotten, from chat: yaxu: froos: drums: s("bd sd")
bass: note("g1 c2(3,8)")
drums: s("bd sd*2") if you press play the default behavior could be to take the first block yaxu: froos: |
this little algorithm could be used for block detection: https://codesandbox.io/s/block-detection-p8zozv?file=/src/index.js |
more fleshed out, using codemirror + adjusted flash logic + added gutter lines to show individual blocks: https://codesandbox.io/s/block-based-evaluation-codemirror-7fu5vo?file=/src/codemirror.js |
maybe just use: s("bd").p(1)
s("bd").p(2) analogous to tidal. there could also be the d functions: s("bd").d1
s("bd").d2 with global evaluation, patterns with the same number would always win when they are last. example: note("a").p(1)
note("b").p(1) here, note("a").p(1)
note("b").q(1) // <-- this line is changed automatically the note("a").q(1)
note("b").p(1) There could be additional shortcuts / ui elements to switch patterns on and off, the crucial part is just that the state that contains the info which patterns are on and off is saved to the code itself. A piece of code can then also be evaluated globally without a cursor info and it would still reflect the correct playback state. This approach might still be problematic when the code as a whole contains syntax errors (with collaborative editing the same document in mind) but maybe it's at least a step in the direction of better live codability + compatibility with tidal. |
above idea is now implemented in #805 (without code transforms) |
Think about if we should implement block based evaluation, like in mainline tidal.
Currently, the whole code is reevaluated when hitting ctrl+enter.
To make that work, some way of naming patterns needs to be found. One idea is using the rarely used javascript label statements:
If we run the fist line, and then the second, only the second should play.
To make that work, the runtime needs to store patterns in some map that stores
{ [name]: pattern }
.When a line is evaluated, the pattern map is updated.
After each evaluation all patterns in the map are stacked together and queried.
One question is when non pattern code should be evaluated? Example:
Here,
d1
referencesp
, so we need to have that evaluated too.It would make usage much more complicated if the user is expected to run the first line before the second otherwise it crashes.
The text was updated successfully, but these errors were encountered: