#! /usr/local/bin/perl

# This script will be called by speechplay to play a speech file on a dec machine

if (($#ARGV < 0) || ($#ARGV >1)) {
  print "Usage: playondec <speechfile>\n";
  exit(-1);
}

if ($#ARGV == 1) {       # volume arg included
  $vol = $ARGV[1];
}
else {
  $vol=15;
}

$ENV{"DISPLAY"} = ":0.0";

system("/projects/cslu/speech/new/bin/decmips/wav2mu -g $ARGV[0] /usr/tmp/$$.mu");
system("/projects/cslu/speech/bin/decmips/aplay -f -g $vol -d 1 /usr/tmp/$$.mu");
system("/bin/rm -f /usr/tmp/$$.mu");

