[LAD] Determining Phase

Rui Nuno Capela rncbc at rncbc.org
Sun Jun 26 16:36:55 UTC 2011

On 06/26/2011 10:13 AM, pshirkey at boosthardware.com wrote:
>> 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.
>> in general, theory i mean, phase equals delay; it can be computed
>> deterministically iif the signal is a pure tone (sinusoidal) otherwise
>> you must have a reference signal and referring to its fundamental
>> frequency (1st order harmonic) or, when in-the-field, you can pick one
>> conventional signal tone (i've been told that a 1khz is a usual choice:)
>> and compare to that.
>> if you are to compare two known signals (often input vs. output of some
>> lti transformation, eg. filter), than the computation to do is
>> correlation. well, you should use fft for that, but i'm sure you know
>> that:)
> You wouldn't happen to have an example of this code?
> Perhaps there is something in qtractor along these lines already?

no, not at all :) qtractor doesn't have anything of the sort, sorry. i 
was just clearing dust from the top of my mind re. lti systems theory :)

> I have looked at integrating something with librubberband but first things
> first right?

hmmm... there's this wsola algorithm for time-stretching in the 
time-domain (cf. frequency-domain as in rubberband) where 
auto-correlation is computed to find the optimum overlap window point 
(by waveform similarity). well, that's maybe an idea spark... but again 
you need the zero-phase/origin reference signal waveform anyway to 
correlate to... 'coz, as others said, your question doesn't make much 
sense as is :)

rncbc aka Rui Nuno Capela
rncbc at rncbc.org

More information about the Linux-audio-dev mailing list