问题
I found out that I can use SoX's
play file.wav stat -freq
to generate a table of levels against frequencies for a file.
However, it seems to run in real time, i.e. takes as long to complete as the audio does to play.
How can I generate the same table of frequencies and levels but in the shortest time possible?
回答1:
The output of SoX is rather slow, but this is mainly caused by the displaying. One solution could be to redirect the output of SoX (which is on the standard error (stderr) stream in the case of stat) to a file.
You could use:
sox file.wav -n stat -freq > out 2>&1
that will redirect stderr to stdout (&1), and then redirect stdout to the file 'out'. See this link for other solutions to redirect stderr.
This should be rather faster (in my case few seconds for a 10 minute file).
来源:https://stackoverflow.com/questions/47468299/frequency-distribution-from-wav-files