2

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.

1
  • 1
    Do you want a program name or o you want to code a program to do that?
    – JSmith
    Commented Feb 13, 2016 at 23:14

1 Answer 1

1

I'm not sure I understand the question, but you can use the Fourier transform (https://en.wikipedia.org/wiki/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.

1
  • 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. Commented Feb 16, 2016 at 1:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.