Solving for Amplitude and Frequency in WAV files


So I'm able to successfully find all the information about a WAV file except the amplitude and the frequency (hertz) of the big sin function by reading the binaries in the file (which are unfortunately exactly what I'm looking for). Just to verify what I'm talking about, the file generates one wave only with the equation:

F(s) = A * sin(T * s)

Where s is the current sample, A is the amplitude and T is the period. Now the equation for the T (period) is:

T = (2π * Hz) /(α * ω)

Where Hz is frequency in Hertz, α is Samples per second, and ω is the amount of channels.

Now I know that to solve for amplitude, I could simply find the value of F(s) where

s = (π/2)/T

Because then the value of the sine function would be 1, and the final value would be equivalent to A. The problem is that to divide by T, I have to know the Hertz (or Hz). So basically...

Is there any way that I can read a WAV file to discover the Hertz from the data, assuming the file only contains a single wave.

Jared Massa

Posted 2016-02-13T22:57:12.537

Reputation: 13

1Do you want a program name or o you want to code a program to do that? – JSmith – 2016-02-13T23:14:20.883



I'm not sure I understand the question, but you can use the Fourier transform ( to decompose any signal into its constituent frequencies. The result should be trivial if your original signal is just one sine wave being generated at a constant frequency.


Posted 2016-02-13T22:57:12.537

Reputation: 26

I was actually able to use the outputted data from the file to approximate the difference between peaks throughout the sine wave, and then used this data to find out my frequency. However, I marked your answer correct because the Fourier transform would definitely have worked if my wave stayed constant. – Jared Massa – 2016-02-16T01:54:37.887