Skip to main content

Module audio

Module audio 

Source
Expand description

WAV, BWF, RF64 and AIFF audio, read as a table of sample frames.

The file is memory-mapped and a small chunk walker finds the format and where the samples are. Rows are frames: row i sits at data_offset + i * frame_bytes, so any window of rows is decoded from its own bytes and nothing else is touched. A table view of a 20 GB recording reads a screenful, wherever it is.

Every length the file states is checked against the file before anything is allocated or read through it, so a corrupt or hostile header is an error, never a panic or an allocation sized by the file.

The row count is arithmetic on the file’s size, which is what lets the reader grow with a file still being written (AudioSource::extend): a recorder writes a placeholder data size until it stops, so the size on disk, not the header, says how many frames there are.

Structs§

AudioHeader
What the header says: the format, where the samples are, and everything else the Info panel shows.
AudioSource
An open audio file: its header and a map of its bytes, read a window at a time.
Marker
A marker or region from a cue (with LIST adtl labels) or MARK chunk.
SignalReport
What AudioSource::signal_report measured of one channel.

Enums§

Container
The container a file is.
Sample
How one sample is stored.

Constants§

CLIP_RUN
The shortest run of samples at full scale that counts as clipping. One sample there is a loud peak; three in a row is the waveform flattened against the limit.
FRAME
The name of the frame-number column.
SECONDS
The name of the column of each frame’s time from the start, in seconds. A float rather than a Duration: it charts, compares and reads as a plain number (12.345625), where a Duration displays as mixed units.

Functions§

detail
The Audio tab: the file’s format, size and length, then its metadata (bext, iXML, LIST INFO, AIFF text) and markers, markers last.
looks_like_audio
Whether the first bytes are a WAV, RF64, BW64 or AIFF file.
read_header
Read the header of a whole file’s bytes.