Class FrequencyBins
This internal helper holds the eight DTMF frequencies (four in the low
group, four in the high group) and the 4×4 key matrix mapping
(lowIndex, highIndex) to the symbol for that tone pair.
The detector uses ALL_EIGHT to construct its
GoertzelBank and indexes peaks via keyFor(int, int). The
generator uses LOW_GROUP and HIGH_GROUP to look up the
(lowHz, highHz) pair for a given key symbol.
The numeric values are the Q.23 nominal frequencies and are deliberately
exposed as double so Goertzel coefficient computation is free of
implicit int-to-double widening.
Although the type is public so the public API classes in the
sibling package com.tino1b2be.dtmf (generator, detector, decoder)
can reach it, the convention is that com.tino1b2be.dtmf.internal.*
is not part of the published API.
- Since:
- 2.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final double[]The eight DTMF frequencies in a single array, ordered asLOW_GROUP ∥ HIGH_GROUP.static final double[]High-group DTMF frequencies in Hz, indexed 0..3.static final char[][]The 4×4 key matrix:KEY_MATRIX[lowIndex][highIndex]is the DTMF symbol for the tone pair(LOW_GROUP[lowIndex], HIGH_GROUP[highIndex]).static final double[]Low-group DTMF frequencies in Hz, indexed 0..3. -
Method Summary
Modifier and TypeMethodDescriptionstatic double[]frequenciesFor(char key) Look up the(lowHz, highHz)frequency pair for a DTMF key symbol.static charkeyFor(int lowIndex, int highIndex) Look up the DTMF symbol for the given low-group / high-group peak indices.
-
Field Details
-
LOW_GROUP
public static final double[] LOW_GROUPLow-group DTMF frequencies in Hz, indexed 0..3. Matches Q.23: 697, 770, 852, 941 Hz. -
HIGH_GROUP
public static final double[] HIGH_GROUPHigh-group DTMF frequencies in Hz, indexed 0..3. Matches Q.23: 1209, 1336, 1477, 1633 Hz. -
ALL_EIGHT
public static final double[] ALL_EIGHTThe eight DTMF frequencies in a single array, ordered asLOW_GROUP ∥ HIGH_GROUP. Convenient for constructing aGoertzelBankwith one filter per DTMF frequency. -
KEY_MATRIX
public static final char[][] KEY_MATRIXThe 4×4 key matrix:KEY_MATRIX[lowIndex][highIndex]is the DTMF symbol for the tone pair(LOW_GROUP[lowIndex], HIGH_GROUP[highIndex]).1209 1336 1477 1633 697 Hz 1 2 3 A 770 Hz 4 5 6 B 852 Hz 7 8 9 C 941 Hz * 0 # D
-
-
Method Details
-
keyFor
public static char keyFor(int lowIndex, int highIndex) Look up the DTMF symbol for the given low-group / high-group peak indices.- Parameters:
lowIndex- index intoLOW_GROUP; must be in[0, 4)highIndex- index intoHIGH_GROUP; must be in[0, 4)- Returns:
- the DTMF symbol for
(LOW_GROUP[lowIndex], HIGH_GROUP[highIndex]) - Throws:
ArrayIndexOutOfBoundsException- if either index is outside[0, 4)
-
frequenciesFor
public static double[] frequenciesFor(char key) Look up the(lowHz, highHz)frequency pair for a DTMF key symbol.- Parameters:
key- the DTMF symbol; must be one of'0'..'9','A'..'D','*', or'#'- Returns:
- a two-element array
[lowHz, highHz]with the Q.23 nominal frequencies for that key - Throws:
IllegalArgumentException- ifkeyis not in the accepted set
-