play
Play audio files from the command line
TLDR
Play the given audio file
Play the given audio files
Play the given audio at twice the speed
Play the given audio in reverse
SYNOPSIS
play [options] audiofile [effects]
Examples:
play myfile.mp3
play -r 48k podcast.ogg vol 0.5
play sound.wav speed 1.2 reverb
PARAMETERS
-d or --device
Specifies the audio output device to use (e.g., alsa, pulseaudio, or a specific device name).
-q or --quiet
Suppresses all progress and informational output to the console.
-v or --verbose
Increases the verbosity level, showing more detailed information about the audio processing.
-r or --rate rate
Specifies the sample rate in Hz for the input or output audio.
-c or --channels count
Specifies the number of audio channels (e.g., 1 for mono, 2 for stereo).
-t or --type type
Forces the file type of the input audio (e.g., wav, mp3, flac). Useful when the file extension is missing or incorrect.
--no-show-progress
Disables the progress bar display during playback.
DESCRIPTION
The play command is a versatile utility used for playing audio files directly from the command line. It is part of the SoX (Sound eXchange) suite of tools, often referred to as "the Swiss Army knife of sound processing programs." play leverages SoX's powerful audio processing capabilities, allowing users not only to play various audio formats (e.g., WAV, MP3, FLAC, Ogg Vorbis) but also to apply real-time audio effects during playback. This makes it more than just a simple player; it can be used for quick audio checks, testing audio setups, or even for rudimentary sound analysis and manipulation on the fly. Its command-line nature makes it ideal for scripting and integration into automated workflows, as well as for users who prefer a minimalist interface without graphical overhead.
CAVEATS
The play command is typically a symbolic link or wrapper for the sox command; thus, sox must be installed on your system. Its functionality heavily relies on the underlying audio system (e.g., ALSA, PulseAudio, OSS). Issues with these audio backends or device configurations can prevent play from functioning correctly. While it supports many formats, some proprietary or less common formats might require additional libraries. Applying complex audio effects in real-time can be CPU-intensive.
SUPPORTED AUDIO FORMATS
play supports a vast array of audio file formats, including but not limited to WAV, MP3, FLAC, Ogg Vorbis, AIFF, AU, and raw audio data. The specific formats supported depend on the SoX compilation and installed libraries.
REAL-TIME AUDIO EFFECTS
One of play's powerful features is its ability to apply various audio effects in real-time during playback. These effects include volume adjustment (vol), speed change (speed), trimming (trim), reversing (reverse), normalization (norm), equalization (equalizer), and many more, making it a flexible tool for audio manipulation and analysis.
HISTORY
The play command is an integral part of the SoX (Sound eXchange) project, which originated in 1991 by Lance Norskog. SoX was designed to be a cross-platform command-line utility for manipulating various audio file formats. play specifically emerged as a convenient wrapper or direct invocation of SoX with the default output device, simplifying the common task of playing audio files without needing to explicitly specify conversion or output destinations. Over decades, SoX and consequently play have undergone continuous development, adapting to new audio formats, output devices, and incorporating a vast array of audio effects and processing capabilities, solidifying its position as a robust and essential tool in the Linux audio ecosystem.