If you just want to look at a particular frequency, you could just use
awk to do the additions, for example:
Code:
sox 1.wav -n stat -freq |& grep '^0\.0' | awk '{s+=$2; ++c} END {print s/c}'
If you want to average the whole set of 2048 frequencies, then you may have to write something a bit more extensive in your language of choice, for example:
Code:
sox 1.wav -n stat -freq |& head -n -15 | \
perl -lne 'split; @sum[$i++%2048] += $_[1]; END { $i/=2048; foreach (@sum) {print $_/$i} }'
Also keep in mind that this analysis using
sox assumes a single channel audio source.
You could also consider using
audacity, which can analyze spectra and export these, if you don't need to automate the process.