We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I read up on examples of how to use FFT functions to create an audio visualiser as the audio is being played backed. Just wondering, is there a way to analyse a sound file without playing back? For example, read through the sound file and store the FFT analysis in a 2D array of spectrum[frame][band].
Answers
Check this post: https://forum.processing.org/two/discussion/20672/how-to-draw-a-waveform-for-an-entire-sound-file#latest
Kf
Thanks! That is certainly helpful!
I realised that the FFT functions only seem to work on a small portion for the audio stored in the buffer, are there any way to make it perform for the entire sound file? Perhaps there is a way to create a buffer to hold the entire or operate from the values returned from getChannel().
How big is your buffer after you read your file and at what sampling rate? You should check the documentation to see if they discuss about buffer size limits.
You could also provide details about what you would like to do with your information. You could get more ideas from other forum goers. If you post your code, it will assist ppl to see your approach.
I have done FFTs in "long" buffers but not in Processing.
Kf
I think it would easier to show an image of I am trying to create:
This program analyses the entire sound file (does not play it back), and and finds out what seems to be the average or RMS amplitude of each frequency bands throughout the entire song (shown on the bottom left). From the graph, you know that is a bassy song as the lower frequencies have an average higher amplitude and this is probably a lossy sound file since frequencies around the 22KHz are cut off.
I am trying to make something like this. I would like to analyse the song without playing back.
No code to show yet, still just trying out different functions in Minim and planning on how to algorithm should be like. Sorry for my poor expression. Anyway my buffer was set to the default 1024 in Minim.
No need to show your code. It just make things easier. I will have to check the documentation. I will do it after work... like in few hours to see if it is possible to change the buffer size. If your song is 60 seconds long, then you will need a buffer of size 60 / (1/22000) = 1.32E6
To test the code to see if it is bassy or not, what songs do you have in mind?
Kf
I've cooked up a terrible attempt meanwhile. You can download everything including the mp3 here: https://drive.google.com/file/d/0B1EkhiMA92ATVW14N1cyVVpSblk/view?usp=sharing
The song is one of the free-to-use background music from Youtube, so no issues with copyrights here.
You should check the example provided by the library. In Processing, go to File>>Examples and then minim>>Analysis>>offlineAnalysis. Now this example does not load the full spectrum at once but gives you a really neat idea of the frequencies observed in your data.
Kf
Sure man, will check it out once I'm free.
I see, so you can actually pass an array of float that you get from getChannel to the FFT function.