man3/AFTonePair.3

#

    AFTonePair(3)							AFTonePair(3)

    NAME
      AFTonePair - generate	a ULAW tone pair

    SYNTAX
      #include <AF/AFUtils.h>

      extern void AFTonePair(double	f1, double dBgain1,
    					  double f2, double dBgain2,
    					  int gainramp,
    					  unsigned char	*buffer, int length);

    DESCRIPTION
      AFTonePair is	a subroutine which is suitable for generating ringback,	busy,
      dialtones, and other telecommunications sounds represented by	pairs of
      tones	at given frequencies and power levels.

    ARGUMENTS

      f1   are the frequencies of the two tones.  The sample rate is known to be
           8000 Hz,	so the tone frequencies	must be	in the range 0-4000Hz.

      dBgain1
           are the power levels of the two tones.  These are values	relative to
           "0 dBm" or the digital milliwatt, which in turn is defined to be	3.16
           dB below	the digital clipping level, where signals distort.

      gainramp
           is the number of	samples	over which the tones reach their full ampli-
           tude.  At the beginning of the block, the signal	will ramp linearly up
           to full power over so many samples.  This tends to make the signals
           sound cleaner and reduces frequency splatter.  At the end of the
           block, the signals will ramp down to silence over the same period.

      buffer
           is a pointer to the signal buffer that will be filled in	by
           AFTonePair.

      length
           is the length of	the block desired.

    EXAMPLES
      Typical usage	is:

      unsigned char	busytone[4000];
      /* fill block	with 1/2 second	of a busy signal */
      AFTonePair(480.0, -12.0, 620.0, -12.0, 24, busytone, 4000);
      /* the parameters for	other tones are:
       *  ringing  440, -19, 480, -19
       *  busy     480, -12, 620, -12
       *  dialtone 350, -13, 440, -13
       */

    SEE ALSO
      AFDialPhone(3)

    BUGS
      If you encounter a reproducible bug, please submit a problem report to
      (af-bugs@crl.dec.com).

    COPYRIGHT
      Copyright 1990-1994, Digital Equipment Corporation.
      See AF(1) for	a full statement of rights and permissions.

    AUTHORS
      Larry	Stewart, Digital Cambridge Research Lab