TransWikia.com

How can I redirect sox messages to null or a log file

Ask Ubuntu Asked on December 25, 2021

I run the following command to capture the output of audio into a file:

$ sox -t pulseaudio alsa_output.pci-0000_00_1b.0.analog-stereo.monitor -t mp3 test.mp3 silence 1 0.1 3% 1 3.0 3% > /dev/null

Input File     : 'alsa_output.pci-0000_00_1b.0.analog-stereo.monitor' (pulseaudio)
Channels       : 2
Sample Rate    : 48000
Precision      : 16-bit
Sample Encoding: 16-bit Signed Integer PCM

In:0.00% 00:00:18.09 [00:00:00.00] Out:0     [      |      ]        Clip:0    ^C[C

As you see, while I tried to send the output to null, it stills show messages about the progress and status of recording!

I want it to record in background without showing these messages so that I can have the terminal prompts….

I checked sox for a log file but didn’t find

One Answer

sox has -q option if you don't want to see the messages.

You also forgot to specify what you want to send to /dev/null. It must be 1 (STDOUT), 2 (STDError) or & or 1&2 meaning both. check What does 2>/dev/null mean?

If you want to run the command in background add & at the end of command.

So it must be one of the followings:

sox -q -t pulseaudio alsa_output.pci-0000_00_1b.0.analog-stereo.monitor -t mp3 test.mp3 silence 1 0.1 3% 1 3.0 3%  &

OR:

sox -t pulseaudio alsa_output.pci-0000_00_1b.0.analog-stereo.monitor -t mp3 test.mp3 silence 1 0.1 3% 1 3.0 3% &>/dev/null &

Answered by Ahmad on December 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP