How to analyze music in non-realtime

edited October 2013 in How To...

I try to get the level of every frame(piece) of a music file (file.mix.level()). and want to save this in an array or an arraylist. I can arrange it by writing the code in draw-method. The problem is, that i have to listen the whole file to get all array-elements. Is there a way to do this faster, probably without using the draw-method, by writing it only in setup???

Many thanks for every reply!!!!!!! mast

Answers

  • edited November 2013 Answer ✓

    What I did was to split the problem in two parts.

    First I did the slow sound analysis once, saving the data to disk using http://processing.org/reference/createWriter_.html This could be done with a sketch called "trackAnalyzer".

    Then I created a "trackVisualizer" sketch that reads the data from the file previously saved, using http://processing.org/reference/BufferedReader.html, which can run super fast (I was processing 300 Mb of numbers in just a few seconds. I was surprised how fast it was).

    This allows you to experiment faster, without having to listen to the complete track each time (my track was 83 minutes long!).

    I you don't want to wait even the first time, maybe you can take a look at the loadFileIntoBuffer, in the Processing examples. I'm sure there are also sound analysis programs that convert sound tracks into numbers you could later use in your programs. Maybe someone else can point out other options?

    Cheers!

  • Thanks, I will try

Sign In or Register to comment.