A voice rendered block by block, changeable between blocks.
live = Live.start(voice, 44_100)
{pcm, live} = Live.advance(live, 512)
live = Live.control(live, freq: 660.0)
{more, live} = Live.advance(live, 512)
Summary
Functions
The next frames frames of mono PCM, and the voice advanced past them.
The next frames frames panned for channels channels, and the voice advanced past them.
The pan is read once per block.
Change the voice from the next block on.
Whether the voice has finished sounding.
Stop a voice early, falling to silence over seconds from the level it has reached.
How many frames are left before it finishes.
Begin sounding a voice at rate samples per second.
Types
@type t() :: %TuningFork.Voice.Live{ frames: pos_integer(), index: non_neg_integer(), mod: map(), rate: pos_integer(), state: tuple(), voice: TuningFork.Voice.t() }
Functions
@spec advance(t(), pos_integer()) :: {binary(), t()}
The next frames frames of mono PCM, and the voice advanced past them.
Short at the end: a voice with 100 frames left asked for 512 gives 100. A voice already finished gives an empty binary.
@spec advance(t(), pos_integer(), pos_integer()) :: {binary(), t()}
The next frames frames panned for channels channels, and the voice advanced past them.
The pan is read once per block.
Change the voice from the next block on.
changes are TuningFork.Voice's fields, as a keyword list or a map; an unknown key
raises KeyError. Phase, filter state, noise seed and the note's length are untouched.
Whether the voice has finished sounding.
Stop a voice early, falling to silence over seconds from the level it has reached.
The returned voice has a length of seconds and starts at frame zero; its curves are held
at the values they had reached and :sweep is 1.0.
@spec remaining(t()) :: non_neg_integer()
How many frames are left before it finishes.
@spec start(TuningFork.Voice.t(), pos_integer()) :: t()
Begin sounding a voice at rate samples per second.
The note's length is fixed here from the voice's envelope; only release/2 changes it
afterwards.