A sink that keeps everything written in a caller-owned process, for recording a stage.
{:ok, tape} = TuningFork.Sink.Buffer.start_link()
{:ok, _stage} = TuningFork.Stage.start_link(sink: TuningFork.Sink.Buffer,
sink_opts: [into: tape])
TuningFork.Sink.Buffer.wav(tape) |> then(&File.write!("take.wav", &1))
Summary
Functions
Returns a specification to start this module under a supervisor.
Throw away what has been recorded. The buffer keeps running.
How long the recording runs, in seconds.
Open the sink onto a running buffer.
Start a buffer, linked to the caller.
Stop the buffer, discarding the recording.
Everything written so far as one PCM binary, in the order it was written.
Everything written so far as a WAV, at the rate and channels the stage opened with.
Append pcm to the buffer. Does not sleep.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec clear(Agent.agent()) :: :ok
Throw away what has been recorded. The buffer keeps running.
@spec duration(Agent.agent()) :: float()
How long the recording runs, in seconds.
Open the sink onto a running buffer.
Options
:into— the buffer to write to. Required; returns{:error, :no_buffer_given}without it:rate— samples per second, default 44100. Kept forwav/1andduration/1:channels— samples per frame, default 2. Kept the same way
@spec start_link(keyword()) :: Agent.on_start()
Start a buffer, linked to the caller.
opts are Agent.start_link/2's options, such as :name.
@spec stop(Agent.agent()) :: :ok
Stop the buffer, discarding the recording.
@spec take(Agent.agent()) :: binary()
Everything written so far as one PCM binary, in the order it was written.
@spec wav(Agent.agent()) :: binary()
Everything written so far as a WAV, at the rate and channels the stage opened with.
Append pcm to the buffer. Does not sleep.