IPB

Welcome Guest ( Log In | Register )

Commandline audio analysis utility?
sheh
post Nov 4 2012, 18:37
Post #1





Group: Members
Posts: 89
Joined: 3-November 04
Member No.: 17971



Can anyone suggest a utility that takes an audio file as input, and can output to a text/CSV file various data (RMS, peaks, dominant frequencies, etc.) per each N ms of the input, for both time and frequency domains?

Windows is my main target, but *nix as well.

It seems SoX has a few features in this direction, but not flexible enough (e.g., data per N ms, frequency domain resolution).
Go to the top of the page
+Quote Post
 
Start new topic
Replies (1 - 12)
chi
post Nov 5 2012, 01:47
Post #2





Group: Members
Posts: 45
Joined: 27-November 11
Member No.: 95439



QUOTE (sheh @ Nov 4 2012, 19:37) *
It seems SoX has a few features in this direction, but not flexible enough (e.g., data per N ms, frequency domain resolution).


For the time-domain values, you could use something like this:
CODE
sox input.wav -n trim 0 0.012 stats : restart
(change 0.012 s = 12 ms into the desired block length). You are right, however, regarding the frequency domain; there is not much support for that.
Go to the top of the page
+Quote Post
sheh
post Nov 5 2012, 20:03
Post #3





Group: Members
Posts: 89
Joined: 3-November 04
Member No.: 17971



It won't be efficient, executing it thousands of times.
Go to the top of the page
+Quote Post
saratoga
post Nov 5 2012, 21:11
Post #4





Group: Members
Posts: 4723
Joined: 2-September 02
Member No.: 3264



QUOTE (sheh @ Nov 5 2012, 15:03) *
It won't be efficient, executing it thousands of times.


Is that a realistic concern given how trivial the processing you are doing is?
Go to the top of the page
+Quote Post
DVDdoug
post Nov 5 2012, 21:25
Post #5





Group: Members
Posts: 2449
Joined: 24-August 07
From: Silicon Valley
Member No.: 46454



If you don't want to write an application yourself, Your best bet is probably MATLAB or a MATLAB Clone.

Of course, you'd need to understand the math required for what you want to accomplish. I've never used any of these programs, but I believe FFT is "built-in" (and simpler things like average & RMS algirithms) so you shouldn't have to develop all of the math from scratch.

This post has been edited by DVDdoug: Nov 5 2012, 21:27
Go to the top of the page
+Quote Post
Kohlrabi
post Nov 5 2012, 22:30
Post #6





Group: Super Moderator
Posts: 957
Joined: 12-March 05
From: Kiel, Germany
Member No.: 20561



As a free alternative to MATLAB I'd suggest to try Python + Numpy/Scipy. I've never used it myself, but there is also a scikit for audio processing around.


--------------------
Audiophiles live in constant fear of jitter.
Go to the top of the page
+Quote Post
chi
post Nov 5 2012, 22:38
Post #7





Group: Members
Posts: 45
Joined: 27-November 11
Member No.: 95439



QUOTE (sheh @ Nov 5 2012, 21:03) *
It won't be efficient, executing it thousands of times.


CODE
$ soxi data.wav

Input File     : 'data.wav'
Channels       : 2
Sample Rate    : 44100
Precision      : 16-bit
Duration       : 01:12:00.91 = 190551984 samples = 324068 CDDA sectors
File Size      : 762M
Bit Rate       : 1.41M
Sample Encoding: 16-bit Signed Integer PCM

$ time (sox data.wav -n trim 0 0.055 stats : restart 2>&1 | wc)
1256737 5733870 45242573

real    0m23.383s
user    0m20.849s
sys    0m5.960s
$


So thatís less than half a minute for 78562 blocks. For a block length of 0.009 seconds (480101 blocks), it takes four minutes. The processor is a 1 GHz AMD 4850e, nothing extreme.
Go to the top of the page
+Quote Post
rgtb
post Nov 5 2012, 22:49
Post #8





Group: Members
Posts: 25
Joined: 26-September 12
Member No.: 103446



QUOTE (DVDdoug @ Nov 5 2012, 21:25) *
If you don't want to write an application yourself, Your best bet is probably MATLAB or a MATLAB Clone.

+1. i've never used Matlab for audio but it should come with all necessary functionality. it can read WAV files, write CSV files, and has the most essential libraries such as FFTW built-in.
Go to the top of the page
+Quote Post
sheh
post Nov 6 2012, 04:32
Post #9





Group: Members
Posts: 89
Joined: 3-November 04
Member No.: 17971



Thanks for the suggestions.

QUOTE (chi @ Nov 5 2012, 23:38) *
So that’s less than half a minute for 78562 blocks. For a block length of 0.009 seconds (480101 blocks), it takes four minutes. The processor is a 1 GHz AMD 4850e, nothing extreme.

QUOTE (saratoga @ Nov 5 2012, 22:11) *
Is that a realistic concern given how trivial the processing you are doing is?

Interesting. I'm wonder if execution overhead is that trivial on a webhost, or at least, in terms of what they'd consider valid use. But then again, there's also the missing features with SoX.

QUOTE (DVDdoug @ Nov 5 2012, 22:25) *
Your best bet is probably MATLAB or a MATLAB Clone
Although I'd rather use something existing made for the specific job, rather than semi-program, I'll check this direction too.

QUOTE (Kohlrabi @ Nov 5 2012, 23:30) *
As a free alternative to MATLAB I'd suggest to try Python + Numpy/Scipy. I've never used it myself, but there is also a scikit for audio processing around.
Sounds like this might need some customization, but I'll check it out. I wonder how well Python performs, but there are also potential advantages to Python for running on a shared webhost.

This post has been edited by sheh: Nov 6 2012, 04:49
Go to the top of the page
+Quote Post
romor
post Nov 6 2012, 13:00
Post #10





Group: Members
Posts: 653
Joined: 16-January 09
Member No.: 65630



QUOTE (sheh @ Nov 6 2012, 05:32) *
QUOTE (Kohlrabi @ Nov 5 2012, 23:30) *
As a free alternative to MATLAB I'd suggest to try Python + Numpy/Scipy. I've never used it myself, but there is also a scikit for audio processing around.
Sounds like this might need some customization, but I'll check it out. I wonder how well Python performs, but there are also potential advantages to Python for running on a shared webhost.

In case you aren't aware, and for reference, NumPy/SciPy provide C level BLAS/LAPACK routines in Python interface, all around Numpy's multidimension (nd)array object. Many packages depend on it. Further performance boost on matrix manipulation, linear algebra and some other things, can be applied by compiling/installing (depending on platform) with Intel MKL or ATLAS libraries (roughly x30 boost, but that also is different from case to case)
Then take performance test with other suggested/possible solutions

For reading PCM WAV files, SciPy can do it. Audiolab scikit, provides additional formats through sndfile library, and was made as SciPy extension (like many others scikits)


--------------------
scripts: http://goo.gl/M1qVLQ
Go to the top of the page
+Quote Post
phofman
post Nov 6 2012, 14:23
Post #11





Group: Members
Posts: 268
Joined: 14-February 12
Member No.: 97162



QUOTE (sheh @ Nov 5 2012, 21:03) *
It won't be efficient, executing it thousands of times.


The command "restart" does not re-execute sox as a new process. It is just a sox parameter telling it to loop the internal processing chain.
Go to the top of the page
+Quote Post
ojdo
post Nov 6 2012, 14:59
Post #12





Group: Members
Posts: 894
Joined: 18-June 06
From: Germany
Member No.: 31980



Another alternative might be Praat, that has basic scripting capabilities and allows to easily extract low to mid level audio features.


--------------------
http://freemusi.cc/
Go to the top of the page
+Quote Post
sheh
post Nov 7 2012, 16:55
Post #13





Group: Members
Posts: 89
Joined: 3-November 04
Member No.: 17971



No, I'm not aware of the specifics of SciPy/NumPy. Sounds like the plot thickens, at least with shared webhosting.

I also wasn't aware initially of SoX's restart command.

Praat is intriguing. I wonder why they seem very intent on not showing any screenshots in their site. smile.gif
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 24th April 2014 - 19:32