Mx.Tempo (mx v0.1.0)

Copy Markdown View Source

The tempo over a song's beats: the timeline the band plays against, and the tempo changes a song's music writes in its sections.

A timeline is a list of entries, the latest first, each {beat, microseconds, tempo}. The tempo is the beats per minute held from that beat, or {:ramp, from, to, beats}, which moves evenly in beats per minute from from to to over that many beats, and is followed by to held where it ends. A change put on the timeline replaces whatever it held from the change's beat on, so the latest change wins.

A song's changes are %{sections: sections, lengths: lengths, forever: forever}: each section's changes as {beat, bpm, over}, each section's length in beats, and whether the music repeats until mx stops. Pass n plays section n, going round again in music that repeats, and a section that plays until mx stops writes its changes in its first pass only.

Summary

Functions

The beat at a real time, in microseconds, on the timeline.

The tempo changes a song writes in a pass, as {beat, bpm, over} with beats from the start of the pass.

The tempos the timeline plays at from beat from until beat until, as text with beats counted from from, such as "100 bpm, rising to 130 bpm from beat 0 to 16".

A timeline holding one tempo from beat 0, which plays at a real time in microseconds.

The timeline with the tempo changed at a beat to bpm, at once when over is 0, or else evenly over over beats.

The tempo in beats per minute at a beat on the timeline.

The timeline over beats from 0, at 0 microseconds, with the changes of every pass up to pass put on it, and the beat pass starts on; window is the length of each pass of a section that plays until mx stops.

The real time, in microseconds, of a beat on the timeline.

Functions

beat_at(timeline, us)

The beat at a real time, in microseconds, on the timeline.

changes(arg1, pass)

The tempo changes a song writes in a pass, as {beat, bpm, over} with beats from the start of the pass.

describe(timeline, from, until)

The tempos the timeline plays at from beat from until beat until, as text with beats counted from from, such as "100 bpm, rising to 130 bpm from beat 0 to 16".

new(bpm, us \\ 0)

A timeline holding one tempo from beat 0, which plays at a real time in microseconds.

put(timeline, beat, bpm, over)

The timeline with the tempo changed at a beat to bpm, at once when over is 0, or else evenly over over beats.

tempo_at(timeline, beat)

The tempo in beats per minute at a beat on the timeline.

through(tempos, bpm, pass, window \\ 0)

The timeline over beats from 0, at 0 microseconds, with the changes of every pass up to pass put on it, and the beat pass starts on; window is the length of each pass of a section that plays until mx stops.

time_at(timeline, beat)

The real time, in microseconds, of a beat on the timeline.