[Asterisk-Dev] zt_tone_def explanation
Steve Underwood
steveu at coppice.org
Wed Dec 15 17:37:59 MST 2004
Those are the parameters for two 2nd order IIR resonators, which have
been tuned to generate the frequencies required. That bit of code
generates the parameters from the required frequency, in Hertz. Another
bit of code in the same files generates the sine waves using those
parameters. The same method is used for DTMF and supervisory tone
generation. Resonators can have stability problems, but these have been
thoroughly tested and are robust, even with generating long term tones.
Regards,
Steve
el Flynn wrote:
> hi there,
>
> in the zaptel.h file, i found the following bit of code:
>
> Calculate the next 6 factors using the following equations:
> l = <level in dbm>, f1 = <freq1>, f2 = <freq2>
> gain = pow(10.0, (l - 3.14) / 20.0) * 65536.0 / 2.0;
>
> // Frequency factor 1
> fac_1 = 2.0 * cos(2.0 * M_PI * (f1/8000.0)) * 32768.0;
> // Last previous two samples
> init_v2_1 = sin(-4.0 * M_PI * (f1/8000.0)) * gain;
> init_v3_1 = sin(-2.0 * M_PI * (f1/8000.0)) * gain;
>
> // Frequency factor 2
> fac_2 = 2.0 * cos(2.0 * M_PI * (f2/8000.0)) * 32768.0;
> // Last previous two samples
> init_v2_2 = sin(-4.0 * M_PI * (f2/8000.0)) * gain;
> init_v3_2 = sin(-2.0 * M_PI * (f2/8000.0)) * gain;
>
> if i'm not mistaken, this has something to do with generating DTMF
> tones. can someone give more insight on what the init_v2_1, init_v3_1,
> init_v2_2, init_v3_2 variables are used for?
>
> and also perhaps what this bit of code does? I think it's used in
> tonezone.c
>
> thanks a bunch.
>
> Flynn
>
> _______________________________________________
> Asterisk-Dev mailing list
> Asterisk-Dev at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-dev
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-dev
>
More information about the asterisk-dev
mailing list