LinuxCommandLibrary

soxi

Get audio file information

TLDR

Display the sound file metadata

$ soxi [path/to/file.wav]
copy

SYNOPSIS

soxi [options] <audiofile> ...

PARAMETERS

-h
    Display help message and exit.

-V[level]
    Show version information or set verbosity level.

-r
    Display the sample rate of the audio file.

-c
    Display the number of audio channels.

-s
    Display the total number of samples.

-d
    Display the duration in HH:MM:SS.frac format.

-D
    Display the duration in seconds.

-t
    Display the audio file type (format).

-a
    Display all common information (duration, sample rate, channels, etc.).

-e
    Display the encoding type (e.g., FLAC, PCM, A-law).

-b
    Display the bits per sample (bit depth).

-B
    Display the average bit-rate.

-C
    Display all available comment fields or tags.

DESCRIPTION

soxi is a powerful utility from the SoX (Sound eXchange) package, often referred to as the 'Swiss Army knife of sound processing'. Its primary function is to display detailed information about audio files without processing or playing the audio data itself. This includes crucial metadata such as duration, sample rate, number of channels, bit depth, encoding type, and various format-specific details.
It provides a quick, lightweight, and efficient way to inspect audio file properties, making it an invaluable tool for scripting, automated audio processing workflows, and rapid troubleshooting. soxi boasts extensive support for a wide array of audio file formats, offering a consistent and reliable interface for querying metadata across diverse audio types, from common formats like WAV and MP3 to more specialized ones.

CAVEATS

soxi relies on the libsox library for parsing, so its capabilities are limited to the formats and features supported by the SoX project.
Information such as average bit-rate for Variable Bit Rate (VBR) formats might be an estimation rather than an exact value.
It primarily extracts header and metadata information and does not perform a full integrity check or validate the actual audio content.

COMMON USAGE

soxi is frequently used in shell scripts for automated audio file analysis, such as sorting files by duration, verifying sample rates, or checking format compatibility before further processing. For interactive use, it offers a quick and convenient way to inspect audio properties directly from the command line before playback, conversion, or editing.

SUPPORTED FORMATS

Inheriting SoX's robust capabilities, soxi supports an extensive array of audio file formats. This includes common formats like WAV, MP3, FLAC, Ogg Vorbis, AIFF, AU, and more specialized types like GSM, raw PCM, and various ADPCM formats, making it a highly versatile tool for diverse audio workflows and collections.

HISTORY

soxi is a component of the SoX (Sound eXchange) project, which originated in the late 1980s by Lance Norskog. The project aimed to provide a comprehensive toolset for audio file manipulation across various operating systems. soxi emerged as a dedicated, lightweight utility within this suite, specifically designed to quickly query and display metadata from audio file headers without invoking the full audio processing capabilities of the main sox command. Its development has mirrored the evolution of the broader SoX project, continuously adapting to new audio formats, codecs, and metadata standards.

SEE ALSO

sox(1), play(1), rec(1), mediainfo(1)

Copied to clipboard