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

[Breaking] Introducing conditional patterns and other parser fixes #145

Merged
merged 18 commits into from
Dec 30, 2022

Conversation

Bubobubobubobubo
Copy link
Owner

This pull request is focusing on the addition of new features to the basic parser. This PR will break previous polyphonic user code and might as well break other things. Updating code should however be fairly trivial just by substituting the polyphonic symbols.

  • Functions can now take arguments and keyword arguments. Arguments and keyword arguments are handled in the exact same way as Python. However, confusion can arise if a user forgets that a given function is valid only on the pattern side. Special syntax highlighting could surely help with this!
  • Conditional function application: A special do= keyword argument, valid on any function, can be tested with a boolean condition to determine if the function will be applied or not. Booleans are denoted with either 1 or 0 and any parsed expression yielding 1 or 0 is valid.
  • Chords are now denoted using the {} syntax. > and < are now used for testing numbers (greater or lower) as well as <= and >=.
  • New condition functions have been added to the function library:
    • beat(x, ...): give a beat or list of beats and return True if we are currently on that beat.
    • every(x, ...): variant using measure number (similar to TidalCycles).
  • Classic conditions, based on the previous mechanism:
    • if(condition, patternA, patternB) : if the condition is True, play pattern A. Otherwise, play pattern B.
    • while(condition, patternA): while the condition is True, do something. Otherwise, do nothing!
    • not(condition, pattern): do something only when the condition is not True.
  • minor change to the front page of the website (changing some words here and there).
  • Fixing a bug with 10000~5000 crashing the parser.
  • Fixing a bug with the mask function.
  • Fixing the euclid() algorithm not working on patterns of length < steps.
  • Probably some other things that I forgot...

All of this is rather experimental. Users can ignore it for the most part if they don't play much with functions. However, it can be particularly helpful to add interesting mutations in surfboards patterns. I hope that this will be further refined to be really stable and usable!

Previously, the euclidian rhythm function for use in the mininotation
was completely bugged. It required that the input pattern length was at
least as large as the number of steps in the pattern. This is no longer
the case. The initial pattern will be extended to fit the number of
steps we want to map the euclidian rhythm over.

I've also included a new alias for the euclid() idiom: eu().
These functions are directly taken from TidalCycles. The "sometimes"
family is a family of probability functions called "always",
"almostAlways", etc... up to "never" determining the probability for an
event to hit.
The 'r' token is now simply 'rand'. This is longer, but it was
interfering with people using one letter samples!
This is a mockup of a new functionality allowing function calls in the
pattern language with support for keyword arguments. There is also a
special cond= argument allowing to apply the function only if a certain
condition is met!
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.

1 participant