MCPcopy Create free account
hub / github.com/andrewreeman/SpectralSuite / phaseDiff2Hertz

Method phaseDiff2Hertz

shared/PhaseVocoder.cpp:41–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41void PhaseVocoder::phaseDiff2Hertz(PolarVector &inOut) {
42
43 /* For each bin the difference in phase will be related to the strongest frequency content of that bin.
44 If there is no difference then the true frequency will be the center frequency of the bin. */
45 float fac = (float)m_sRate / ((float)m_hopsize * (float)TWOPI ); // radians to hertz factor.
46 float scl= (float)TWOPI * ( (float)m_hopsize / float(m_fftSize) ); // Size in radians of the hopsize.
47
48 for(size_t n = 0; n < (size_t)m_halfSize; ++n){
49 float phi = inOut[n].m_phase;
50 float delta = phi - phaseBuffer->prevPhase[n];
51
52 phaseBuffer->prevPhase[n] = phi;
53 utilities::wrap_twopi(delta);
54 //n * scale will be the correct value in radians for the freq. adding the delta difference
55 m_polarOut[n].m_phase = (delta + float(n)*scl)*fac;
56 }
57}
58
59void PhaseVocoder::hertzDiff2Phase(PolarVector& inOut){
60 // Find the difference between the new value in hertz (post spec process) from the center bin.

Callers

nothing calls this directly

Calls 1

wrap_twopiFunction · 0.85

Tested by

no test coverage detected