- Home /
Reliable way to analyze peaks in an audio file?
Is there anyway I can analyze a .wav file within Unity for positions in which the sound peaks? If there is, is there any way to iterate through the audio file without playing it? ATM I am aware of getSpectrumData/getOutput.
What I am trying to do: This is for a beat game (not thinking rhythm yet). I want to read in where peaks at a given threshold occur for a bass kick (just a bass kick) and push the time of its happening into a queue so the game can anticipate when it'll be coming when the track is actually playing. I'm hoping this could theoretically work; if not, any guidance would be appreciated!
Thank you all!
Answer by drudiverse · Dec 01, 2014 at 08:05 AM
id use a bandpass filter in the bass range, perhaps 3=4, for example at 200hz and search for percussive signals at regular frame rates. bandpass is cool because it is sample accurate, it gives you the peaks for each sample. just measure any peaks that occur over a 100ms time, take their time position, and see if their time positions together are on same beats.