# `TuningFork.Sink.Speaker`
[🔗](https://github.com/jaman/tuning_fork/blob/v0.1.11/tuning_fork_speaker/lib/tuning_fork/sink/speaker.ex#L1)

A `TuningFork.Sink` that plays through the machine's audio device.

    {:ok, stage} = TuningFork.Stage.start_link(sink: TuningFork.Sink.Speaker, chunk: 256)

# `available?`

```elixir
@spec available?() :: boolean()
```

Whether this machine can play sound.

# `open`

Open the device. Returns `{:ok, state}` or `{:error, :unavailable}` when this machine has
no audio device.

Options:

  * `:rate` — samples per second, default 44100
  * `:channels` — default 2; `TuningFork.Stage` passes its own
  * `:lead` — frames kept queued ahead of playback, default 512
  * `:buffer` — ring size in frames, default 4096; must be larger than `:lead`

# `queued`

```elixir
@spec queued(map()) :: non_neg_integer()
```

Frames currently queued for playback.

# `write`

Queue PCM for playback. Blocks until no more than `:lead` frames are queued before adding
more, then writes all of `pcm`. Returns `:ok` or `{:error, reason}`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
