Skip to content
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

Execute separate lines, blocks or sections #82

Open
tmhglnd opened this issue Sep 27, 2022 · 2 comments
Open

Execute separate lines, blocks or sections #82

tmhglnd opened this issue Sep 27, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@tmhglnd
Copy link
Owner

tmhglnd commented Sep 27, 2022

Many other live coding languages allow for per-block or per-line execution of code. Maybe this is something to look into to help create different sections in a performances/piece that can executed separately. For example use a part or section keyword:

part start
  new sample kick_909 time(1/4)
  new sample hat_909 time(1/8)
part end

Or maybe simplified with parenthesis or curly brackets

{
  new sample kick_909 time(1/4)
  new sample hat_909 time(1/8)
}
@tmhglnd tmhglnd added the enhancement New feature or request label Sep 27, 2022
@tmhglnd
Copy link
Owner Author

tmhglnd commented Sep 27, 2022

In the browser version this is in an experimental working state with the shortkey shift-alt-enter and only executes grouped code that has no empty lines between it. e.g.:

// execute the block below by placing the cursor on the line of the kick or snare and hitting shift-alt-enter
new sample kick_909 time(1/4)
new sample hat_909 time(1/8)

// the synth is not audible because it is not connected with the top code because of the empty line
new synth saw note(0 1) shape(-1)

@tmhglnd
Copy link
Owner Author

tmhglnd commented Jan 7, 2024

An other idea to work with sections could be to include a new function called playbar() (or bar or something alike). This would allow instruments to mute/unmute for specific bars without having to create a new rhythm appended with 0's and without being restricted by the time() function. The bar length would be determined by the signature setting. Or maybe as an argument in the function. For example:

set signature 4/4

// these two instruments would alternate playing every bar
new synth sine note(0 2) time(1/16) play(euclid(11 5)) bar([1 0])
new sample hat_808 time(1/8) bar([0 1])

// this instrument would play 2 bars and 1 bar silent, but the bar length is set to 7/8 instead of 4/4
new sample snare_808 time(3/16) bar([1 1 0] 7/8)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant