FAX CED (ANS, ANSam) tone detection

FAX CED (ANS, ANSam) tone detection


I am working on a project that requires me to detect FAX answer tone (CED) (2100Hz duration 2.6 to 4 seconds).

I created a tone using an online tone generator and fed raw PCM data to 'DetectTone' function multiple times, but it did not detect a tone. I tried initing USC_TD_Fxns with 'USC_ANSs_Fxns' and 'USC_ANSam_Fxns'.

Since this did not work, I did a loopback of the data generated by IPP 'GenerateTone' function the same way as above. I inited the tone generator with (USC_ANSam_Fxns) and generated USC_ANSam tone, with duration 10 and volume 1.

After feeding it to 'DetectTone' 36 times (160 bytes (10ms) of RAW PCM data) I was finally able to detect a FAX tone (USC_ANS). Frequency analysis in Audition shows this signal with 3800Hz peak.

I also tried FAXLab but IPP did not detect (CED) from this as well.

I am unable to understand why other tones at 2100Hz are not detected as valid CED. Please shed some light on this (How to create a CED tone so that IPP detects it, Limitations of IPP if any). If there is a detailed documentation (Not API docs) on what FAX tones are supported by IPP please point me to that as well.



10 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

3800 Hz was a mistake in my analysis, the peak is 2100 Hz only. Please ignore that.

I did more analysis, added some debug logs, found the following from DetectTone:

==== FAXLab 10ms CED =====

DetectTone - TONE_LEVEL = 80000000000.000000, res = 51386114048.000000

The condition to achieve is res > TONE_LEVEL, which is not the case, and so tone is not detected.

So I amplified the signal 13db boost and fed DetectTone again:

==== FAXLab 10ms Amplified CED =====

DetectTone - TONE_LEVEL = 80000000000.000000, res = 1105343021056.000000

With this the CED tone is detected.

Could any one explain the process of FAX tone detection and why TONE_LEVEL is #defined to that value?

Did further analysis, I fed a sample of 3.2X seconds from FAXLab and it worked for some parts of the sample.

There was some issue in the first test run of FAXLab and CED tone was not captured properly/fully and I fed that as input, hence IPP could not detect it (possibility is that I assumed and selected a sample where the calculated res value was not greater than TONE_LEVEL).

=== Update ===

Out of the 3.2 seconds (Which is a whole CED tone) data IPP detected valid tones only at 2.6 seconds and 2.9 seconds. This means two set of samples which account for 720 ms of ANS tone out of 3.2X seconds.

Not sure why this is happening. With this I cannot be sure if it is a FAX CED tone. Any Help?

An amplified CED tone from FAXLab makes IPP detect CED. Is there any parameters which I need to tweak or set for IPP to detect tones at lower levels?

There are no comments in the code nor is there any documentation suggesting the range of values accepted or what can be tweaked.

I am using: composerxe-2011.4.191

Package ID: l_ipp-samples_p_7.0.4.043

Package Contents: Intel(R) IPP Samples for Linux*

Hi Mathew,

Guess you are trying to use ANSam detector for ANS tone detection. ANS is not modulated while ANSam is amplitude modulated with 15 Hz sinusoid.

regards, Igor

I tried both detectors in my sample/test code.

//ToneType tt = eTONE_TYPE_ANS;
ToneType tt = eTONE_TYPE_ANS_AM;

    if (eTONE_TYPE_ANS == tt) 
        pUSC_TD = &USC_ANSs_Fxns;
        pUSC_TD = &USC_ANSam_Fxns;

With same input, ANSs does not detect anything, only ANSam is able to detect 'USC_ANS' but the calculated 'res' values using 'ippsGoertz_32f' are not reaching the desired value (TONE_LEVEL) for the samples if the FAX CED tone is not amplified.

From FAXLab Log (Just for reference of signal level, Not with same run, so this could be ANS or ANSam, which should not matter I suppose):

ans   9.8724 sec  T_30_AUTO_ANS_READY_TO_SEND_ANS_OR_ANSAM
ans   9.8724 sec  IS_EXHIBIT: alignc = 2750: ms to delay CED/ANSam start after a CNG end.
ans  10.3348 sec  STATUS_FALLING_FED
ans  10.3768 sec  STATUS_FALLING_TONE_A

ans  10.3769 sec  IS_TONALSIGNAL:
    IsTx = RECEIVE
    SigEnum = CNG
    dBmLevel = -36.98.
    msDelay = 0
    msStart = 9829
    msEnd = 10333
    msDuration = 504

ans  13.1267 sec  T_30_AUTO_ANS_TRANSMIT_ANS
ans  13.1267 sec  QUIET_TONE_DETECTOR_A
ans  13.1273 sec  IS_EXHIBIT: msnced = 3300: ms CED tone on period
ans  13.1274 sec  SET_MODEM_TDE_TO_TRUE
ans  13.1274 sec  SET_MODEM_RTS_TO_FALSE
ans  13.1274 sec  SET_MODEM_CEQ_TO_FALSE
ans  13.1274 sec  SET_MODEM_TXSQ_TO_TRUE
ans  13.1305 sec  NEWC_INTERRUPT_ACTIVE
ans  13.1306 sec  SET_MODEM_TXSQ_TO_FALSE

ans  13.1308 sec  IS_EXHIBIT: dbmced = 1200: dBm*-100 to tx FSK signal

ans  16.4394 sec  IS_TONALSIGNAL:
    SigEnum = CED
    dBmLevel = -12.00.
    msDelay = 0
    msStart = 13135
    msEnd = 16436
    msDuration = 3301

==== Update ====

More over (As I told above, I tried both algorithms):

DetectTone code for ANSam (usc_ansam.c) has the following code:

      if(res > 3000000.f) {
         *pDetectedToneID = USC_ANSam;
      } else {
         *pDetectedToneID = USC_ANS;

And DetectTone code ANSs (usc_ans_tones.c) has the following:

   if(toneRes != 0) {
      *pDetectedToneID = USC_slashANS;
   } else {
      *pDetectedToneID = USC_NoTone;

&USC_ANSs_Fxns is intended for tone detection with phase reversal and is not suitable for you. Regarding signal level - it is better to take a look into the standard, even so you can play with the constants in your code:

#define TONE_LEN 7200


if(res > 3000000.f) {

regards, Igor

In general, most tones are generated from fax machines at -10 to -20 dBm. Some tones are sensitive up to -43dBm as per recommendations. In practical implementation, it may be sufficient to cater to power levels up to -20 to -24 dBm as a default with the configuration to work up to the lowest levels as per the recommendations.

A tutorial says this. Analysis using FAXLab CED tone shows the following:

Normal (Few detections - adds up to 1080 ms) - Average RMS Power is -15.27 dB

Amplified (Works - adds up to 3240 ms) - Average RMS Power is -2.27 dB

I have tried adjusting TONE_LEVEL. Making it lower improves detection but still it does not make up a full tone of 3.3 seconds.

I think adjusting TONE_LEN will only change the granularity of detection, time would still be the same if we add up all the detections.


I tried a few more things and I observed a better result:

I compiled the sample application from IPP and fed it the tone file. I observed that framesize is set to 410 bytes which is ANS_DETECTOR_FRAME_SIZE = (ANS_DETECTOR_FRAME_SIZE_SAMPLES * 2).

With this code I was able to detect USC_ANS three full times (reaching TONE_LEN) which means 2767.5 ms and there could be some additional time that might not have reached TONE_LEN)

I was getting samples at 10ms from my code i.e. 160 bytes and this was set as framesize and was being fed into the detector. I has also adjusted ANS_DETECTOR_FRAME_SIZE_SAMPLES to 80 (in another trial) but that did not help either.

I guess IPP needs 410 bytes as input data for FAX tone detection to work properly. Please add more documentation for such things (I am still not sure if I can modify these values, what values I can change or what I should not touch etc.).

Please correct me if I am wrong because my conclusion is based on many trial and error runs.

==== Update ====

Made ANS_DETECTOR_FRAME_SIZE_SAMPLES = 160 and fed 320 bytes (20 ms), this also works, whereas 80, 160 combination did not work. So there is some kind of minimum amount of input data needed for DFT to get it right (more than 10 ms of data maybe).

I wish someone could clarify this.

Is IPP capable of detecting /ANSam CED tone? The modified answer tone (ANSam) with phase reversals (/ANSam) is a sine wave signal at 2100 ± 1 Hz with phase reversals at intervals of 450 ± 25 ms, amplitude - modulated by a sine wave at 15 ± 0.1 Hz.

Also can IPP detect V.21 preamle tone?

Login to leave a comment.