class

MinAudio::Decoder

Inherits Reference < Object

Constructors

from_file(path : String, *, channels : Int32 = 0, sample_rate : Int32 = 0) : self

Decode a file from disk.

Source
from_memory(data : Bytes, *, channels : Int32 = 0, sample_rate : Int32 = 0) : self

Decode an in-memory file image (WAV/MP3/FLAC — whatever the vendored miniaudio builds decode; Vorbis is off by default).

Source

Instance methods

channels

Source channels (after the f32 conversion config).

Source
close
Source
closed?
Source
cursor_frames
Source
finalize
Source
length_frames

Total frames (a frame = one sample per channel). 0 when unknown (streams). For MP3 this decodes the whole file — do not call it in a hot loop.

Source
read(frame_count : Int) : Bytes

Read up to frame_count frames as interleaved Float32 samples (frame_count * channels * 4 bytes). Shorter than requested means end of data; empty means done.

Source
read_all

Read every remaining frame (see #length_frames for the caveats).

Source
sample_rate
Source
seek(frame_index : Int) : self
Source