Mercurial > hg > qm-dsp
comparison dsp/phasevocoder/PhaseVocoder.cpp @ 346:58ba20857a5e
Tidy
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Thu, 03 Oct 2013 13:22:53 +0100 |
parents | 5eb9c2387108 |
children | fdaa63607c15 |
comparison
equal
deleted
inserted
replaced
345:04d134031a15 | 346:58ba20857a5e |
---|---|
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 void PhaseVocoder::unwrapPhases(double *theta, double *unwrapped) | 121 void PhaseVocoder::unwrapPhases(double *theta, double *unwrapped) |
122 { | 122 { |
123 cerr << "PhaseVocoder::unwrapPhases" << endl; | |
124 | |
125 //!!! if magnitude in a bin below a threshold, reset stored unwrapped phase angle for that bin | |
126 | |
127 for (int i = 0; i < m_n/2 + 1; ++i) { | 123 for (int i = 0; i < m_n/2 + 1; ++i) { |
128 | 124 |
129 double omega = (2 * M_PI * m_hop * i) / m_n; | 125 double omega = (2 * M_PI * m_hop * i) / m_n; |
130 double expected = m_phase[i] + omega; | 126 double expected = m_phase[i] + omega; |
131 double error = MathUtilities::princarg(theta[i] - expected); | 127 double error = MathUtilities::princarg(theta[i] - expected); |
132 | 128 |
133 unwrapped[i] = m_unwrapped[i] + omega + error; | 129 unwrapped[i] = m_unwrapped[i] + omega + error; |
134 | 130 |
135 cerr << "i = " << i << ", (" << m_real[i] << "," << m_imag[i] << "), instantaneous phase = " << theta[i] << ", prev phase = " << m_phase[i] << ", omega = " << omega << ", expected = " << expected << ", error = " << error << ", unwrapped = " << unwrapped[i] << endl; | |
136 | |
137 m_phase[i] = theta[i]; | 131 m_phase[i] = theta[i]; |
138 m_unwrapped[i] = unwrapped[i]; | 132 m_unwrapped[i] = unwrapped[i]; |
139 } | 133 } |
140 } | 134 } |
141 | 135 |