TuningFork.Sample.Decode (TuningFork v0.1.11)

Copy Markdown View Source

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")

Summary

Functions

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

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.

Functions

converter()

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

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

to_wav(path)

@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.