Jump to content

audio file analysis


froddyklutz

Recommended Posts

Hi, i'm trying to code a rather ambitious piece of physics code, a php car dyno, but i need to be able to do analysis on a wav audio file. The audio file is a sample taken from an inductive pickup on a spark plug lead. I need to be able to get a number of peaks per x samples.

 

In wave editing program the file looks sorta like this:

/\__/\__/\__

 

I was thinking if i calculate the average value for the whole file then just record a count when the value rises above this threshhold.

 

Most of the code I can do, the main thing I need help with is reading the wav file samples into an array.

 

Main issues: I have never done any bit level file reading and I dont understand and cant fine a simple explaination of the wav format.

 

I have been doing php for a few years but nothing more complicated than typical website, sessions, email, logging code.

Link to comment
https://forums.phpfreaks.com/topic/37438-audio-file-analysis/
Share on other sites

OooO. I know! Actually, I'm just excited that someone else is trying to rip apart audio file data to use in a non conventional project in php.

 

Go to phpclasses.org, and search for wavedit. WavEdit is a wonderful class designed to pull apart 8 and 16 bit, 1 and 2 channel, uncompressed wav files, and edit or merge them. You can access the array of audio data when using the class's getFiles function. You will have to go in there and do a printf() of the resulting array near the end of the function to test out what the array looks like (viewing the resulting page source organizes it a bit better) . If I remember correctly, for a 16 bit audio sample the array values range from -32768 to 32767.

 

Good luck on your project. Hope this helps.

Link to comment
https://forums.phpfreaks.com/topic/37438-audio-file-analysis/#findComment-179649
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.