frequencys in a wavfile

Windows specific forum
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

frequencys in a wavfile

Post by Hroudtwolf »

Dear Comunity, :)


I want to read only frequencys from a WAV-File by using the fileaccess function from purebasic.
Do anyone knows, how to realize it ?
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Post by Xombie »

Hroudtwolf - not to be nosy but you're posting an awful lot of questions at once. What kind of project are you working on? Are all the questions related to the same project?
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post by Hroudtwolf »

I want to show the frequencys as graficoutput.
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Post by traumatic »

Hroudtwolf, I told you more than once how to achieve this.

I gave you links to pages that explain how WAVE-data looks like and
how FFTing works, which is the only way to gain access to the frequency
information.

These pages even contain sample codes. What else do you need?

Audio programming can be a rather demanding and extensive topic but
is easy once you get the drill. Just read through the pages I proposed, chum
up with how the data is stored in .wav-files and learn some math needed
for audiocoding. You will soon see it's not that hard.

Audiosamples are signed values (8bit is unsigned as an exception) and
in stereo streams, they are stored as LEFT, RIGHT, LEFT, RIGHT etc.
That's about all you've got to know...

Here's what a simple FFT implementation could look like:

Code: Select all

Procedure SlowFourierTransform()
  For bin=0 To (#BUFFERSIZE/2)-1
    cosAmp.f = 0.0
    sinAmp.f = 0.0
    For k=0 To #BUFFERSIZE-1
      x.f = 2.0 * #PI * bin * k / #BUFFERSIZE
      sinAmp + InputData(k) * Sin(x)
      cosAmp + InputData(k) * Cos(x)
    Next
    AmpOutput(bin) = Sqr(sinAmp*sinAmp + cosAmp*cosAmp)
  Next
EndProcedure
Other than that, I'd like to repeat Xombie's question: What are you up to?
It seems like you're randomly asking questions on any and every topic.
No offense.
Good programmers don't comment their code. It was hard to write, should be hard to read.
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post by Hroudtwolf »

@Traumatic

Thank you at first.

Other than that, I'd like to repeat Xombie's question: What are you up to?
It seems like you're randomly asking questions on any and every topic.
No offense.
I have presently two firm projects. But all my question about sound and the other subjects are a training for me. A training for better understand interresting areas of the programming.
Is asking illegally.
I'm just nosy.
Programming is my hobby and I want learn about many things of it.
Post Reply