|
-
Mar 5th, 2008, 07:42 AM
#1
Thread Starter
Frenzied Member
[2008] Convert Wave File To Frequencies
Is there any way I can convert a wave file into a list of frequencies and durations of these frequencies?
-
Mar 7th, 2008, 06:27 AM
#2
Thread Starter
Frenzied Member
Re: [2008] Convert Wave File To Frequencies
If it is unclear what I am asking for I am happy to give more information?
-
Apr 16th, 2008, 06:36 AM
#3
Thread Starter
Frenzied Member
Re: [2008] Convert Wave File To Frequencies
Hate doing this but.... Bump!
-
Apr 16th, 2008, 07:21 AM
#4
Re: [2008] Convert Wave File To Frequencies
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.
-
Apr 16th, 2008, 08:20 AM
#5
Re: [2008] Convert Wave File To Frequencies
There are probably audio libraries out there that can do this for you. Try googling.
-
Apr 16th, 2008, 10:17 AM
#6
Thread Starter
Frenzied Member
Re: [2008] Convert Wave File To Frequencies
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?
-
Apr 16th, 2008, 10:20 AM
#7
Member
Re: [2008] Convert Wave File To Frequencies
Human hearing upper limit approx. 22,000Hz
To reproduce digitally 2 x 22,000 = 44,000
http://en.wikipedia.org/wiki/Nyquist...mpling_theorem
-
Apr 16th, 2008, 12:05 PM
#8
Re: [2008] Convert Wave File To Frequencies
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.
-
Apr 16th, 2008, 12:08 PM
#9
Thread Starter
Frenzied Member
Re: [2008] Convert Wave File To Frequencies
So what I really need is the troughs and peaks and the times between them?
-
Apr 16th, 2008, 12:10 PM
#10
Re: [2008] Convert Wave File To Frequencies
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.
-
Apr 16th, 2008, 12:48 PM
#11
Member
Re: [2008] Convert Wave File To Frequencies
-
Apr 16th, 2008, 01:28 PM
#12
Re: [2008] Convert Wave File To Frequencies
Heh... wow the WAV format is complex. It's nothing like a bitmap... I had no idea WAV could hold compressed audio.
-
Apr 16th, 2008, 02:01 PM
#13
Re: [2008] Convert Wave File To Frequencies
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...
-
Jun 11th, 2008, 06:38 AM
#14
Member
Re: [2008] Convert Wave File To Frequencies
 Originally Posted by CVMichael
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....
maybe a bit off-topic... but I'm trying to plot on screen the waveform contained into a WAV file.
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?
-
Jun 11th, 2008, 10:48 AM
#15
Re: [2008] Convert Wave File To Frequencies
Well, I can't guess...
Post your code, and post a screen shot of the peaks you are talking about...
-
Jun 12th, 2008, 03:53 AM
#16
Member
Re: [2008] Convert Wave File To Frequencies
 Originally Posted by CVMichael
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:
http://www.vbforums.com/showthread.php?t=526712
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|