Package com.tino1b2be.dtmf
Class DtmfDecoder
java.lang.Object
com.tino1b2be.dtmf.DtmfDecoder
Batch DTMF decoder: turn a buffer of PCM samples into a list of detected
DtmfTone instances.
DtmfDecoder is the batch half of the public API. Every overload
is a thin wrapper around DtmfDetector:
- null-check the inputs (Requirement 4.8, 17.1);
- normalise the sample format to
doubleviaSampleConverter(Requirements 4.5, 4.6, 4.7); - instantiate a fresh
DtmfDetector, wire anArrayList.add(E, java.lang.Object[], int)callback, feed the normalised samples, andflush; - return the list in non-decreasing
startSampleorder (Requirement 5.2).
Running batch decoding through the same push pipeline is how chunk
invariance (Requirement 6.7) becomes structural rather than tested-after-
the-fact: decode(B, cfg) and any chunking of B fed into a
fresh detector produce the same tones by construction.
The class is final with a private constructor; all entry points are static.
- Since:
- 2.0.0
-
Method Summary
Modifier and TypeMethodDescriptiondecode(double[] samples, DtmfConfig config) Decode adouble[]buffer of normalised PCM samples in[-1.0, 1.0].decode(float[] samples, DtmfConfig config) Decode afloat[]buffer of normalised samples in[-1.0, 1.0].decode(int[] samples, DtmfConfig config) Decode anint[]buffer of signed PCM32 samples.decode(short[] samples, DtmfConfig config) Decode ashort[]buffer of signed PCM16 samples.decodePcm24(int[] samples, DtmfConfig config) Decode anint[]buffer where each entry carries a signed PCM24 value in its low 24 bits.
-
Method Details
-
decode
Decode adouble[]buffer of normalised PCM samples in[-1.0, 1.0].- Parameters:
samples- PCM samples; non-nullconfig- detection configuration; non-null- Returns:
- the list of detected tones, in non-decreasing
startSampleorder - Throws:
NullPointerException- if either argument isnull
-
decode
Decode ashort[]buffer of signed PCM16 samples. Samples are normalised todoublevia division by32768.0(Requirement 4.5).- Parameters:
samples- PCM16 samples; non-nullconfig- detection configuration; non-null- Returns:
- the list of detected tones, in non-decreasing
startSampleorder - Throws:
NullPointerException- if either argument isnull
-
decode
Decode afloat[]buffer of normalised samples in[-1.0, 1.0]. Samples are widened todoublewithout scaling (Requirement 4.6).- Parameters:
samples- float samples; non-nullconfig- detection configuration; non-null- Returns:
- the list of detected tones, in non-decreasing
startSampleorder - Throws:
NullPointerException- if either argument isnull
-
decode
Decode anint[]buffer of signed PCM32 samples. Samples are normalised via division by2^31(Requirement 4.7).- Parameters:
samples- PCM32 samples; non-nullconfig- detection configuration; non-null- Returns:
- the list of detected tones, in non-decreasing
startSampleorder - Throws:
NullPointerException- if either argument isnull
-
decodePcm24
Decode anint[]buffer where each entry carries a signed PCM24 value in its low 24 bits. Helper for callers supplying packed PCM24 (Requirement 4.4).- Parameters:
samples- PCM24-in-int samples; non-nullconfig- detection configuration; non-null- Returns:
- the list of detected tones, in non-decreasing
startSampleorder - Throws:
NullPointerException- if either argument isnull
-