#! /bin/csh

# playklatt
# Paul Callaghan
# 12 june 94.

# usage: klattplay <options> <file>

# This script should be customised to run the synth at the right SR and other
# parameters, plus transform the output into whatever form is required - eg 
# sound. 

# klatt needs the input to be marked with "-i". 
set num = $#argv
set file = $argv[$num]
set argv[$num] = "-i $argv[$num]"


if ($KLATT_SAMPLE_RATE == 8000 || $KLATT_SAMPLE_RATE == 16000) then
	# use OGI speech2mu for good downsampling. 
	klatt -r 1 -v 2 -s $KLATT_SAMPLE_RATE -f $KLATT_FRAME_SIZE $argv | addhdr -r $KLATT_SAMPLE_RATE -b | speech2mu > /dev/audio
else
	# use sox for difficult downsampling. 
	klatt -r 1 -v 2 -s $KLATT_SAMPLE_RATE -f $KLATT_FRAME_SIZE $argv | sox -t .sw -r $KLATT_SAMPLE_RATE -   -t .ul -r 8000 /dev/audio
endif

