2

I'm trying to pipe audio to sox and I get Error "sox FAIL formats: bad input format for `-': sampling rate was not specified"

parec -d alsa_output.pci-0000_00_1b.0.analog-stereo.monitor  --rate=16000 --channels=1 | sox -t raw - output.wav  silence 1 0.3 0.1% 1 0.3 0.1% : newfile : restart

This is output of the command

sox FAIL formats: bad input format for  `-': sampling rate was not specified
Opening a recording stream with sample specification 's16le 1ch 16000Hz' and channel map 'mono'.
Connection established.
Stream successfully created.
Buffer metrics: maxlength=4194304, fragsize=64000
Using sample spec 's16le 1ch 16000Hz', channel map 'mono'.
Connected to device alsa_output.pci-0000_00_1b.0.analog-stereo.monitor (index: 0, suspended: no).
write() failed: Broken pipe
4

A raw stream does not contain any meta-information about its format, so you have to tell sox about it:

parec ... | sox -t raw -r 16k -e signed -b 16 -c 1 ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.