# `TuningFork.Sample.Decode`
[🔗](https://github.com/jaman/tuning_fork/blob/v0.1.11/tuning_fork/lib/tuning_fork/sample/decode.ex#L1)

Turns a recording in a format this library does not read itself (MP3, OGG, AAC and the
rest) into a WAV, through a converter found on the machine.

    {:ok, wav} = TuningFork.Sample.Decode.to_wav("piano/C4v8.mp3")

# `converter`

```elixir
@spec converter() :: :afconvert | :ffmpeg | nil
```

The converter this machine has: `:afconvert`, `:ffmpeg` or `nil`.

# `to_wav`

```elixir
@spec to_wav(Path.t()) :: {:ok, Path.t()} | {:error, term()}
```

The path of a WAV holding `path`'s audio: `path` itself for a WAV or FLAC, otherwise a
16-bit WAV converted once into `TuningFork.Sample.Fetch.dir/0`. `{:error, :no_decoder}`
when no converter is installed, `{:error, {:decode_failed, output}}` when it fails.

---

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