Fix filter of demodulator of received radio signal

The filter was way too low. (only half of the total bandwidth)
The missing (filtered) high frequency component caused noisy signal.
Let's see how this fix changes the quality of received FM sound.
This commit is contained in:
Andreas Eversberg
2024-04-10 20:44:47 +02:00
parent e1a7791561
commit f294261285
3 changed files with 4 additions and 4 deletions

View File

@@ -127,7 +127,7 @@ void am_modulate_complex(am_mod_t *mod, sample_t *amplitude, uint8_t *power, int
mod->phase = phase; mod->phase = phase;
} }
/* init AM demodulator */ /* init AM demodulator, the bandwidth is the demodulated bandwidth (bandwidth of one side band) */
int am_demod_init(am_demod_t *demod, double samplerate, double offset, double bandwidth, double gain) int am_demod_init(am_demod_t *demod, double samplerate, double offset, double bandwidth, double gain)
{ {
memset(demod, 0, sizeof(*demod)); memset(demod, 0, sizeof(*demod));

View File

@@ -244,7 +244,7 @@ again:
mod->ramp = ramp; mod->ramp = ramp;
} }
/* init FM demodulator */ /* init FM demodulator, bandwidth is the 2 * (deviation + modulation) */
int fm_demod_init(fm_demod_t *demod, double samplerate, double offset, double bandwidth) int fm_demod_init(fm_demod_t *demod, double samplerate, double offset, double bandwidth)
{ {
if (!has_init) { if (!has_init) {

View File

@@ -482,9 +482,9 @@ void *sdr_open(int __attribute__((__unused__)) direction, const char __attribute
LOGP(DSDR, LOGL_DEBUG, "Frequency #%d: RX offset: %.6f MHz\n", c, rx_offset / 1e6); LOGP(DSDR, LOGL_DEBUG, "Frequency #%d: RX offset: %.6f MHz\n", c, rx_offset / 1e6);
sdr->chan[c].am = am[c]; sdr->chan[c].am = am[c];
if (am[c]) if (am[c])
rc = am_demod_init(&sdr->chan[c].am_demod, samplerate, rx_offset, bandwidth, 1.0 / modulation_index); rc = am_demod_init(&sdr->chan[c].am_demod, samplerate, rx_offset, bandwidth / 2.0, 1.0 / modulation_index); /* bandwidth is only one side band */
else else
rc = fm_demod_init(&sdr->chan[c].fm_demod, samplerate, rx_offset, bandwidth / 2.0); rc = fm_demod_init(&sdr->chan[c].fm_demod, samplerate, rx_offset, bandwidth); /* bandwidth are deviation and both side bands */
if (rc < 0) if (rc < 0)
goto error; goto error;
} }