Documentation ¶
Overview ¶
Package nativeaudio leverages native decoders for each supported OS to decode raw PCM data.
Where there are native APIs to call we default to invoking ffmpeg.
Windows: Media Foundation macOS: ffmepg (pending native bindings) Linux: ffmpeg
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FFmpegPlay ¶
FFmpegPlay an audio file with ffplay.
ffplay -vn <path> -nodisp -autoexit
-vn: no video, -nodisp: do not launch graphical window, -autoexit: exit the process after playback is complete.
Types ¶
type Format ¶
type Format struct { SampleRate int // samples per second. Channels int // number channels. BitDepth int // bytes per sample. }
Format describes the features of the associated PCM data necessary for correct playback.
func Decode ¶
Decode compressed data, returning the uncompressed data as PCM data (s16le) and details about the PCM required to playback correctly.
func FFmpegDecode ¶
FFmpegDecode raw PCM with ffmpeg.
ffmpeg -f m4a -i pipe: -f s16le -
s16le is the PCM format specifier, the final dash means "pipe to stdout".
NOTE(jfm): unfortunately, some formats cannot be piped, so we will create a temporary file instead.
func FFmpegLoad ¶
FFmpegLoad raw PCM with ffmpeg.
ffmpeg -i <path> -f s16le -
s16le is the PCM format specifier, the final dash means "pipe to stdout".