Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 new ThresholdGate and make it the default gate #35
add new ThresholdGate and make it the default gate #35
Changes from all commits
57316e6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
afseq
Overview
afseq, aka NerdoRhythm, is an experimental, dynamic, imperative and functional music sequence generator for Rust and Lua.
It allows you to create music sequences either in plain Rust (static, precompiled) or in Lua (dynamic, real-time). In addition to a custom imperative event generator via the rhythm config, it also supports creating events using the Tidal Cycles mini-notation via the cycle function.
afseq is part of the afplay crates.
This part of the afplay crates deals only with raw musical event generation. It does not generate audio. See the
examples
folder for how to combine a simple playback engine usingafplay
withafseq
to create a simple sequencer playback engine.Demo applications
See
examples/play.rs
for an example using rust only: it defines and plays a little music thing. The content can only be changed at compile time.See
examples/play-script.rs
for an example using the Lua API: it also defines and plays a little music thing, but its contents can be added/removed and changed on the fly to do music live coding.Components
A Rhythm is composed of 3 units in afseq:
By separating the rhythmic from the tonal (or parameter value) part of a musical sequence, each part of the sequence can be freely modified, composed and (re)combined.
We're basically treating music in two dimensions here: the rhythmic part as one dimension, and the tonal part as another.
However, it's also possible to use just the emitter part of afseq, writing both parts in one dimension only. This can be done by using a simple never ending 1-valued train pulse as the input pattern, which defines the time grid for the emitter.
TimeBase
The TimeBase represents the unit of time for the rhythm, either in musical beats or wall-clock time (seconds, ms). It defines the unit and duration of a step in the sequence.
The default time unit of rhythm is one beat.
Pattern
A Pattern is a sequence of pulses that defines the musical sequence's rhythm. It consists of a list of pulses with possible subdivisions, an optional number of repeats and an optional time offset. A pattern can generate pulses using a specific algorithm, such as a Euclidean rhythm or using a fixed, predefined pattern, or by using a dynamic generator - a function.
The default pattern of a rhythm is a never ending pulse train of 1's.
Gate
A Gate is a filter that determines whether or not an event should be emitted based on a pulse value. The gate can be used to filter out pulse events or to add randomness to the rhythm. A gate can be a predefined gate from the library or a dynamic filter - a function.
The default gate in a rhythm is a probability gate, which passes 1 and 0 events as they are, and values in between (0 - 1) with a probability.
The default gate in a rhythm is a threshold gate, which passes all pulse values > 0.
Emitter
An Emitter is an iterator that generates events for each pulse value. It can be made up of a fixed list of events, tidal cycles, or it can be a dynamic generator - a function.
The default emitter spits out middle C note values for each pulse.
Examples
Rust
The rust API uses Fluent interfaces to build rhythms.
Lua in Rust
The Lua API uses configuration tables.
Lua
The Lua API also contains various tools to ease creating patterns.
... and tools to ease working with chords and scales:
Patterns and emitters can be Lua functions to create dynamic contents:
See example scripts folder and Lua API definitions for more info and examples.
License
afseq is distributed under the terms of the GNU Affero General Public License V3