FreeSWITCH API Documentation
1.7.0
|
Tone Detection Routines. More...
#include <libteletone.h>
Go to the source code of this file.
Data Structures | |
struct | teletone_goertzel_state_t |
A continer for the elements of a Goertzel Algorithm (The names are from his formula) More... | |
struct | teletone_dtmf_detect_state_t |
A container for a DTMF detection state. More... | |
struct | teletone_detection_descriptor_t |
An abstraction to store the coefficient of a tone frequency. More... | |
struct | teletone_multi_tone_t |
A container for a single multi-tone detection TELETONE_MAX_TONES dictates the maximum simultaneous tones that can be present in a multi-tone representation. More... | |
Macros | |
#define | FALSE 0 |
#define | TRUE (!FALSE) |
#define | DTMF_THRESHOLD 8.0e7 |
#define | DTMF_NORMAL_TWIST 6.3 /* 8dB */ |
#define | DTMF_REVERSE_TWIST 2.5 /* 4dB */ |
#define | DTMF_RELATIVE_PEAK_ROW 6.3 /* 8dB */ |
#define | DTMF_RELATIVE_PEAK_COL 6.3 /* 8dB */ |
#define | DTMF_2ND_HARMONIC_ROW 2.5 /* 4dB */ |
#define | DTMF_2ND_HARMONIC_COL 63.1 /* 18dB */ |
#define | GRID_FACTOR 4 |
#define | BLOCK_LEN 102 |
#define | M_TWO_PI 2.0*M_PI |
Enumerations | |
enum | teletone_hit_type_t { TT_HIT_NONE = 0, TT_HIT_BEGIN = 1, TT_HIT_MIDDLE = 2, TT_HIT_END = 3 } |
Functions | |
void | teletone_multi_tone_init (teletone_multi_tone_t *mt, teletone_tone_map_t *map) |
Initilize a multi-frequency tone detector. More... | |
int | teletone_multi_tone_detect (teletone_multi_tone_t *mt, int16_t sample_buffer[], int samples) |
Check a sample buffer for the presence of the mulit-frequency tone described by mt. More... | |
void | teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate) |
Initilize a DTMF detection state object. More... | |
teletone_hit_type_t | teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state, int16_t sample_buffer[], int samples) |
Check a sample buffer for the presence of DTMF digits. More... | |
int | teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state, char *buf, unsigned int *dur) |
retrieve any collected digits into a string buffer More... | |
void | teletone_goertzel_update (teletone_goertzel_state_t *goertzel_state, int16_t sample_buffer[], int samples) |
Step through the Goertzel Algorithm for each sample in a buffer. More... | |
Tone Detection Routines.
This module is responsible for tone detection specifics
Definition in file libteletone_detect.h.
#define BLOCK_LEN 102 |
Definition at line 134 of file libteletone_detect.h.
Referenced by teletone_dtmf_detect().
#define DTMF_2ND_HARMONIC_COL 63.1 /* 18dB */ |
Definition at line 132 of file libteletone_detect.h.
Referenced by teletone_dtmf_detect().
#define DTMF_2ND_HARMONIC_ROW 2.5 /* 4dB */ |
Definition at line 131 of file libteletone_detect.h.
Referenced by teletone_dtmf_detect().
#define DTMF_NORMAL_TWIST 6.3 /* 8dB */ |
Definition at line 127 of file libteletone_detect.h.
Referenced by teletone_dtmf_detect().
#define DTMF_RELATIVE_PEAK_COL 6.3 /* 8dB */ |
Definition at line 130 of file libteletone_detect.h.
Referenced by teletone_dtmf_detect().
#define DTMF_RELATIVE_PEAK_ROW 6.3 /* 8dB */ |
Definition at line 129 of file libteletone_detect.h.
Referenced by teletone_dtmf_detect().
#define DTMF_REVERSE_TWIST 2.5 /* 4dB */ |
Definition at line 128 of file libteletone_detect.h.
Referenced by teletone_dtmf_detect().
#define DTMF_THRESHOLD 8.0e7 |
Definition at line 126 of file libteletone_detect.h.
Referenced by teletone_dtmf_detect().
#define FALSE 0 |
Definition at line 108 of file libteletone_detect.h.
#define GRID_FACTOR 4 |
Definition at line 133 of file libteletone_detect.h.
Referenced by teletone_dtmf_detect(), and teletone_dtmf_detect_init().
#define M_TWO_PI 2.0*M_PI |
Definition at line 135 of file libteletone_detect.h.
Referenced by teletone_dtmf_detect_init(), and teletone_multi_tone_init().
#define TRUE (!FALSE) |
Definition at line 110 of file libteletone_detect.h.
enum teletone_hit_type_t |
Enumerator | |
---|---|
TT_HIT_NONE | |
TT_HIT_BEGIN | |
TT_HIT_MIDDLE | |
TT_HIT_END |
Definition at line 137 of file libteletone_detect.h.
teletone_hit_type_t teletone_dtmf_detect | ( | teletone_dtmf_detect_state_t * | dtmf_detect_state, |
int16_t | sample_buffer[], | ||
int | samples | ||
) |
Check a sample buffer for the presence of DTMF digits.
dtmf_detect_state | the detection state object to check |
sample_buffer | an array aof 16 bit signed linear samples |
samples | the number of samples present in sample_buffer |
Definition at line 307 of file libteletone_detect.c.
References BLOCK_LEN, DTMF_2ND_HARMONIC_COL, DTMF_2ND_HARMONIC_ROW, DTMF_NORMAL_TWIST, dtmf_positions, DTMF_RELATIVE_PEAK_COL, DTMF_RELATIVE_PEAK_ROW, DTMF_REVERSE_TWIST, DTMF_THRESHOLD, goertzel_init(), GRID_FACTOR, LOW_ENG, teletone_goertzel_result, TELETONE_MAX_DTMF_DIGITS, TT_HIT_BEGIN, TT_HIT_END, TT_HIT_MIDDLE, and ZC.
Referenced by inband_dtmf_callback().
void teletone_dtmf_detect_init | ( | teletone_dtmf_detect_state_t * | dtmf_detect_state, |
int | sample_rate | ||
) |
Initilize a DTMF detection state object.
dtmf_detect_state | the DTMF detection state to initilize |
sample_rate | the desired sample rate |
Definition at line 139 of file libteletone_detect.c.
References dtmf_col, dtmf_row, teletone_detection_descriptor_t::fac, goertzel_init(), GRID_FACTOR, and M_TWO_PI.
Referenced by switch_ivr_inband_dtmf_session().
int teletone_dtmf_get | ( | teletone_dtmf_detect_state_t * | dtmf_detect_state, |
char * | buf, | ||
unsigned int * | dur | ||
) |
retrieve any collected digits into a string buffer
dtmf_detect_state | the detection state object to check |
buf | the string buffer to write to |
max | the maximum length of buf |
Definition at line 462 of file libteletone_detect.c.
Referenced by inband_dtmf_callback().
void teletone_goertzel_update | ( | teletone_goertzel_state_t * | goertzel_state, |
int16_t | sample_buffer[], | ||
int | samples | ||
) |
Step through the Goertzel Algorithm for each sample in a buffer.
goertzel_state | the goertzel state to step the samples through |
sample_buffer | an array aof 16 bit signed linear samples |
samples | the number of samples present in sample_buffer |
Definition at line 120 of file libteletone_detect.c.
int teletone_multi_tone_detect | ( | teletone_multi_tone_t * | mt, |
int16_t | sample_buffer[], | ||
int | samples | ||
) |
Check a sample buffer for the presence of the mulit-frequency tone described by mt.
mt | the multi-frequency tone descriptor |
sample_buffer | an array aof 16 bit signed linear samples |
samples | the number of samples present in sample_buffer |
Definition at line 217 of file libteletone_detect.c.
References goertzel_init(), teletone_goertzel_result, and TELETONE_MAX_TONES.
Referenced by tone_detect_callback().
void teletone_multi_tone_init | ( | teletone_multi_tone_t * | mt, |
teletone_tone_map_t * | map | ||
) |
Initilize a multi-frequency tone detector.
mt | the multi-frequency tone descriptor |
map | a representation of the multi-frequency tone |
Definition at line 177 of file libteletone_detect.c.
References goertzel_init(), M_TWO_PI, and TELETONE_MAX_TONES.
Referenced by switch_ivr_tone_detect_session().