Is there any way I can convert a wave file into a list of frequencies and durations of these frequencies?
Printable View
Is there any way I can convert a wave file into a list of frequencies and durations of these frequencies?
If it is unclear what I am asking for I am happy to give more information?
Hate doing this but.... Bump!
I'd start will Googleing around on exactly how WAV files store audio data. I think they just store amplitude levels at finite sample rates (for example, 44000 hz).
You'd need some form of math algorithm to find peaks within a timeframe of sample (1 sec) and count them.
So, if I run an analysis on the first 44000 samples, and I find 2500 peaks, then for that second of time, my frequency is 2.5khz.
If you're having trouble finding an algorithm for detecting the peaks, hit up the math forums on here and ask if anyone knows of an algorithm for determining frequency of a set of point data.
There are probably audio libraries out there that can do this for you. Try googling.
It's been a while since I thought about this. A friend reminded me today and I dug up the thread. Just to check to see if I am doing this correctly. If a wav file has a sample rate of 44KHz then it will play 44000 notes in 1 second. Each note will have a duration of 1/44000s which comes to 2.73x10^-5s.
Everyone of these notes (which have a set duration) has a frequency and amplitude. And that is all that is needed to play any set of sounds, no matter what instrument. Everything there correct?
Human hearing upper limit approx. 22,000Hz
To reproduce digitally 2 x 22,000 = 44,000
http://en.wikipedia.org/wiki/Nyquist...mpling_theorem
No, 44kHz isn't 44000 notes... it's 44000 dots on a graph. When you connect the dots you get a wave. You count how many peaks are in that wave and that is your average frequency.
http://img371.imageshack.us/img371/9...equencykv3.png
So what I really need is the troughs and peaks and the times between them?
Yea, you can divide the time as thin as you want, if you want to get a reading every 1/2 second, then you'll have to multiply your count by 2.
Heh... wow the WAV format is complex. It's nothing like a bitmap... I had no idea WAV could hold compressed audio.
Sorry but I just have to interfere, even though I'm not good at .NET (I'm good with VB6).
You guys are really off...
That 44100 Hz (or 44.1KHz) is how many samples are in one second. This defines how clear the sound is recorded, nothing else....
This also means that the highest frequency you can have in a 44100 Hz wave file is 22050 Hz.
You should see my sound tutorial, at least the first post where it explains what sound is.
VB6.0 – Sound and DirectXSound Tutorial
You can't get the frequency by how many peeks you find, because sound is made of many frequencies. And that means that each has it's own peeks within another frequency's peeks and so on.
Imagine 100 frequencies at the same time, if you count the peeks, you are basically doing a SUM of all 100 frequencies at the same time.
And on top of that... not all frequencies start at the same time... one frequency could start from the beginning of the sound and another from the middle of the sound, and another from the end of the sound...
To do this you have to use FFT (Fast Fourier transform), look it up on Google.
You have to Process wave file through the FFT, 512 or 1024 samples at a time depending of the resolution you want to get, overlapping the last 256 or 512 samples for each pass.
Anyways, I don't have time to say more... but I just wanted to tell you that you are going about this the wrong way. FFT is the right way, and do your research on that...
maybe a bit off-topic... but I'm trying to plot on screen the waveform contained into a WAV file.Quote:
Originally Posted by CVMichael
I don't care the frequencies, as the waveform actually represents a digital signal a few ms long, so I just need to know when the waveform is high and when it is low.
I parse the DATA chunk word by word and I just plot values on the screen: it works pretty well... but in several points of the resulting graph I see "peaks", which, when compared to the WAV file, correspond to values over 65000. But the file displayed in Audacity shows no peeks, just kind of a square wave (zeroes and ones).
What am I doing wrong?
Well, I can't guess...
Post your code, and post a screen shot of the peaks you are talking about...
Thanks, I opened a separate thread:Quote:
Originally Posted by CVMichael
http://www.vbforums.com/showthread.php?t=526712