Measuring the phase between two sinusoid inputs with AudioAnalyzePhase_F32

WeTec

Member
For my project I want to measure the phase between two input signals. The input signals have a sinusoidal shape and the exact same frequency. The frequency can be in the range from 100 Hz to 10 kHz. The AudioAnalyzePhase_F32 object from the OpenAudio library seems to be perfect for this task but I'm struggling to get the example code to work.
My hardware is the Teensy 4.1 only. There is no audio shield connected because the example code feeds the generated sine signals (with 60° phase) direct to the analyze phase object.
The code is the example from the library without any modifications. The result is quite unexpected. The values should be around 60°.
Did I miss something?

Here is the serial output:
Code:
Setup complete.
0.00
128 x NBLOCKS Data Points:
90.022179
90.059608
90.114189
90.148399
90.110687
89.970062
89.726273
89.484535
89.374893
89.544937
89.998238
90.573265
90.945518
90.777954
89.960045
88.730927
87.727127
87.674431
89.028847
91.525848
94.085388
95.006363
92.561142
85.830322
74.599983
59.494526
42.569771
20.141691
0.000000
0.000000
0.000000
0.000000
8.671685
13.946931
13.778823
9.876193
0.000000
0.000000
0.000000
0.000000
0.000000
6.460603
7.173717
6.724767
0.000000
0.000000
[...]
There are many more zeros, but I've shortened this.
 
In the example code linked above there are three further examples to configure the AudioAnalyzePhase_F32 object with different filter settings. I've tested these and the results are also strange and unexpected. Changing the frequency of the signals to 1234 Hz has no effect.

Does anyone know another method to get the phase of two inputs? Unfortunatly the FFT objects return magnitude only.

Any help would be great.
 
Back
Top