RTS API Documentation
1.10.11
|
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, teletone_dtmf_detect_state_t::col_out, teletone_dtmf_detect_state_t::col_out2nd, teletone_dtmf_detect_state_t::current_digits, teletone_dtmf_detect_state_t::current_sample, teletone_dtmf_detect_state_t::detected_digits, teletone_dtmf_detect_state_t::digit, teletone_dtmf_detect_state_t::digit_hits, 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, teletone_dtmf_detect_state_t::dur, teletone_dtmf_detect_state_t::energy, teletone_goertzel_state_t::fac, goertzel_init(), GRID_FACTOR, teletone_dtmf_detect_state_t::hit1, teletone_dtmf_detect_state_t::hit2, teletone_dtmf_detect_state_t::hit3, teletone_dtmf_detect_state_t::lenergy, teletone_dtmf_detect_state_t::lost_digits, LOW_ENG, teletone_dtmf_detect_state_t::row_out, teletone_dtmf_detect_state_t::row_out2nd, teletone_goertzel_result, TELETONE_MAX_DTMF_DIGITS, TT_HIT_BEGIN, TT_HIT_END, TT_HIT_MIDDLE, teletone_goertzel_state_t::v2, teletone_goertzel_state_t::v3, ZC, and teletone_dtmf_detect_state_t::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 teletone_dtmf_detect_state_t::col_out, teletone_dtmf_detect_state_t::col_out2nd, teletone_dtmf_detect_state_t::current_sample, teletone_dtmf_detect_state_t::detected_digits, teletone_dtmf_detect_state_t::digit, dtmf_col, dtmf_row, teletone_dtmf_detect_state_t::dur, teletone_dtmf_detect_state_t::energy, teletone_detection_descriptor_t::fac, goertzel_init(), GRID_FACTOR, teletone_dtmf_detect_state_t::hit1, teletone_dtmf_detect_state_t::hit2, teletone_dtmf_detect_state_t::lost_digits, M_TWO_PI, teletone_dtmf_detect_state_t::row_out, and teletone_dtmf_detect_state_t::row_out2nd.
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 461 of file libteletone_detect.c.
References teletone_dtmf_detect_state_t::digit, teletone_dtmf_detect_state_t::dur, and teletone_dtmf_detect_state_t::zc.
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.
References teletone_goertzel_state_t::fac, teletone_goertzel_state_t::v2, and teletone_goertzel_state_t::v3.
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 teletone_multi_tone_t::current_sample, teletone_multi_tone_t::energy, teletone_goertzel_state_t::fac, goertzel_init(), teletone_multi_tone_t::gs, teletone_multi_tone_t::gs2, teletone_multi_tone_t::hit_factor, teletone_multi_tone_t::hits, teletone_multi_tone_t::min_samples, teletone_multi_tone_t::negative_factor, teletone_multi_tone_t::negatives, teletone_multi_tone_t::positive_factor, teletone_multi_tone_t::positives, teletone_multi_tone_t::tdd, teletone_goertzel_result, TELETONE_MAX_TONES, teletone_multi_tone_t::tone_count, teletone_multi_tone_t::total_samples, teletone_goertzel_state_t::v2, and teletone_goertzel_state_t::v3.
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 teletone_detection_descriptor_t::fac, teletone_tone_map_t::freqs, goertzel_init(), teletone_multi_tone_t::gs, teletone_multi_tone_t::gs2, teletone_multi_tone_t::hit_factor, M_TWO_PI, teletone_multi_tone_t::min_samples, teletone_multi_tone_t::negative_factor, teletone_multi_tone_t::positive_factor, teletone_multi_tone_t::sample_rate, teletone_multi_tone_t::tdd, TELETONE_MAX_TONES, and teletone_multi_tone_t::tone_count.
Referenced by switch_ivr_tone_detect_session().