#!/bin/csh
# converts esps files to mulaw files
# assumes that you have an ESPS license and
#	esps2mu
#	btosps
# also uses
#	dd
#	gawk
#	
# NOTE: most of the files are ESPS format but not all!
#
set GAWK = gawk

set ORGDIR="/homes/singer/TOBI-TRAINING/EXAMPLES"
set DESTDIR="./AU"

ESPSFORMAT:
set FILES = ( `ls $ORGDIR/*.d` )
set FILES = ( $FILES:gt )
set FILES = ( $FILES:gr )

foreach F ( $FILES ) 
	esps2mu $ORGDIR/$F.d -  |\
	$GAWK 'BEGIN { printf".snd\000\000\000\024\377\377\377\377\000\000\000\001\000\000\037\100\000\000\000\001"; }{ print }' > $DESTDIR/$F.au
end

HEADER708FORMAT:
foreach F ( abbreviation connections fare philadelphia transport weight )
	dd if=$ORGDIR/$F.d skip=708 ibs=1 |\
	btosps -c 'nothing' - - |\
	esps2mu - -  |\
	$GAWK 'BEGIN { printf".snd\000\000\000\024\377\377\377\377\000\000\000\001\000\000\037\100\000\000\000\001"; }{ print }' > $DESTDIR/$F.au
end

LINEARFORMAT:
foreach F ( made3 )
	btosps -c 'nothing' $ORGDIR/$F.d - |\
	esps2mu - -  |\
	$GAWK 'BEGIN { printf".snd\000\000\000\024\377\377\377\377\000\000\000\001\000\000\037\100\000\000\000\001"; }{ print }' > $DESTDIR/$F.au
end

### EOF

