On 06/25/2011 04:23 PM, pshirkey(a)boosthardware.com wrote:
Hi,
Can anyone point me to a simple code example for how to determine the
phase at a specific time in a waveform?
ex. if I have a sample that is 5 seconds long and want to know the phase
at 2.5 seconds
talking about the "phase" at some particular point in time doesn't make
sense. first you would have to do an fft (whose resolution is bound by
the window size), and then you'd have to look at each frequency bin
separately, because they will all be at different relative phase.
when you talk directly into my ear, the voice/ear system will be roughly
zero phase. when i move away even a few inches, there will be a linear
phase "distortion" due to the fact that i'm now one wavelength away at
some mid frequency, but several wavelengths at high frequencies.
so "phase" is not really a meaningful thing unless you are talking about
recombination of strongly correlated signals.
another example: if your sample consists of a sine at 100hz and one at
200hz, after 10ms the first component will be at 0° while the second is
at 180°, iff both started at 0° in the first place. but why would anyone
care? with real-life sounds, this whole exercise becomes meaningless.
what are you trying to accomplish?