# TuningFork v0.1.0 - Table of Contents

> Sound synthesised on the BEAM: voices, scores, live patterns and loops, pure Elixir.

## Pages

- [TuningFork](readme.md)
- [TuningFork design](design.md)
- [Changelog](changelog.md)

## Modules

- [TuningFork.Pattern.Voicing.Ireal](TuningFork.Pattern.Voicing.Ireal.md): The `ireal` and `ireal-ext` chord voicing dictionaries: chord symbol to voicings as interval names.
- [TuningFork.Sink.Collect](TuningFork.Sink.Collect.md): A sink that sends everything written to a process as `{:pcm, binary}`.

- [TuningFork.Sink.Pulse](TuningFork.Sink.Pulse.md): A sink that plays through a PulseAudio or PipeWire server by piping PCM into `pacat`.
- [TuningFork.SonicPi.Handle](TuningFork.SonicPi.Handle.md): A sounding note or an open effect, for `TuningFork.SonicPi.control/2`.
- [TuningFork.Source](TuningFork.Source.md): Evaluating typed source without diagnostics on standard error, and trimming error messages.

- [TuningFork.Stage.Bed](TuningFork.Stage.Bed.md): The looping layers under a `TuningFork.Stage`: named PCM buffers read from one
playhead, each at its own gain, replaceable at a bar boundary with a cross-fade.

- Writing
  - [TuningFork](TuningFork.md): Sound synthesised on the BEAM: play a `TuningFork.Voice` on a `TuningFork.Stage`.
  - [TuningFork.Chord](TuningFork.Chord.md): Chord names to the MIDI notes that play them.
  - [TuningFork.Notes](TuningFork.Notes.md): Pitches, scales and chords by note name, such as `:a4`, `:fs3` or `:eb5`.
  - [TuningFork.Part](TuningFork.Part.md): One line of music, written by moving a cursor measured in beats.
  - [TuningFork.Part.Source](TuningFork.Part.Source.md): Reads a block of loop source into a score.
  - [TuningFork.Ring](TuningFork.Ring.md): A list read round and round, so any integer index is in it.
  - [TuningFork.Scale](TuningFork.Scale.md): Named scales, and the MIDI notes their degrees stand for.
  - [TuningFork.Score](TuningFork.Score.md): Notes on a beat grid with a tempo map, rendered to one buffer that loops without a break.

- Patterns
  - [TuningFork.Pattern](TuningFork.Pattern.md): Patterns of events over cycles, queried by span.
  - [TuningFork.Pattern.Control](TuningFork.Pattern.Control.md): Patterns of control maps, built as a chain of setters that `TuningFork.Kit` turns into voices.
  - [TuningFork.Pattern.Mini](TuningFork.Pattern.Mini.md): Mini-notation strings parsed into a `TuningFork.Pattern`.
  - [TuningFork.Pattern.Player](TuningFork.Pattern.Player.md): Walks a pattern in time, rendering the events that come due to PCM block by block.
  - [TuningFork.Pattern.Source](TuningFork.Pattern.Source.md): Turns a typed line of mini-notation or Elixir into a pattern.
  - [TuningFork.Pattern.Voicing](TuningFork.Pattern.Voicing.md): Chord symbols to voicings, as Strudel renders them.
  - [TuningFork.Session](TuningFork.Session.md): Rows of live-coded source, and the one pattern they add up to.
  - [TuningFork.Session.View](TuningFork.Session.View.md): What a live-coding front end draws for a session row, as numbers rather than pictures.
  - [TuningFork.Strudel](TuningFork.Strudel.md): Reads a Strudel piece — the JavaScript as written at strudel.cc — into the pattern chains
this library plays.

- Sonic Pi
  - [TuningFork.SonicPi](TuningFork.SonicPi.md): Sonic Pi's vocabulary: `play`, `sleep`, `sample`, `live_loop`, `with_fx` and the rest.
  - [TuningFork.SonicPi.Blocks](TuningFork.SonicPi.Blocks.md): The words of `TuningFork.SonicPi` that take a block, as functions taking a `fn`.
  - [TuningFork.SonicPi.Buffer](TuningFork.SonicPi.Buffer.md): What `TuningFork.SonicPi.run/1` reads out of a buffer of source.
  - [TuningFork.SonicPi.Current](TuningFork.SonicPi.Current.md): The `TuningFork.SonicPi.Thread` the calling process is running.
  - [TuningFork.SonicPi.Effects](TuningFork.SonicPi.Effects.md): Sonic Pi's effects as the `TuningFork.Fx` effects that play them.
  - [TuningFork.SonicPi.Names](TuningFork.SonicPi.Names.md): Notes, chords and scales by Sonic Pi's names, as MIDI numbers.
  - [TuningFork.SonicPi.Synth](TuningFork.SonicPi.Synth.md): Sonic Pi's synths as `TuningFork.Voice`s.
  - [TuningFork.SonicPi.Thread](TuningFork.SonicPi.Thread.md): What one Sonic Pi thread carries while its code runs, and the score it played.

- Sound
  - [TuningFork.Curve](TuningFork.Curve.md): A multiplier that moves over the length of a note, as `{progress, value}` breakpoints.
  - [TuningFork.Envelope](TuningFork.Envelope.md): An attack-decay-sustain-release shape in seconds, sampled by time.
  - [TuningFork.Filter](TuningFork.Filter.md): A resonant filter, cut off at a frequency in hertz.
  - [TuningFork.Fx](TuningFork.Fx.md): Effects applied to a whole buffer of rendered audio.
  - [TuningFork.Fx.Live](TuningFork.Fx.Live.md): Effects on a stream, a block at a time, carrying their state between blocks.
  - [TuningFork.Gm](TuningFork.Gm.md): Voices for General MIDI's instrument and drum numbers.
  - [TuningFork.Gm.Fonts](TuningFork.Gm.Fonts.md): The soundfont files Strudel plays each `gm_*` name from, in the order `n` picks them.
  - [TuningFork.Gm.Names](TuningFork.Gm.Names.md): Strudel's `gm_*` instrument names and the General MIDI programs they stand for.
  - [TuningFork.Kit](TuningFork.Kit.md): Names to voices: `voice/2` turns a drum name, a note name, a MIDI number, hertz or a map of
controls into a `TuningFork.Voice`.
  - [TuningFork.Mixer](TuningFork.Mixer.md): Sums signed 16-bit little-endian PCM buffers, clipping at full scale, and pans mono sound.

  - [TuningFork.Reverb](TuningFork.Reverb.md): A reverb whose state carries between calls: Freeverb, eight comb filters into four
allpasses on each channel.
  - [TuningFork.Voice](TuningFork.Voice.md): One sound described as a waveform, pitch, envelope and filter, rendered to 16-bit PCM.
  - [TuningFork.Voice.Live](TuningFork.Voice.Live.md): A voice rendered block by block, changeable between blocks.
  - [TuningFork.Wave](TuningFork.Wave.md): Oscillators, as functions from phase (0.0 to 1.0 over one cycle) to amplitude (-1.0 to 1.0).

- Recordings
  - [TuningFork.Flac](TuningFork.Flac.md): Reads FLAC into 16-bit PCM.
  - [TuningFork.Sample](TuningFork.Sample.md): Recorded audio, to be played as a `TuningFork.Voice`.
  - [TuningFork.Sample.Bank](TuningFork.Sample.Bank.md): Recordings by name, for `TuningFork.Kit` to find.
  - [TuningFork.Sample.Decode](TuningFork.Sample.Decode.md): Turns a recording in a format this library does not read itself (MP3, OGG, AAC and the
rest) into a WAV, through a converter found on the machine.
  - [TuningFork.Sample.Fetch](TuningFork.Sample.Fetch.md): Downloads a file once into the cache directory and gives its local path.
  - [TuningFork.Sample.Font](TuningFork.Sample.Font.md): Soundfont instruments as Strudel plays them: one file per instrument, a zone per key
range, each zone a recording with its root pitch and loop.
  - [TuningFork.Sample.Set](TuningFork.Sample.Set.md): A set of named recordings described by a `strudel.json`, registered with
`TuningFork.Sample.Bank`.
  - [TuningFork.Wav](TuningFork.Wav.md): 16-bit little-endian PCM wrapped in a WAV header, and read back out of one.

- Playing
  - [TuningFork.Cache](TuningFork.Cache.md): Keeps rendered audio on disk, keyed by name and fingerprint.
  - [TuningFork.Rand](TuningFork.Rand.md): Repeatable randomness from a generator value that every function returns alongside its
result.
  - [TuningFork.Sink](TuningFork.Sink.md): The behaviour of an output for mixed samples: opened once, written to in chunks, closed.

  - [TuningFork.Sink.Buffer](TuningFork.Sink.Buffer.md): A sink that keeps everything written in a caller-owned process, for recording a stage.
  - [TuningFork.Sink.Silent](TuningFork.Sink.Silent.md): A sink that discards everything written to it.

  - [TuningFork.Stage](TuningFork.Stage.md): A process that mixes sounding voices, loops, patterns and scores into one stream and
writes it to a `TuningFork.Sink`.
  - [TuningFork.State](TuningFork.State.md): Values one loop leaves for another, read as they stood at the reader's own time.
  - [TuningFork.Store](TuningFork.Store.md): The ETS tables holding `TuningFork.Tick` counters and time-stamped `TuningFork.State` values.

  - [TuningFork.Tick](TuningFork.Tick.md): Counters that step once each time a loop comes round.
  - [TuningFork.Transport](TuningFork.Transport.md): Walks a score in time, a block at a time, handing out the notes that have come due.

- MIDI and OSC
  - [TuningFork.Midi](TuningFork.Midi.md): Reads a Standard MIDI File, and turns one into a `TuningFork.Score`.
  - [TuningFork.Osc](TuningFork.Osc.md): Open Sound Control messages, as the bytes that go over the wire.
  - [TuningFork.Osc.Client](TuningFork.Osc.Client.md): A UDP socket for sending `TuningFork.Osc` messages, and reading them back.
  - [TuningFork.Osc.Out](TuningFork.Osc.Out.md): Plays a `TuningFork.Score` out over OSC, in time.

## Mix Tasks

- Tasks
  - [mix tuning_fork.render](Mix.Tasks.TuningFork.Render.md): Render a MIDI file to a WAV. No audio device is opened.

