[Asterisk-Dev] zt_tone_def explanation
el Flynn
el_flynn at lanvik-icu.com
Mon Dec 13 20:09:15 MST 2004
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
More information about the asterisk-dev
mailing list