[LAD] Determining Phase

Gordon JC Pearce gordonjcp at gjcp.net
Sun Jun 26 15:25:47 UTC 2011

On Sat, 25 Jun 2011 16:23:29 +0200 (CEST)
pshirkey at 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
> I'm open to code in any language or a scripted example if such a tool
> exists. If there is an ui which has that feature I am also interested.

There isn't really a way to do this.  How would you tell the difference between 0.5*sin(pi/2)
and 1.0*sin(pi/6) - try it and see, what are the answers?

If you want to determine phase you need to know the amplitude.  The only sane way to do both is
to use a complex sample with an in-phase and a quadrature component.

Gordon MM0YEQ

More information about the Linux-audio-dev mailing list