Mono PCM a stage sounds under a key: read a chunk at a time, and faded to silence when let go.
clip = Clip.new(mono)
{chunk, clip} = Clip.take(clip, 512)
clip = Clip.release(clip, 441)
Summary
Functions
A clip of signed 16-bit little-endian mono pcm.
Let the clip fall silent over frames frames from the level it has reached; a clip
already falling starts the new fall from where it is.
The next frames frames and the clip after them, or :done in place of the clip once
its PCM or its fade has run out. Short at the end.
Types
@type t() :: %TuningFork.Stage.Clip{ fade: nil | {float(), pos_integer(), non_neg_integer()}, pcm: binary() }
Functions
A clip of signed 16-bit little-endian mono pcm.
@spec release(t(), pos_integer()) :: t()
Let the clip fall silent over frames frames from the level it has reached; a clip
already falling starts the new fall from where it is.
@spec take(t(), pos_integer()) :: {binary(), t() | :done}
The next frames frames and the clip after them, or :done in place of the clip once
its PCM or its fade has run out. Short at the end.
iex> {chunk, :done} = TuningFork.Stage.Clip.take(TuningFork.Stage.Clip.new(<<1, 0, 2, 0>>), 8)
iex> chunk
<<1, 0, 2, 0>>