pyACA: Documentation 0.3.1
Source Code for Audio Content Analysis
Loading...
Searching...
No Matches
Functions
pyACA.ToolInstFreq Namespace Reference

Functions

 ToolInstFreq (X_complex, iHopLength, f_s)
 computes instantaneous frequency utilizing phase of neighboring blocks of complex spectra
 
 princarg_I (phi)
 

Function Documentation

◆ princarg_I()

princarg_I ( phi)

Definition at line 30 of file ToolInstFreq.py.

30def princarg_I(phi):
31
32 phase = np.mod(phi + np.pi, -2*np.pi) + np.pi
33 return phase
Here is the caller graph for this function:

◆ ToolInstFreq()

ToolInstFreq ( X_complex,
iHopLength,
f_s )

computes instantaneous frequency utilizing phase of neighboring blocks of complex spectra

Parameters
X_complexcomplex spectrogram (dimension FFTLength X Observations)
iHopLengthhop length of spectrogram computation
f_ssample rate of audio data
Returns
f_I: instantaneous frequency (in Hz)

Definition at line 13 of file ToolInstFreq.py.

13def ToolInstFreq(X_complex, iHopLength, f_s):
14
15 # get phase
16 phi = np.angle(X_complex)
17
18 # phase offset
19 omega = np.pi * iHopLength / X_complex.shape[1] * np.arange(0, X_complex.shape[1])
20
21 # unwrapped difference
22 delta_phi = omega + princarg_I(phi[1, :] - phi[0, :] - omega)
23
24 # instantaneous frequency
25 f_I = delta_phi / iHopLength / (2*np.pi) * f_s
26
27 return f_I
28
29
Here is the call graph for this function: