-
-
Notifications
You must be signed in to change notification settings - Fork 125
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
Add binary and binaryN #1226
base: main
Are you sure you want to change the base?
Add binary and binaryN #1226
Conversation
Hey, this is my first contribution to strudel. Loving strudel and the live coding community! |
great stuff thanks :) the test is still failing, you can fix it by running |
tests now failing.. you can fix it withm pnpm snapshot i think. also it would be ace if these functions appeared in the docs, maybe here: https://strudel.cc/learn/factories/ (generated from factories.mdx) |
@felixroos I'm having trouble getting the example from signal.mjs to show in factories.mdx |
ah yes, if you change the example in the jsdoc, you need to restart the dev server (or run |
Ok got it @felixroos. I found a silly issue with my |
thanks! this looks good, i only wonder why you've decided against using fmap (similar to #670)? |
Well I did like the look of your binpatn, but I ran into a small limitation where I wasn't able to pattern the input "decimal". Maybe that's just crazy? This is why I took a different approach to make it work. Thoughts? let binpatn = (dec, len) => seq(
...dec.toString(2)
.padStart(len, '0')
.split('')
.map(Number)
)
setcpm(144/4)
// patterned `dec` causes an error
d1: binpatn("<7 8 7 9>", 8) // cannot parse as numeral: "NaN"
.add(60).note().piano()._pianoroll({ labels: true })
// d1: binaryN("<7 8 7 9>", 8) // works
// .add(60).note().piano()._pianoroll({ labels: true }) |
Create patterns from binary, such as
binary(5) -> "1 0 1"
.From tidal cycles https://userbase.tidalcycles.org/binary.html
Addresses #670