&RQYHUWLQJ:DYH$XGLR)LOHV %URRNWURXW $SSOLFDWLRQ1RWH
Conveting Wave Audio Files, Pat Numbe 00-00-3504, Revision 1.10, June 1999 Copyight by Booktout Technology, Inc. This manual is copyighted and all ights ae eseved by Booktout Technology, Inc. This poduct may not, in whole o in pat, be copied, photocopied, epoduced, tanslated, o educed to any electonic medium o machine eadable fom without pio consent, in witing, fom Booktout Technology, Inc. Infomation contained in this document is subject to change without notice. Pinted in the United States of Ameica. 7UDGHPDUNV All tademaks identified by the o symbol ae tademaks o egisteed tademaks, espectively, of Booktout Technology, Inc., fomely Lucent Technologies Compute Telephony Poducts, fomely Rhetoex. MVIP is a tademak of Go-MVIP, Inc. Windows NT is a tademak of Micosoft Copoation. Windows is a egisteed tademak of Micosoft Copoation. Othe company o poduct names mentioned heein may be tademaks o egisteed tademaks of thei espective companies. Booktout Technology, Inc., 151 Albight Way, Los Gatos, Califonia 95032. Telephone (408) 370-0881 Fax (408) 370-1171 Sales (408) 370-0881, ext. 1 Technical Suppot (408) 874-4040 Web Site www.booktout.com Euopean office: Centennial Cout, Easthampstead Road, Backnell, Beks RG12 1YQ, England Telephone +44-1344-380 280 Fax +44-1344-380 288 Technical Suppot +44-1344-380 222
2YHUYLHZ 0DQDJHPHQW6XPPDU\,QWHQGHG8VH Booktout has two utilities fo Wave audio file convesion. The fist is named lin2wav.exe and convets the Linea audio fomat to the Wave fomat. The othe is named wav2lin.exe and convets Wave files to the Linea audio fomat. This package illustates the Booktout platfom utilities fo conveting between Wave and Linea audio fomats.
,QWURGXFWLRQ Many PC uses now make ecodings with multimedia tools, and Wave is one of the most popula audio fomats. The Wave convesion utilities wee developed fo uses to ceate and edit a Wave file with a tool of choice, and then convet that file to a fomat ecognized by the RDSP boad. The Wave convesion utilities will not povide a solution fo evey vaiant of the Wave fomat, but they do demonstate one method of pefoming the convesion. :DYH)RUPDW The Wave fomat is one of many file fomats designed to epesent digitized sound. It was ceated by Micosoft specifically fo use with the Micosoft Windows opeating system. This audio fomat is now quite popula thoughout the pesonal compute industy. Unlike Linea files that use a aw-data fomat with fixed paametes, the Wave audio fomat includes a heade block. This heade defines the settings of the subsequent audio data and pecedes the audio data in the audio file. Because file extensions unde DOS ae esticted to thee chaactes, most Wave sound files maintain the WAV extension. )RUPDWV Uses should be familia with the utilities, Expand and Compess, distibuted with the RDSP dive. The audio fomats suppoted by these two utilities ae the same fomats suppoted by the RDSP poduct line. These fomats include: 24 Kbit/sec ADPCM 32 Kbit/sec ADPCM Oki 24 Kbit/sec ADPCM Oki 32 Kbit/sec ADPCM µ-law PCM Linea Anothe utility, named VEdit, allows the use to edit voice files though the RDSP boad. With VEdit, you must use Linea files. Fotunately, Expand and Compess will allow you to convet files between the Linea fomat and any of the othe audio fomats. This %URRNWURXW$SSOLFDWLRQ1RWH
,QWURGXFWLRQ &RQYHUVLRQ3URFHVV $XGLR)LOH&KDUDFWHULVWLFV &KDQQHOV %LWV3HU6DPSOH convesion pocess is not mandatoy fo an application, because all of the voice fomats above ae diectly suppoted within the RDSP pogamming inteface. The OLQZDYutility ceates a file with a standad Wave heade block and then adds the aw data of the Linea file. Convesely, wav2lin discads the heade block of the Wave file and places its data segment into a Linea file. Fo both utilities, some intemediate data convesion may take place depending on which vaiant of the Wave fomat is used. The following topics descibe some impotant chaacteistics of an audio data file. These paametes specifically elate to the analog-to-digital convesion at ecod time, but they ae also cucial fo pope playback. The discussion below should help to povide a bette undestanding of the Wave convesion utilities. An audio file caies data fo eithe one o two channels. The moe familia teminology fo these two file types is monophonic and steeophonic. The Wave convesion utilities wok with monophonic files only, since analog telephone lines tansmit a single channel. Since data samples can be pocessed at diffeent bit sizes, it is impotant to detemine the numbe of bits pe sample. Audio files, like sound cads, ae geneally classified as 8-bit o 16-bit. Howeve, this does not necessaily mean that you hadwae is esticted to that bit size, since 16-bit sound boads usually handle both 16-bit and 8-bit fomats. The Wave convesion utilities can wok with eithe 8-bit o 16-bit fomats. &RQYHUWLQJ:DYH$XGLR)LOHV
6DPSOLQJ5DWH This is a value that measues the samples pe second and is geneally expessed in hetz. Common ates fo sound files include 8000 Hz (telephony quality), 11025 Hz, 22050 Hz, and 44100 Hz (CD quality). A ate of 8000 Hz is vey common fo telephony applications and is the standad used by Booktout. The Booktout Wave convesion utilities can wok only with files ecoded using an 8000 Hz sampling ate. %URRNWURXW$SSOLFDWLRQ1RWH
8WLOLW\2SHUDWLRQ 8WLOLW\2SHUDWLRQ *HWWLQJ6WDUWHG 6\QWD[ If you ae eading this application note, you pobably aleady have a sound cad fo ecoding and playing Wave files, and an RDSP boad fo unning voice applications. Howeve, to use the Wave convesion utilities, all you need is a PC with the DOS opeating system. Along with the Wave convesion utilities, some othe tools may be helpful. Expand and Compess allow you to convet files between the fomats diectly suppoted by the RDSP boad. VEdit pemits you to ecod, play, o edit a file in Linea fomat. &RQYHUVLRQ To obtain a syntax desciption, the use can ente the name of the utility without aguments at the DOS pompt. The pogams equie both input and output file names on the command line, with the fist agument defining the input name and the second agument defining the output name. The two utilities use the following syntax. LIN2WAV <Linea_file> <Wave_file> WAV2LIN <Wave_file> <Linea_file> /,1:$9/LQHDUWR:DYH&RQYHUVLRQ 1. Obtain you Linea file. If you Linea file is not pe-ecoded, then you can ceate it using the VEdit pogam though the RDSP. 2. Convet the Linea file to Wave fomat with /,1:$9. Fo example, if the name of you Linea file is myfile.lin and you want a destination Wave file named myfile.wav, then you would ente the following command: /,1:$90<),/(/,10<),/(:$9 3. If the convesion ends nomally, the esulting Wave file is eady fo use with you Wave pogams and utilities. &RQYHUWLQJ:DYH$XGLR)LOHV
:$9/,1:DYHWR/LQHDU&RQYHUVLRQ 1. Obtain you Wave file. If you ae ecoding you own Wave file, then be sue to use an 8000 Hz sampling ate. Fo some available utilities that will ecod 8K files, see the efeence section at the end of this document. 2. Convet the Wave file to Linea fomat with WAV2LIN. If the name of you Wave file is myfile.wav and you want a destination Linea file named myfile.lin, then you would ente the following command: :$9/,10<),/(:$90<),/(/,1 3. The utility eads the Wave heade and decides if it can pocess the file. If the convesion ends without an eo message, the esulting Linea file can be played using Booktout poducts. %URRNWURXW$SSOLFDWLRQ1RWH
6DPSOH'HVFULSWLRQDQG5HTXLUHPHQWV 6DPSOH'HVFULSWLRQDQG5HTXLUHPHQWV )HDWXUHV /,1:$9(;( This utility will convet a Linea file to the Wave fomat. The pogam allows the use to choose a convesion to 8-bit o 16-bit Wave fomat. The use will ente both the input and output file names on the command line. LIN2WAV.EXE :$9/,1(;( This utility will convet 8-bit o 16-bit Wave files to the Linea fomat. The pogam eads the heade infomation of the input Wave file and automatically decides if the file can be pocessed. The use will ente both the input and output file names on the command line: WAV2LIN.EXE This utility will convet 8-bit o 16-bit Wave files to the Linea fomat. The pogam eads the heade infomation of the input Wave file and automatically decides if the file can be pocessed. The use will ente both the input and output file names on the command line. /LPLWDWLRQV Both utilities suppot only single-channel (monophonic) Wave files. The Wave fomat must maintain 8 o 16 bits pe sample. The sampling ate must be 8000 Hz. Micosoft Pulse Code Modulation (PCM) fomat is the only Wave fomat categoy suppoted by the utilities. Following the data sting identifie, the WAV2LIN utility will pocess the est of the Wave file as binay data fo the Linea file. If the Wave file contains othe infomation between the heade and the audio data it will not be pocessed coectly. To get aound this, the pogam can be modified to pefom a futhe seach of sting identifies within the Wave file. &RQYHUWLQJ:DYH$XGLR)LOHV
)LOHV3URYLGHG Souce: Heades: Text Files: Batch Files: Executables: lin2wav.c wav2lin.c convet.h lin2wav.txt wav2lin.txt ltw.bat wtl.bat lin2wav.exe wav2lin.exe. &RPSLOLQJ The souce code is compatible with the Micosoft C compile vesion 6.0 and above. Two batch files ae povided to compile the souce code and ceate the utilities: ltw.bat geneates lin2wav.exe and wtl.bat poduces wav2lin.exe. Ente LTW o WTL at a DOS pompt to execute the compilation. %URRNWURXW$SSOLFDWLRQ1RWH