etWaveFormats Sample Program

TeleTools

This program is a learning tool to help understand windows wave audio and shows different methods to select and set the wave audio output format. Using etPlay and etRecord you have complete control over the audio format and can even use CODECS to play and record to formats that are not native to the device.

Click here for more information about working with wave files.

Requirements
Using This Sample Program
Download this Sample Program 
How this Sample Program Works
Source Code
Release Notes

Development Environment Technical Information
Telephony Hardware Technical Information

 

Requirements

  • TeleTools 3.7 (or 4.0 to use the name option)

  • A working TAPI telephony device

  • a sound card

Using This Sample Program

Select each radio button in the "Set WAVE format by.." frame to see what happens and how you can set the wave format by ID, Name, or by using a shortcut method that utilizes TeleTools wave format constants.

If you don't have version 4.0 or above of TeleTools, you won't be able to set the wave format by name, you will have to use one of the other methods.

With each method, the appropriate combobox will become enabled so that you can choose from the selected formats and watch the log as each property for that wave format is displayed. You will be able to see how to use the etPlay and etRecord source.format properties.

When you select the "play a sample wave" radio button, the last combobox will enable and show you a few sample wave files listed by their format. Select your sound card from the device dropdown combobox and click the play button. Try playing each file. Most sound cards can play almost anything, but a telephony device cannot.

Use the TeleScope etLine window to select a telephony device and make a call When the call is connected, select your device from the sample program device dropdown and play the test wave files again. You should hear them play over the phone line. If any wave formats give an error, it is because your device does not natively support that format. Most devices support only 8kHz,16Bit,Mono, but some devices support more than one format, or a different{ format. Dialogic cards support 11kHz,8Bit,Mono natively. But, you can check the "Codecs enabled" checkbock and click play again. If you have a codec, which is a piece of software that can translate wave formats on the fly, you will now be able to play that wave file. Keep in mind that it is always best to play and record in the format native to the device, but if you need to, the TeleTools "CodecsEnabled" property is there if you need it.

There are many pre- defined wave formats defined in the etTTConst.pas file. These are the first few wave file indices and the constants that refer:

to them, they start with 'w'
   Const wfCOUNT = 25
   Const wfUnknown = 0
   Const wfPCM08000M08 = 1
   Const wfPCM08000S08 = 2
   Const wfPCM08000M16 = 3
   Const wfPCM08000S16 = 4
   Const wfPCM11025M08 = 5
  ...

These are the first few wave file STRING constants to describe wave formats,
they start with 'S'
  Const SwfUnknown = "Unknown"
  Const SwfPCM08000M08 = "PCM 8,000 Hz, 8-bit, Mono"
  Const SwfPCM08000S08 = "PCM 8,000 Hz, 8-bit, Stereo"
  Const SwfPCM08000M16 = "PCM 8,000 Hz, 16-bit, Mono"
  Const SwfPCM08000S16 = "PCM 8,000 Hz, 16-bit, Stereo"
  Const SwfPCM11025M08 = "PCM 11,025 Hz, 8-bit, Mono"
   ...

 This makes it easy to get or set the wave format by name or ID.

Download this Sample Program

For Use TeleTools v3.7

File

Purpose

EXE Ready to run!
Borland Delphi 5,6,7 Source code and wave files
Visual Basic 5,6 Source code and wave files
Visual Basic .NET Source code and wave files
Tell us what you need Click here and tell us what you need!

 

How this Sample Program Works

This sample can set the wave file by setting the etRecord.SourceFormatID property to a TeleTools constant ID such as wfPCM22050M16 or by the SourceFormatName property with a name constant such as "PCM 8,000 Hz, 16-bit, Mono".  In addition, we can cycle through wfFirst to wfLast by starting with wfUnknown finishing with wfIMAADPCM08000M04.  We use the TeleTools wave format structure by creating a variable of type TWAVFORMATS to hold the formats.

In this sample, we also show how to get the version number of TeleTools to make sure the user has the correct version to use all the features of the sample with etRecord1.About.Version.

Lastly, we display the following properties so you can see how to use them:

  etPlay.Device.Name 
  etPlay.Device.ID 
  etPlay.Source.Format.Name
  etPlay.Source.Format.ID
  etPlay.Source.Format.AvgBytesPerSec
  etPlay.Source.Format.BitsPerSample
  etPlay.Source.Format.BlockAlign
  etPlay.Source.Format.Channels
  etPlay.Source.Format.SamplesPerSec
  etPlay.Source.Format.Tag 

Control

Description

ComboBoxWavFmtIDs Combobox to select wave formats using the TeleTools source.formatID property

ComboBoxWavFmtNames

Combobox to select the wave formats using the TeleTools source.formatName property

ComboBoxWavFmtShortCut Combobox to select wave formats using TeleTools constants
ComboBoxWavFile Combobox to select / change a test wave file to play from a list of 4 test wave files included with this sample
ComboBoxAudioDevs Combobox to select / change the wave audio output device from a list of all wave audio output devices on the machine
RadioGroupSetWavFmtMethod Radio button group to select which method to use to set wave formats
CheckBoxCodecsEnabled Enable and disable TeleTools use of codecs to convert wave file formats
ButtonPlay Button to play a test wave file to a sound card or telephony device
ButtonClear Button to clear the log
TextBox1 / Memo1  Texbox to display log status information
etPlay1 TeleTools etPlay wave component
etRecord1 TeleTools etRecord wave component

 

Event Handler Routine

Description

ComboBoxWavFmtIDsChange

Select a wave format using the etRecord.SourceFormatID property

ComboBoxWavFmtNamesChange Select a wave format using the erRecord.SourceFormatName property
ComboBoxWavFmtShortCutChange Select a wave format using the TeleTools wave constants
RadioGroupSetWavFmtMethodClick Select which method to use to set the wave format and enable the proper controls while disabling the rest
ButtonPlayClick Play a sample wave file with the etPlay component
ButtonClearClick Clear the log window
ButtonInfoClick ExceleTel information popup
etPlay1Done TeleTools etPlay OnDone event signifying the wave file has finished playing

 

Subroutine

Description

WriteWavInfo

Write the etPlay / etRecord wave source.format.properties to the log window

 

Release Notes

July 31, 2003

First Release