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

beat function for "step sequencer" style rhythm notation. (Backported from Strudel) #1109

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

geikha
Copy link
Contributor

@geikha geikha commented Jan 20, 2025

See tidalcycles/strudel#1237

Luckily the fractional implementation done by @yaxu doesn't require any special handling of polyphony, it just works!

beat :: Pattern Time -> Pattern Time -> Pattern a -> Pattern a
beat = patternify2 $ __beat innerJoin

__beat :: (Pattern (Pattern a) -> Pattern a) -> Time -> Time -> Pattern a -> Pattern a
__beat join t d p = join $ (compress (s,e) . pure) <$> p
                      where s = t' / d
                            e  = (t'+1) / d
                            t' = t `mod'` d

@geikha geikha changed the title beat function for "step sequencer" style rhythm notation. (Backported from Strudel)S beat function for "step sequencer" style rhythm notation. (Backported from Strudel) Jan 20, 2025
@sss-create
Copy link
Collaborator

Wow, this looks interesting! Can you tell me what it does? I did not quite get the hang of it in the strudel thread + I couldn’t listen to the audio

@yaxu
Copy link
Member

yaxu commented Jan 20, 2025

struct (beat "[0,5,12]" "16") $ s "bd" would trigger on the first, sixth and 13th beat of a 16 beat cycle. It's a bit weird that the beats are 'stacked' like this but makes some sense..

@geikha
Copy link
Contributor Author

geikha commented Jan 20, 2025

@yaxu i think you meant beat "[0,5,12]" "16" $ s "bd", as the function restructures the pattern already

also, i like that we can easily beat "[0,5,<12 11>]" 16 and stuff like that

@geikha
Copy link
Contributor Author

geikha commented Jan 20, 2025

if anyone wants to try this on the current version of tidal without installing anything you can just run:

__beat :: (Pattern (Pattern a) -> Pattern a) -> Time -> Time -> Pattern a -> Pattern a
__beat join t d p = join $ (compress (s,e) . pure) <$> p
                    where s = t' / d
                          e  = (t'+1) / d
                          t' = t `Data.Fixed.mod'` d
beat :: Pattern Time -> Pattern Time -> Pattern a -> Pattern a
beat = tParam2 $ __beat innerJoin

@yaxu
Copy link
Member

yaxu commented Jan 21, 2025

@yaxu i think you meant beat "[0,5,12]" "16" $ s "bd", as the function restructures the pattern already

also, i like that we can easily beat "[0,5,<12 11>]" 16 and stuff like that

Ah hmm a binary version might be more flexible, but lets park that thought for now and merge :)

@yaxu yaxu merged commit 9d0b783 into tidalcycles:dev Jan 21, 2025
19 of 23 checks passed
@geikha
Copy link
Contributor Author

geikha commented Jan 22, 2025

agreed! i was just copying the behav selected in strudel. i also thought about euclid as reference, which always takes in a pattern to "euclidize" heh
noted that if a binary version was made, i'd expect emptyness to be filled with False instead of silence, wonder if there's an easy solution for that without changing the curr implementation that much

@cleary
Copy link
Contributor

cleary commented Jan 22, 2025

I think of this like a flexible Euclidean notation - rather than evenly spreading the events over the increments you just define where you want them to fall.

Its easier than counting out the steps in binary notation too

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

Successfully merging this pull request may close these issues.

4 participants