Questions tagged [sox]

SoX (Sound eXchange) is a computer program for audio manipulation. Questions about interactive use of the command line tool should be asked on Super User.

Sound eXchange, abbreviated SoX, is a free cross-platform digital audio editor, licensed under the GNU General Public License.

It can read and write many audio formats, including AU, WAV, AIFF, MP3 (via an external LAME MP3 encoder), Ogg Vorbis and FLAC. Some random features :

  • Editing via concatenate, trim, pad, repeat, reverse, volume, fade, splice, normalise
  • Recording and playing audio (on many systems); playing via URL (internet file or stream)
  • Processing via chorus, flanger, echo, phaser, compressor, delay, filter (high-pass, low-pass, shelving, etc.)
  • Adjustment of speed (pitch and tempo), pitch (without tempo), tempo (without pitch), and sample-rate
  • Noise removal using frequency profiling
  • Silent passage removal
  • Multi-file merging, multi-file and multi-track mixing.
563 questions
63
votes
19 answers

check duration of audio files on the command-line

I need to check the duration of a group of audio files. Is there a simple way to do this on the unix command-line? > duration * I have the amazing SoX app which has an option called stats that generates a set of audio info including duration. I am…
ted.strauss
  • 4,119
  • 4
  • 34
  • 57
49
votes
9 answers

Get length of .wav from sox output

I need to get the length of a .wav file. Using: sox output.wav -n stat Gives: Samples read: 449718 Length (seconds): 28.107375 Scaled by: 2147483647.0 Maximum amplitude: 0.999969 Minimum amplitude: -0.999969 Midline…
joshu
  • 851
  • 2
  • 9
  • 18
48
votes
3 answers

How do you trim the audio file's end using SoX?

Using Sox, how do I shorten an audio file by 5 seconds, trimming from the end? For example, this is how to trim a file from the beginning: sox input output trim 5000 This is how to add 5 seconds of silence to the end: sox input output pad 0…
get8p
  • 709
  • 2
  • 8
  • 12
45
votes
1 answer

How do I get an audio file sample rate using sox?

I would like to get the sample-rate of a given audio file using sox. Couldn't find the commandline to do that.
Guy
  • 12,250
  • 6
  • 53
  • 70
36
votes
6 answers

sox FAIL util: Unable to load MAD decoder library (libmad) function "mad_stream_buffer"

I compiled libmad for sox. When I try to read an mp3 I get this message: sox FAIL util: Unable to load MAD decoder library (libmad) function "mad_stream_buffer". Did I compile the project incorrectly?
Anderson
  • 361
  • 1
  • 3
  • 4
33
votes
2 answers

Reducing/removing clipping in SoX when converting the sample rate

I'm using SoX to trim a set of wav files into 16kHz, 16bit, mono channel wav files (which will be subsets of one of the initial wav files). Most of the source wav files are already set to this specification, however, I just found out that some of…
cesar
  • 8,944
  • 12
  • 46
  • 59
29
votes
3 answers

How can I remove silence from an MP3 programmatically?

I have MP3 files that sometimes have silence at the end. I would like to remove this silence automatically. From what I can tell, it is "perfect" silence (0 amplitude), not background noise. The length of the content and the silence varies. I…
Benjamin Oakes
  • 12,262
  • 12
  • 65
  • 83
24
votes
1 answer

Reduce volume of audio file by percentage value using SOX

I would like to reduce the volume of an audio file by 10% (so that the new volume will be 90% of the original). How can this be done using SOX? According to the SOX manual it supports a volume option: -v, --volume FACTOR Adjust volume by a factor…
Benjen
  • 2,835
  • 5
  • 28
  • 42
24
votes
3 answers

How to batch split audio files wherever there is silence?

I am using the following command in SoX to split many large audio files at each place where there is silence longer than 0.3 seconds: sox -V3 input.wav output.wav silence 1 0.50 0.1% 1 0.3 0.1% : newfile : restart This however ends up occasionally…
Village
  • 22,513
  • 46
  • 122
  • 163
23
votes
1 answer

SoX resample and convert

I am trying to figure out how to combine two commands in SoX. My master file is 44.1 kHz. I first want to resample this file to 22 kHz and then convert it to mp3/opus/ogg. How can I do this with a single command?
sylowgreen
  • 309
  • 1
  • 3
  • 4
21
votes
3 answers

How do I convert a wav file to mp3 format using sox?

When I run sox directly from the command line as ; sox -r 8000 -c 1 I get the following error message: sox: Unknown output file format for '747a.mp3': File type 'mp3' is not known My machine is running the CentOS…
john
18
votes
1 answer

How to denoise audio with SOX?

Given a audio.wav recording with silence at both start and end for at least 1second... How to denoise with SOX ?
Hugolpz
  • 17,296
  • 26
  • 100
  • 187
18
votes
3 answers

How to use sox in windows

I am installing sox in windows, but I get an error entering the following code: sox 001.wav 001.dat in the command line. The error is: `sox is not recognized as an internal or external command, operable program or batch file.`
MSI
  • 681
  • 1
  • 7
  • 12
17
votes
2 answers

How do I reduce the play time of a voice mp3 file with sox to 75%?

How do I have to call sox to transform an 2 second audio file into being speed up so that the resulting length of the file is 1.5 seconds (75%)? Do I have to pass an argument to do pitch correction? What arguments do I have to pass that the filesize…
Christian
  • 25,249
  • 40
  • 134
  • 225
17
votes
3 answers

Trim audio files with Sox in milliseconds

Is there a way to trim the end of a file with SoX, in milliseconds, i have tried this: sox tracks\5_7.mp3 ntracks\05_7.mp3 trim 2 2.195 But, it just says End position is after expected end of audio Even though the file is actually that long. So im…
heath sargent
  • 213
  • 1
  • 3
  • 7
1
2 3
37 38