Use notch filter to filter 2600 Hz out of ringback/anouncement
This commit is contained in:
parent
480179541f
commit
72a9a666a2
|
@ -113,7 +113,8 @@ int dsp_init_inst(dsp_t *dsp, void *priv, const char *name, double samplerate, i
|
||||||
/* notch filter */
|
/* notch filter */
|
||||||
if (notch) {
|
if (notch) {
|
||||||
dsp->notch = 1;
|
dsp->notch = 1;
|
||||||
iir_notch_init(&dsp->notch_filter, notch, (int)dsp->samplerate, 1, 4);
|
iir_notch_init(&dsp->notch_in_filter, notch, (int)dsp->samplerate, 1, 4.0);
|
||||||
|
iir_notch_init(&dsp->notch_out_filter, notch, (int)dsp->samplerate, 1, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -393,7 +394,7 @@ static void detect_tones(dsp_t *dsp, sample_t *samples, sample_t **levels_square
|
||||||
/* l is the number of samples required to mute for this interval of one milliseconds */
|
/* l is the number of samples required to mute for this interval of one milliseconds */
|
||||||
l = (dsp->ms_count < s + 1) ? dsp->ms_count : s + 1;
|
l = (dsp->ms_count < s + 1) ? dsp->ms_count : s + 1;
|
||||||
if (dsp->notch)
|
if (dsp->notch)
|
||||||
iir_process(&dsp->notch_filter, samples + s + 1 - l, l);
|
iir_process(&dsp->notch_in_filter, samples + s + 1 - l, l);
|
||||||
else
|
else
|
||||||
memset(samples + s + 1 - l, 0, l * sizeof(*samples));
|
memset(samples + s + 1 - l, 0, l * sizeof(*samples));
|
||||||
}
|
}
|
||||||
|
@ -575,7 +576,7 @@ static void detect_tones(dsp_t *dsp, sample_t *samples, sample_t **levels_square
|
||||||
/* l is the number of samples that are left */
|
/* l is the number of samples that are left */
|
||||||
l = (dsp->ms_count < s) ? dsp->ms_count : s;
|
l = (dsp->ms_count < s) ? dsp->ms_count : s;
|
||||||
if (dsp->notch)
|
if (dsp->notch)
|
||||||
iir_process(&dsp->notch_filter, samples + s - l, l);
|
iir_process(&dsp->notch_in_filter, samples + s - l, l);
|
||||||
else
|
else
|
||||||
memset(samples + s - l, 0, l * sizeof(*samples));
|
memset(samples + s - l, 0, l * sizeof(*samples));
|
||||||
}
|
}
|
||||||
|
@ -613,9 +614,14 @@ static void process_audio(dsp_t *dsp_a, dsp_t *dsp_b, int length)
|
||||||
dsp_b->sit_count = sit_play(samples[1], dsp_b->sit_count, length);
|
dsp_b->sit_count = sit_play(samples[1], dsp_b->sit_count, length);
|
||||||
|
|
||||||
/* modulate tone/digit. if no tone has to be played (or it stopped), count is less than length */
|
/* modulate tone/digit. if no tone has to be played (or it stopped), count is less than length */
|
||||||
|
/* apply notch filter when tone 'B' (2600 Hz) is on. */
|
||||||
count1 = assemble_tones(dsp_a, mask, length);
|
count1 = assemble_tones(dsp_a, mask, length);
|
||||||
|
if (dsp_a->tone_transparent && dsp_a->tone == 'B' && dsp_a->notch)
|
||||||
|
iir_process(&dsp_a->notch_out_filter, samples[0], count1);
|
||||||
mf_mod(dsp_a->mf_mod, mask, samples[0], count1, dsp_a->tone_transparent);
|
mf_mod(dsp_a->mf_mod, mask, samples[0], count1, dsp_a->tone_transparent);
|
||||||
count2 = assemble_tones(dsp_b, mask, length);
|
count2 = assemble_tones(dsp_b, mask, length);
|
||||||
|
if (dsp_b->tone_transparent && dsp_b->tone == 'B' && dsp_b->notch)
|
||||||
|
iir_process(&dsp_b->notch_out_filter, samples[1], count2);
|
||||||
mf_mod(dsp_b->mf_mod, mask, samples[1], count2, dsp_b->tone_transparent);
|
mf_mod(dsp_b->mf_mod, mask, samples[1], count2, dsp_b->tone_transparent);
|
||||||
|
|
||||||
/* ! here is the bridge from a to b and from b to a ! */
|
/* ! here is the bridge from a to b and from b to a ! */
|
||||||
|
|
|
@ -56,7 +56,8 @@ typedef struct dsp {
|
||||||
int crosstalk; /* mix crosstalk from TX to RX */
|
int crosstalk; /* mix crosstalk from TX to RX */
|
||||||
int comfort_noise; /* add comfort noise before answer and after disconnect */
|
int comfort_noise; /* add comfort noise before answer and after disconnect */
|
||||||
int notch;
|
int notch;
|
||||||
iir_filter_t notch_filter; /* remove 2600 Hz */
|
iir_filter_t notch_in_filter; /* remove 2600 Hz from trunk */
|
||||||
|
iir_filter_t notch_out_filter; /* remove 2600 Hz to trunk */
|
||||||
|
|
||||||
/* osmo-CC */
|
/* osmo-CC */
|
||||||
uint32_t cc_callref; /* ref to CC call */
|
uint32_t cc_callref; /* ref to CC call */
|
||||||
|
|
Loading…
Reference in New Issue