1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-07-25 19:44:12 -04:00

Corrected Highpass and Bandpass filters normalization. Implements #642

This commit is contained in:
f4exb
2020-09-21 23:51:45 +02:00
parent 71f96aded6
commit ae60808de8
8 changed files with 82 additions and 73 deletions
+6 -9
View File
@@ -134,14 +134,11 @@ void NFMModSource::modulateSample()
calculateLevel(t);
m_audioBufferFill++;
if (m_settings.m_ctcssOn)
{
m_modPhasor += (m_settings.m_fmDeviation / (float) m_audioSampleRate) * (0.85f * m_bandpass.filter(t) + 0.15f * 189.0f * m_ctcssNco.next()) * (M_PI / 189.0f);
}
else
{
// 378 = 302 * 1.25; 302 = number of filter taps (established experimentally) and 189 = 378/2 for 2*PI
m_modPhasor += (m_settings.m_fmDeviation / (float) m_audioSampleRate) * m_bandpass.filter(t) * (M_PI / 189.0f);
// 0.625 = 1/1.25 (heuristic)
if (m_settings.m_ctcssOn) {
m_modPhasor += (m_settings.m_fmDeviation / (float) m_audioSampleRate) * (0.85f * m_bandpass.filter(t) + 0.15f * 0.625f * m_ctcssNco.next()) * (M_PI / 0.625f);
} else {
m_modPhasor += (m_settings.m_fmDeviation / (float) m_audioSampleRate) * m_bandpass.filter(t) * (M_PI / 0.625f);
}
// limit phasor range to ]-pi,pi]
@@ -368,4 +365,4 @@ void NFMModSource::applyChannelSettings(int channelSampleRate, int channelFreque
m_channelSampleRate = channelSampleRate;
m_channelFrequencyOffset = channelFrequencyOffset;
}
}