Functions | |
double | phaseret_firwin2gamma (LTFAT_FIRWIN win, ltfat_int gl) |
int | rtpghi_init (double gamma, ltfat_int W, ltfat_int a, ltfat_int M, double tol, int do_causal, rtpghi_state **p) |
int | rtpghi_reset (rtpghi_state *p) |
int | rtpghi_set_causal (rtpghi_state *p, int do_causal) |
int | rtpghi_execute (rtpghi_state *p, const LTFAT_REAL s[], LTFAT_COMPLEX c[]) |
int | rtpghi_done (rtpghi_state **p) |
int | rtpghioffline (const LTFAT_REAL s[], double gamma, ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M, double tol, int do_causal, LTFAT_COMPLEX c[]) |
The implementation follows paper [6]
The gamma parameter for a window \( g\) can be computed as
\[ \gamma = C_g (\mathit{gl})^2 \]
where gl is a window length.
FIR window | \( C_g \) |
---|---|
LTFAT_HANN, LTFAT_HANNING, NUTTALL10 | 0.25645 |
LTFAT_SQRTHANN, LTFAT_COSINE, LTFAT_SINE | 0.41532 |
LTFAT_HAMMING | 0.29794 |
LTFAT_NUTTALL01 | 0.29610 |
LTFAT_TRIA, LTFAT_TRIANGULAR, LTFAT_BARTLETT | 0.27561 |
LTFAT_SQRTTRIA | 0.48068 |
LTFAT_BLACKMAN | 0.17954 |
LTFAT_BLACKMAN2 | 0.18465 |
LTFAT_NUTTALL, LTFAT_NUTTALL12 | 0.12807 |
LTFAT_OGG, LTFAT_ITERSINE | 0.35744 |
LTFAT_NUTTALL20 | 0.14315 |
LTFAT_NUTTALL11 | 0.17001 |
LTFAT_NUTTALL02 | 0.18284 |
LTFAT_NUTTALL30 | 0.09895 |
LTFAT_NUTTALL21 | 0.11636 |
LTFAT_NUTTALL03 | 0.13369 |
For for a Gaussian window please see [6]
The Gaussian window will give the best result. LTFAT_BLACKMAN is also a good choice.
double phaseret_firwin2gamma | ( | LTFAT_FIRWIN | win, |
ltfat_int | gl | ||
) |
Computes gamma parameter given window type and its length
[in] | win | LTFAT Gabor window |
[in] | gt | Window length |
int rtpghi_done | ( | rtpghi_state ** | p | ) |
Destroy a RTPGHI Plan.
[in] | p | RTPGHI Plan |
phaseret_rtpghi_done_d(phaseret_rtpghi_state_d** p);
phaseret_rtpghi_done_s(phaseret_rtpghi_state_s** p);
int rtpghi_execute | ( | rtpghi_state * | p, |
const LTFAT_REAL | s[], | ||
LTFAT_COMPLEX | c[] | ||
) |
Execute RTPGHI plan for a single frame
The function is intedned to be called for consecutive stream of frames as it reuses some data from the previous frames stored in the plan.
if do_causal is enebled, c is not lagging, else c is lagging by one frame.
[in] | p | RTPGHI plan |
[in] | s | Target magnitude |
[out] | c | Reconstructed coefficients |
phaseret_rtpghi_execute_d(phaseret_rtpghi_state_d* p, const double s[], ltfat_complex_d c[]);
phaseret_rtpghi_execute_s(phaseret_rtpghi_state_s* p, const float s[], ltfat_complex_s c[]);
int rtpghi_init | ( | double | gamma, |
ltfat_int | W, | ||
ltfat_int | a, | ||
ltfat_int | M, | ||
double | tol, | ||
int | do_causal, | ||
rtpghi_state ** | p | ||
) |
Create a RTPGHI state.
[in] | gamma | Window-specific constant Cg*gl^2 |
[in] | W | Number of channels |
[in] | a | Hop size |
[in] | M | Number of frequency channels (FFT length) |
[in] | tol | Relative coefficient tolerance. |
[in] | do_causal | Zero delay (1) or 1 frame delay (0) version of the alg. |
[out] | p | RTPGHI state |
phaseret_rtpghi_init_d(double gamma, ltfat_int W, ltfat_int a, ltfat_int M, double tol, int do_causal, phaseret_rtpghi_state_d** p);
phaseret_rtpghi_init_s(double gamma, ltfat_int W, ltfat_int a, ltfat_int M, double tol, int do_causal, phaseret_rtpghi_state_s** p);
int rtpghi_reset | ( | rtpghi_state * | p | ) |
Reset RTPGHI state.
Resets RTPGHI state struct to the initial state
[out] | p | RTPGHI state |
phaseret_rtpghi_reset_d(phaseret_rtpghi_state_d* p);
phaseret_rtpghi_reset_s(phaseret_rtpghi_state_s* p);
int rtpghi_set_causal | ( | rtpghi_state * | p, |
int | do_causal | ||
) |
Change the version of the algorithm
Either to one-frame-delay version (do_causal==0) or to the no-delay version (do_causal anything else).
[in] | p | RTPGHI plan |
[in] | do_causal | Causal flag |
phaseret_rtpghi_set_causal_d(phaseret_rtpghi_state_d* p, int do_causal);
phaseret_rtpghi_set_causal_s(phaseret_rtpghi_state_s* p, int do_causal);
int rtpghioffline | ( | const LTFAT_REAL | s[], |
double | gamma, | ||
ltfat_int | L, | ||
ltfat_int | W, | ||
ltfat_int | a, | ||
ltfat_int | M, | ||
double | tol, | ||
int | do_causal, | ||
LTFAT_COMPLEX | c[] | ||
) |
Do RTPGHI for a complete magnitude spectrogram and compensate delay
This function just creates a plan, executes it for each col in s and c and destroys it.
[in] | s | Magnitude spectrogram M2 x N array |
[in] | gamma | Window-specific constant Cg*gl^2 |
[in] | L | Transform length (possibly zero-padded). |
[in] | W | Number of signal channels. |
[in] | a | Hop size |
[in] | M | FFT length, also length of all the windows |
[out] | c | Reconstructed coefficients M2 x N array |
phaseret_rtpghioffline_d(const double s[], double gamma, ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M, double tol, int do_causal, ltfat_complex_d c[]);
phaseret_rtpghioffline_s(const float s[], double gamma, ltfat_int L, ltfat_int W, ltfat_int a, ltfat_int M, double tol, int do_causal, ltfat_complex_s c[]);