Mx.Pass (mx v0.1.0)

Copy Markdown View Source

Runs one pass of a loop and returns what it played, with each note's beat within the pass.

Random numbers are seeded from the loop name and the pass number, so the same pass always plays the same notes. Inputs and shared values come from the snapshot given in :inputs, and trigger from :trigger, so a pass given the same ones plays the same notes too.

record_play and record_sample return a handle naming the events they recorded, and effect a handle naming one of the loop's effects. A control step is recorded as {beat, {:control, target, synth}, opts}, where the target is {:sounds, indexes} or {:effect, index}, and the synth is the one whose options it changes, or {:effect, effect} for an effect's.

Summary

Functions

Refuses a change to a sound of a synth, or with {:effect, effect} to an effect, that it cannot take.

Whether notes with these options would play on a synth with these defaults, as :ok or {:error, message}, checked as a play step checks them.

A handle to one of the loop's effects, refusing an effect the loop does not have.

Runs a pass of a loop, and returns {:ok, %{events: events, beats: beats}} or {:error, message} naming the line.

Every input and shared value in the pass's snapshot.

Runs the function for each entry at its beat from the current beat, in the order of the beats, and leaves the current beat where it was.

Records a control step that changes every sound of the loop still playing.

Records a control step that changes the sounds or effect a handle names, refusing an option they do not take.

Records a MIDI note at the current beat, refusing an option or value MIDI does not take.

Records a MIDI controller change at the current beat, refusing an option or value MIDI does not take.

Records an OSC message at the current beat, refusing it when the song names no osc_to.

Records the notes of a play step at the current beat, and returns a handle to them.

Records a sample step at the current beat, and returns a handle to it.

Records a step that shares a value with the other loops.

Moves the current beat forward.

The input that started the pass, or nil.

Functions

check_change(synth, opts)

Refuses a change to a sound of a synth, or with {:effect, effect} to an effect, that it cannot take.

check_play(synth, defaults, notes, opts)

Whether notes with these options would play on a synth with these defaults, as :ok or {:error, message}, checked as a play step checks them.

effect(effect)

A handle to one of the loop's effects, refusing an effect the loop does not have.

events(loop, pass, opts \\ [])

Runs a pass of a loop, and returns {:ok, %{events: events, beats: beats}} or {:error, message} naming the line.

inputs()

Every input and shared value in the pass's snapshot.

record_at(entries, fun)

Runs the function for each entry at its beat from the current beat, in the order of the beats, and leaves the current beat where it was.

record_change(opts)

Records a control step that changes every sound of the loop still playing.

record_control(other, opts)

Records a control step that changes the sounds or effect a handle names, refusing an option they do not take.

record_midi(note, opts)

Records a MIDI note at the current beat, refusing an option or value MIDI does not take.

record_midi_cc(number, value, opts)

Records a MIDI controller change at the current beat, refusing an option or value MIDI does not take.

record_osc(address, args)

Records an OSC message at the current beat, refusing it when the song names no osc_to.

record_play(opts, opts)

Records the notes of a play step at the current beat, and returns a handle to them.

record_sample(ref, opts)

Records a sample step at the current beat, and returns a handle to it.

record_set(name, value)

Records a step that shares a value with the other loops.

record_wait(beats)

Moves the current beat forward.

trigger()

The input that started the pass, or nil.