63 main(int32 argc,
char **argv)
67 int32 k, uttno, ts, uttlen, sps, endsilsamples;
74 (sscanf(argv[1],
"%d", &sps) != 1) ||
75 (sscanf(argv[2],
"%f", &endsil) != 1) || (endsil <= 0.0)) {
76 E_FATAL(
"Usage: %s <sampling-rate> <utt-end-sil(sec)>\n", argv[0]);
80 endsilsamples = (int32) (endsil * sps);
84 E_FATAL(
"ad_open_sps(%d) failed\n", sps);
88 E_FATAL(
"cont_ad_init failed\n");
91 printf(
"Calibrating ...");
100 printf(
"You may speak now\n");
107 E_FATAL(
"cont_ad_read failed\n");
111 sprintf(file,
"%04d.raw", uttno);
112 if ((fp = fopen(file,
"wb")) == NULL)
113 E_FATAL(
"Failed to open '%s' for reading: %s\n", file, strerror(errno));
114 fwrite(buf,
sizeof(int16), k, fp);
116 printf(
"Utterance %04d, logging to %s\n", uttno, file);
124 E_FATAL(
"cont_ad_read failed\n");
130 if ((cont->
read_ts - ts) > endsilsamples)
137 fwrite(buf,
sizeof(int16), k, fp);
142 printf(
"\tUtterance %04d = %d samples (%.1fsec)\n\n",
143 uttno, uttlen, (
double) uttlen / (
double) sps);