1#!/bin/sh
2###########################################################################
3##                                                                       ##
4##                Centre for Speech Technology Research                  ##
5##                     University of Edinburgh, UK                       ##
6##                         Copyright (c) 1997                            ##
7##                        All Rights Reserved.                           ##
8##                                                                       ##
9##  Permission is hereby granted, free of charge, to use and distribute  ##
10##  this software and its documentation without restriction, including   ##
11##  without limitation the rights to use, copy, modify, merge, publish,  ##
12##  distribute, sublicense, and/or sell copies of this work, and to      ##
13##  permit persons to whom this work is furnished to do so, subject to   ##
14##  the following conditions:                                            ##
15##   1. The code must retain the above copyright notice, this list of    ##
16##      conditions and the following disclaimer.                         ##
17##   2. Any modifications must be clearly marked as such.                ##
18##   3. Original authors' names are not deleted.                         ##
19##   4. The authors' names are not used to endorse or promote products   ##
20##      derived from this software without specific prior written        ##
21##      permission.                                                      ##
22##                                                                       ##
23##  THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK        ##
24##  DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING      ##
25##  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT   ##
26##  SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE     ##
27##  FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES    ##
28##  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN   ##
29##  AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,          ##
30##  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF       ##
31##  THIS SOFTWARE.                                                       ##
32##                                                                       ##
33###########################################################################
34
35CH_TRACK=$TOP/bin/ch_track
36DATA=../lib/example_data
37
38set -x
39
40test_conversions () {
41
42	echo conversion >&2
43
44	/bin/rm -f tmp/ch_track.htk tmp/ch_track.track
45
46	# Get htk version with basic header
47	$CH_TRACK -otype htk "$DATA"/ch_track.htk -o tmp/ch_track.htk || exit 1
48
49	$CH_TRACK -otype esps tmp/ch_track.htk -o tmp/ch_track.track || exit 1
50	$CH_TRACK -otype htk tmp/ch_track.track -o tmp/ch_track.htk2 || exit 1
51        if cmp tmp/ch_track.htk tmp/ch_track.htk2
52		then echo ch_track htk to esps to nist: pass
53		else echo ch_track htk to esps to nist: fail
54	fi
55
56	$CH_TRACK -otype ascii tmp/ch_track.htk -o tmp/ch_track.track || exit 1
57	$CH_TRACK -itype ascii -s 0.010 -otype htk_fbank tmp/ch_track.track -o tmp/ch_track.htk2 || exit 1
58	$CH_TRACK -otype ascii tmp/ch_track.htk2 -o tmp/ch_track.ascii || exit 1
59        if cmp tmp/ch_track.track tmp/ch_track.ascii
60		then echo ch_track htk to ascii to htk: pass
61		else echo ch_track htk to ascii to htk: fail
62	fi
63
64	$CH_TRACK -otype htk "$DATA"/ch_track.htk -o tmp/ch_track.htk || exit 1
65
66	$CH_TRACK -otype htk_user tmp/ch_track.htk -o tmp/ch_track.track || exit 1
67	$CH_TRACK -otype htk tmp/ch_track.track -o tmp/ch_track.htk2 || exit 1
68        if cmp tmp/ch_track.htk tmp/ch_track.htk2
69		then echo ch_track htk to htk_user to htk: pass
70		else echo ch_track htk to htk_user to htk: fail
71	fi
72}
73
74test_info ()
75{
76  echo info and help >&2
77  $CH_TRACK -info "$DATA"/ch_track.htk
78  $CH_TRACK -h
79  $CH_TRACK "$DATA"/ch_track.htk -otype esps -o tmp/ch_track.esps
80  $CH_TRACK -info "$DATA"/ch_track.htk tmp/ch_track.esps
81}
82
83echo >$OUTPUT
84
85test_conversions 2>&1 >> $OUTPUT
86test_info 2>&1 >> $OUTPUT
87
88exit 0
89