Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do I capture the verbose output from soxi?

I’m trying to get the loop start and end point metadata from an audio sample. I’m using soxi with the -V verbose flag. The data I need shows up in the terminal but isn’t captured, nor piped to the next command.

Showing the data with soxi:

$ soxi -V sample.aif

soxi INFO formats: detected file format type `aiff'
soxi INFO aiff: AIFF Loop markers:
soxi INFO aiff: Loop 0: start:  75576
soxi INFO aiff:  end:   103868
soxi INFO aiff:  count:      1
soxi INFO aiff:  type:  
soxi INFO aiff: forward
soxi INFO aiff: Unity MIDI Note: 52
soxi INFO aiff: Low   MIDI Note: 50
soxi INFO aiff: High  MIDI Note: 53

Input File     : 'sample.aif'
Channels       : 1
Sample Rate    : 44100
Precision      : 24-bit
Duration       : 00:00:03.80 = 167665 samples = 285.145 CDDA sectors
File Size      : 507k
Bit Rate       : 1.07M
Sample Encoding: 24-bit Signed Integer PCM

But when I pipe that output into a text file the top section still appears in the terminal and only the bottom section is piped to the text file:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

$ soxi -V sample.aif >> data.txt

soxi INFO formats: detected file format type `aiff'
soxi INFO aiff: AIFF Loop markers:
soxi INFO aiff: Loop 0: start:  75576
soxi INFO aiff:  end:   103868
soxi INFO aiff:  count:      1
soxi INFO aiff:  type:  
soxi INFO aiff: forward
soxi INFO aiff: Unity MIDI Note: 52
soxi INFO aiff: Low   MIDI Note: 50
soxi INFO aiff: High  MIDI Note: 53

$ cat data.txt

Input File     : 'sample.aif'
Channels       : 1
Sample Rate    : 44100
Precision      : 24-bit
Duration       : 00:00:03.80 = 167665 samples = 285.145 CDDA sectors
File Size      : 507k
Bit Rate       : 1.07M
Sample Encoding: 24-bit Signed Integer PCM

How do I capture that top section of output, which contains the data I need?

>Solution :

The -V parameter of soxi outputs the verbose part to stderr (fd 2)

To include the verbose part as well, redirect stderr to stdout (fd 1)

$ soxi -V sample.aif 2>&1 | tee -a data.txt
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading