Capture output from SOX "-n stat"
I am trying to capture/pipe the output from the following:
arecord -f S16_LE -qd 5 file && sox file -n stat
Samples read: 8000
Length (seconds): 1.000000
Scaled by: 2147483647.0
Maximum amplitude: 0.992188
Minimum amplitude: -0.992188
Midline amplitude: 0.000000
Mean norm: 0.093221
Mean amplitude: -0.015338
RMS amplitude: 0.232947
Maximum delta: 0.617188
Minimum delta: 0.000000
Mean delta: 0.001067
RMS delta: 0.009643
Rough frequency: 52
Volume adjustment: 1.008
I need to capture the data to convert to json. Issue is "SOX" seems to defy any method I would normally use to capture/pipe the stdout. Any recommendations?
Sox is sending this output to stderr.
In order to redirect stderr, try running something along the lines of
arecord -f S16_LE -qd 5 file && sox file -n stat 2> output.txt
Or send it to a pipe (ex
arecord -f S16_LE -qd 5 file && sox file -n stat 2>&1 | wc