# `TuningFork.Flac`
[🔗](https://github.com/jaman/tuning_fork/blob/v0.1.11/tuning_fork/lib/tuning_fork/flac.ex#L1)

Reads FLAC into 16-bit PCM.

    {:ok, pcm, rate, channels} = TuningFork.Flac.decode(File.read!("bell.flac"))

# `reason`

```elixir
@type reason() :: :not_flac | :truncated | :unsupported
```

# `decode`

```elixir
@spec decode(binary()) ::
  {:ok, binary(), pos_integer(), pos_integer()} | {:error, reason()}
```

The PCM in a FLAC stream, with its rate and channel count.

Returns `{:ok, pcm, rate, channels}`, or `{:error, reason}` where the reason is
`:not_flac` for bytes that do not begin a FLAC stream, `:truncated` for a stream that ends
mid-frame, and `:unsupported` for a channel count over two.

# `info`

```elixir
@spec info(binary()) :: {:ok, map()} | {:error, reason()}
```

What a FLAC stream holds, read from its header without decoding it.

`%{rate: rate, channels: channels, bits: bits_per_sample, frames: total_frames}`, where
`frames` is `0` for a stream whose length was not written.

# `read!`

```elixir
@spec read!(Path.t()) :: {binary(), pos_integer(), pos_integer()}
```

Read a FLAC file from disk.

Gives `{pcm, rate, channels}` as `TuningFork.Wav.read!/1` does, and raises `ArgumentError`
for a file that is not FLAC or is cut short.

---

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