Mercurial > hg > sonic-visualiser
comparison audioio/PhaseVocoderTimeStretcher.cpp @ 78:9918c8a3f904
* Omit translucent blue fill for selection rectangles that are superimposed
over layers that use colours for meaningful purposes such as the spectrogram
(CHARM change request)
author | Chris Cannam |
---|---|
date | Fri, 24 Nov 2006 16:56:15 +0000 |
parents | bedc7517b6e8 |
children | f3516e520652 |
comparison
equal
deleted
inserted
replaced
77:bedc7517b6e8 | 78:9918c8a3f904 |
---|---|
569 float phase = princargf(atan2f(m_freq[c][i][1], m_freq[c][i][0])); | 569 float phase = princargf(atan2f(m_freq[c][i][1], m_freq[c][i][0])); |
570 float adjustedPhase = phase; | 570 float adjustedPhase = phase; |
571 | 571 |
572 if (!unchanged) { | 572 if (!unchanged) { |
573 | 573 |
574 float mag = sqrtf(m_freq[c][i][0] * m_freq[c][i][0] + | |
575 m_freq[c][i][1] * m_freq[c][i][1]); | |
576 | |
577 float omega = (2 * M_PI * m_n1 * i) / m_wlen; | 574 float omega = (2 * M_PI * m_n1 * i) / m_wlen; |
578 | 575 |
579 float expectedPhase = m_prevPhase[c][i] + omega; | 576 float expectedPhase = m_prevPhase[c][i] + omega; |
580 | 577 |
581 float phaseError = princargf(phase - expectedPhase); | 578 float phaseError = princargf(phase - expectedPhase); |
583 float phaseIncrement = (omega + phaseError) / m_n1; | 580 float phaseIncrement = (omega + phaseError) / m_n1; |
584 | 581 |
585 adjustedPhase = m_prevAdjustedPhase[c][i] + | 582 adjustedPhase = m_prevAdjustedPhase[c][i] + |
586 lastStep * phaseIncrement; | 583 lastStep * phaseIncrement; |
587 | 584 |
585 float mag = sqrtf(m_freq[c][i][0] * m_freq[c][i][0] + | |
586 m_freq[c][i][1] * m_freq[c][i][1]); | |
587 | |
588 float real = mag * cosf(adjustedPhase); | 588 float real = mag * cosf(adjustedPhase); |
589 float imag = mag * sinf(adjustedPhase); | 589 float imag = mag * sinf(adjustedPhase); |
590 m_freq[c][i][0] = real; | 590 m_freq[c][i][0] = real; |
591 m_freq[c][i][1] = imag; | 591 m_freq[c][i][1] = imag; |
592 } | 592 } |