Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [sox]

SoX (Sound eXchange) is a computer program for audio manipulation

Filter by
Sorted by
Tagged with
0 votes
1 answer
24 views

SOX do not want name files

Want to record a radio broadcast into separated files. receiver | sox -traw -r8k -es -b16 -c1 - -b16 -es -c1 -r48000 -t wav ~/myfolder/$(date +%H_%M_%S).wav silence 1 0.10 0.1% 1 1 0.1% : newfile : ...
Oleg M's user avatar
  • 3
2 votes
2 answers
75 views

create sine wave with sox without a gap

I am using sox for creating synth with 100ms, this is my command: /usr/bin/sox -V -r 44100 -n -b 64 -c 1 file.wav synth 0.1 sine 200 vol -2.0dB Now when I create 3 sine wave files and combine all ...
iceget's user avatar
  • 23
0 votes
0 answers
49 views

Concatenating multitrack .wav files using ffmpeg

I have 32bit .wav files with around 6 channels, segmented into chunks of 2.15GB. I want to merge the files sequentially, retaining the individual channels. I would assume something like: ffmpeg -f ...
EURSCVA MembroFoto's user avatar
0 votes
0 answers
39 views

How to create amr file from raw amr frames?

Is there a way to create AMR file from raw AMR frames with ready to use tools such as ffmpeg or sox? Let’s say I have frames in files like so 1.bin 2.bin 3.bin. Can I create AMR file from them, ...
user1685095's user avatar
0 votes
1 answer
415 views

MP3 Audio file changes -- want to preserve ID3 tags and minimize quality degredation: is FLAC the best intermediate format?

I have MP3 files on which I need to perform some audio operations, then get them back to MP3. I know every operation degrades them a little bit, so my goal is just to minimize that. I need to use both ...
GraniteStateColin's user avatar
1 vote
1 answer
980 views

SoX on Windows 11 - No default audio device configured

I've installed SoX (https://sox.sourceforge.net/) in order to be able to process microphone input via node. I'm trying the most basic settings, for example, recording from the default audio device ...
Tom Auger's user avatar
  • 1,695
0 votes
0 answers
122 views

How to solve an audio stream encoding workflow thru pipes only

I have the following workflow which is typically executed on a set of provided audio files (can be MP3 files, as assumed in this example, but also different formats): file000.mp3 file001.mp3 ... What ...
user415275's user avatar
0 votes
1 answer
67 views

Popping noise when piping audio into a vitual mic debian

I have a pipe module with the command pactl load-module module-pipe-source source_name=VirtualMic file=/tmp/virtualmic format=wav rate=44100 channels=2 I want to use SoX to play a sound file into it. ...
beefox's user avatar
  • 1
0 votes
1 answer
666 views

How to remove metadata or prevent adding comment "Processed by SoX" using sox?

If you convert using sox, it adds a comment to the metadata: $ soxi audio.wav Input File : 'audio.wav' Channels : 1 Sample Rate : 48000 Precision : 24-bit Duration : 00:00:04....
qubodup's user avatar
  • 8,924
0 votes
1 answer
182 views

Merging two WAV files together with different durations so that the end times match

I have several pairs of wav files (obtained by recovering the audio from VoIP packet captures). I'd like to merge the two files down to a single-channel WAV file, which is easy with ffmpeg or sox. ...
KenD's user avatar
  • 653
1 vote
0 answers
504 views

Delay microphone input for several seconds

Using sox, I am able to record 10 seconds of mono-channel audio input: rec -c 1 "/data/wav/${EPOCHSECONDS}.wav" trim 0 10 This works perfectly fine. However, I want the recording to contain ...
dirdi's user avatar
  • 3,267
0 votes
2 answers
1k views

How to get a random filename from a directory and using it within a command?

play ~/Music/audio0.flac repeat - A command for playing a single specific audio file on repeat. play ~/Music/${random_audio_file} repeat - A pseudo command for playing a single random audio file from ...
01AutoMonkey's user avatar
2 votes
1 answer
1k views

Using SoX in Python to Increase mp3 Bitrate

I am trying to increase the bitrate on an mp3 in an audio archiving program written in Python, that uses SoX. Here's a portion of the code: #fullHour is a boolean DeltaSeconds = chunk['...
DRT's user avatar
  • 21
0 votes
1 answer
387 views

correctly batch run chain of SoX commands step by step - issues

For all .wav files in sox-14-4-2 folder I need to remove silence at start, copy the result into an existing subfolder Output, then reverse the file, remove silence again and finally reverse again. The ...
atereou's user avatar
  • 359
2 votes
1 answer
433 views

Auto Batch Process - Trim, change bit rate and then normalize wav files via sox on Windows

I would like to batch process wav files in a folder: Firstly trimming the files to 5secs and placing the trimmed files in a folder called "Trim5s", then Changing the bit rate on the trimmed ...
Joe's user avatar
  • 125
0 votes
1 answer
1k views

How to change sample rate for all files in a directory

How do I change the sample rate for every file in the folder? I have the following code and it just erases the files -- the file size becomes 0. for i in wav/*.wav; do sox -r 8000 -e unsigned -b ...
Gansaikhan Shur's user avatar
0 votes
2 answers
429 views

Sox: Read wav and get pulse as 1 and silence as 0 and the duration of it in microseconds

The title of this question is already very clear I quess. I want to read a wav file and get pulses as 1 and silence as 0 and the duration of it in microseconds. The reason is this, I have recorded a ...
Codebeat's user avatar
  • 372
0 votes
0 answers
425 views

Duration of recorded file is longer than recording time using SoX?

I'm using SoX on Centos 7 to record the audio output from GQRX, a SDR application. I've selected Monitor of Built-in Audio Analog Stereo from the Recording Tab of the Pulseaudio Volume Control. I'm ...
websterling's user avatar
5 votes
1 answer
11k views

sox: How to specify audio input and audio output devices on OSX

In Linux, I used to use the following command, which takes audio input, applies reverb and a pitch shift effects, and then outputs the result to the specified audio device. sox -r 44100 -t alsa hw:1 ...
regulatre's user avatar
  • 470
2 votes
1 answer
1k views

How to use SoX or ffmpeg to extract the envelope of a sound file

I need to extract the envelope from a Wav sound file. Is there a way to achieve that from the command-line using SoX or ffmpeg?
Sylvain Leroux's user avatar
1 vote
1 answer
1k views

Ensure audio and video track are EXACTLY the same length

I generate 200 video files based on audio files generated using sox, combined with image files. Most clips are shorter than one second, none is longer than 6. I then concatenate these files and there ...
qubodup's user avatar
  • 8,924
3 votes
2 answers
4k views

sox and ffmpeg combine mp3 fails `Input files must have the same sample-rate`

I am trying to combine mp3 files via sox using: sox in.mp3 in2.mp3 out.mp3 and I get: sox FAIL sox: Input files must have the same sample-rate tried the -m option, but I guess this is default. I ...
JohnJ's user avatar
  • 133
2 votes
1 answer
111 views

Old school boom box input equivalent using SoX

I used to have a cassette tape/radio unit (boom box format) device. I used to use this to record mix tapes from my dual turntable and mixer setup. The resulting tapes were - for me - ideal for playing ...
AlanT's user avatar
  • 21
0 votes
0 answers
123 views

MP3 File can't be properly converted by any program, always gets cut to <1 second in length

I can't for the life of me figure this out, there's an mp3 file I'm trying to convert to wav with 1 channel on a linux server. I always use sox however sox happily converts it exactly how I want, ...
June's user avatar
  • 111
1 vote
1 answer
3k views

Downsample FLAC file if greater than a certain sample rate?

I want to convert a whole bunch of FLAC files to ALAC using a tool like ffmpeg or sox. This by itself is easy enough with a single command line. However, I want to save disk space by downsampling only ...
abza's user avatar
  • 161
0 votes
1 answer
4k views

How can I automatically cut all silence (0dB) from mp3 without reencoding?

As I read silenceremove will reencode file. Usually I do it manually creating file like: file 'file.mp3' inpoint 0 outpoint 01:55:00.0 file 'file.mp3' inpoint 02:03:50.0 and executing this command:...
Vitaly Zdanevich's user avatar
0 votes
0 answers
75 views

Reading inputs from Mac aggregate device separately

I understand how to create an aggregate device and have seen tutorials on how to record each input to a separate track on garage band. What I am curious about is if there is any library or utility ...
Zach's user avatar
  • 101
1 vote
1 answer
2k views

How do I add libmp3lame to sox?

When I want to use sox with an mp3 I get: C:\>C:\Progs\sox\sox.exe C:\Progs\tree.mp3 -C 60.2 C:\Progs\owl.mp3 tempo 1.0 C:\Progs\sox\sox.exe FAIL util: Unable to load LAME encoder library (...
Christian's user avatar
  • 2,264
0 votes
1 answer
3k views

sox batch convert from .raw to .wav

I'm trying to convert 728 .raw files to 16khz .wav files but I'm receiving the following error sox FAIL formats: can't open input file `outputdir/rawfile/b95981d1-3aa6-4d10-b755-990915951efc': No ...
Saad's user avatar
  • 1
2 votes
0 answers
885 views

How to record 30 seconds of audio from the iOS simulator with sox (or equivalent)?

I want to record 30 seconds of audio from the iOS simulator on OSX. I have found an example to record audio using a microphone. How to record 10 seconds of audio with SoX? However I need to capture ...
Jules's user avatar
  • 363
3 votes
2 answers
2k views

Nested ssh command forwarding

In general I could realtime listen audio on the remote computer as: ssh me@gate rec -t mp3 - | play - e.g. on the computer named gate I could execute the command rec (or sox) and the audio-stream is ...
cajwine's user avatar
  • 131
4 votes
1 answer
3k views

Is it possible to record the output of sound in macOS from the Terminal?

I would like to record the output audio of my Mac to an audio file using the command line, where I can specify the length of time to record. So for example, I might ask the command to record to a ...
Baz's user avatar
  • 489
3 votes
1 answer
471 views

Using a negative stoptime for the fade argument in the SoX audio editor

This SO answer suggest that one can use a negative stoptime with fade to specify the time from the end of the file. Negative time specification works for me with trim, but not with fade. This is what ...
joelostblom's user avatar
  • 2,569
0 votes
1 answer
1k views

Using sox to generate a square wave signal

I have a script (http://paste.ubuntu.com/24497460/) which uses sox to generate a wave form from a series of "pulses" and "spaces" generated by lirc from a remote control. The script creates a 19kHz ...
user39049's user avatar
  • 123
0 votes
2 answers
1k views

SoX Error While Merging Multiple Audio files

I am trying to merge a folder full of wav files with the command sox *.wav combined.wav and am getting this error: sox formats: no handler for detected file type `inode/x-empty; charset=binary' I ...
user02103012's user avatar
3 votes
1 answer
4k views

FFmpeg audio phase reversal

I'm writing a script which performs a series of operations on several .wav files. One of the operations is phase reversal (from what I gather, a 180 degrees phase shift). Is this possible with FFmpeg ...
Asotos's user avatar
  • 173
2 votes
1 answer
1k views

Maximum number of files that can be merged in SoX?

For anyone who has experience with the sox audio tool, what is the maximum amount (in MB) of files you have tried to merge? So far I have merged up to 925MB worth of wav files and have not had ...
lord_missingno's user avatar
0 votes
3 answers
9k views

Converting a Raw g722 File to a .wav with SOX

I am trying to troubleshoot some VOIP issues, and have been capturing the packets for the trouble calls. However my calls are all encoded in g722 and I am having trouble decoding this. I have ...
June Lewis's user avatar
3 votes
0 answers
231 views

Remove sections of audio in SoX

What's the easiest way to remove the specified sections of a wav file using SoX? Right now I use the trim command to break up the file and then concatenate the parts. However, that seems a little ...
Guest's user avatar
  • 31
3 votes
1 answer
1k views

How to trim and join several parts of an audio file using crossfades?

I want to keep several sections of an audio file, merged together, but without any discontinuities ("clicks") at the join points. There's a SoX command that does this (https://superuser.com/a/677351), ...
Display Name's user avatar
  • 1,133
1 vote
0 answers
2k views

Can't set sample rate to 44100 Hz when using loopback in ALSA

I have set up ALSA like this to play to and record from loopback devices: # output device pcm.loopout { type dmix ipc_key 328211 slave { pcm "hw:Loopback,0,0" period_size 1024 ...
haroba's user avatar
  • 225
6 votes
1 answer
18k views

How to record 10 seconds of audio with SoX?

I want to record 10 seconds of audio from my microphone input with SoX. I haven’t found any example in the documentation or elsewhere that would show how to do it. Here’s my current command using ...
shrx's user avatar
  • 464
0 votes
1 answer
459 views

How to stream audio and capture at the same time

I would like to save the mp3 that is being stream to the local file for archival purposes. I'm using the following line in my bash script to stream audio from a USB audio device to my icecast server....
Aaron's user avatar
  • 101
2 votes
1 answer
4k views

Error when trying to convert 2-channels sound file to mono using sox or ffmpeg

When I tried: sox file.wav -c 1 file.wav I got: sox WARN wav: Premature EOF on .wav input file When I tried: ffmpeg -i file.wav -ac 1 file.wav I got: [pcm_s16le @ 0x2997880] Invalid PCM packet, ...
Victor Basso's user avatar
15 votes
3 answers
12k views

Create a video file from an audio file and add visualizations from audio

My initial thought was to upload audio files to YouTube along with video that is inspired from the audio. The particular visualization can be in different form such as spectrum, spectogram, or other ...
Sun's user avatar
  • 6,322
10 votes
3 answers
19k views

Loop audio file to a given length

I'm currently facing an issue where I need to take some mp3 file and make another mp3 file where the first one is playing for a given amount of time, looped if needed. Preferably I'm looking for a ...
Tomcatus's user avatar
  • 350
3 votes
1 answer
2k views

How do I convert a batch of audio files on Windows?

I have a folder structure like this: -dir1 -subdir1 -subdir2 -file1.wav -file2.wav -dir2 -etc... Inside the folders are thousands of audio files that need to be converted....
MikeJerome's user avatar
1 vote
1 answer
2k views

Converting file to PCM using SoX

I am using SoX. A-Law, 8000 Hz, 64 Kbps, mono Is the format I need What I tried: input -c 1 -r 8000 output It is not working for me, please advise. I get the file output, it's just not the ...
Al Pacino's user avatar
  • 103
2 votes
1 answer
1k views

Merging files with sox sequentially

I have seen posts where people merge multiple sound files into one outfile like: soxmix in1.wav in2.wav in3.wav out.wav. However they are all on top of each other. Is there a way to merge so that ...
kmarks2's user avatar
  • 131
1 vote
1 answer
3k views

SoX pipe operations and data loss

When piping operations using SoX, I've noticed that files get shorter than they should: Works fine: sox -n -r 44100 silence.wav trim 0 1 sox --combine sequence silence.wav combined.wav soxi -D ...
Fabien Snauwaert's user avatar