Question

I have a function that can play set frequencies. The function's inputs are frequency and duration. How can I analyze a sound file so that I have the output frequency for every milisecond of audio.

e.g.: MS, Frequency
1, 400
2, 401
3, 402
etc.

If there is Mac based software that can do this, I'd be fine with preprocessing the audio files and only inputing the frequency/duration combos.

Thanks!

Was it helpful?

Solution

Most sound files (recordings of anything other than a simple sin wave) do not have a single output frequency, so what you're trying to do is essentially impossible. It is possible to determine the dominant or fundamental frequency of a sound file, but this becomes more difficult to do (and less accurate) the shorter the file is. A one-millisecond snippet of CD-quality (mono) sound consists of only 441 samples.

Are you perhaps trying to convert a recording into its component notes, and then reproduce the tune with your function that plays frequencies? To see how fundamentally difficult this task is, try googling "wav-to-midi".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top