A song loaded from a file: its tempo and its parts, each played as a loop, in the order of the song.
tempos holds the tempo changes its music writes, each section's as Mx.Tempo takes them, or nil when it writes none.
A song file is either a script that ends with Mx.song/1, or a module that uses Mx.Song:
defmodule Paredao do
@moduledoc "A kick and an 808 bass at 92 beats a minute."
use Mx.Song, tempo: 92
part :kick, synth: :kick, fx: [level: [amp: 0.6]]
part :bass, synth: :sub808
def song, do: together([part(:kick, steps("x...", 1)), part(:bass, note(:g1, 4))])
enduse Mx.Song imports Mx and takes the options of Mx.song/1 but music:, which is what the module's song/0 returns.
part/2 written in the module's body declares a part with its options, once, and written in a function it is that part playing some music, with those options.
A part that is not declared does not compile.
Summary
Functions
Checks an fx: option, an effect or a list of effects with their options, as :ok or {:error, message}.
Loads a song file, and returns {:ok, song} or {:error, message} naming the file and line.
In a module's body, declares a part with its options; in a function, that part playing music with the options it was declared with.
Records a live audio input of the song being loaded.
Records a part of the song being loaded as a loop that replays its music, ending after a number of passes, or never with nil.
Records the port the song being loaded takes OSC from.
Records where the song being loaded sends OSC.
Records a sample the song being loaded plays, and whether it plays normalized, so a silent or quiet file is named once it has loaded.
Records the tempo of the song being loaded.
Records the tempo changes the music of the song being loaded writes.
Functions
Checks an fx: option, an effect or a list of effects with their options, as :ok or {:error, message}.
Loads a song file, and returns {:ok, song} or {:error, message} naming the file and line.
In a module's body, declares a part with its options; in a function, that part playing music with the options it was declared with.
Records a live audio input of the song being loaded.
Records a part of the song being loaded as a loop that replays its music, ending after a number of passes, or never with nil.
Records the port the song being loaded takes OSC from.
Records where the song being loaded sends OSC.
Records a sample the song being loaded plays, and whether it plays normalized, so a silent or quiet file is named once it has loaded.
Records the tempo of the song being loaded.
Records the tempo changes the music of the song being loaded writes.