int main(int argc, char **argv) { cst_wave *nw, *all; cst_val *files; const cst_val *w; cst_val *wavelist; cst_features *args; int i,j; float ntime; int stime; const char *nwfile; args = new_features(); files = cst_args(argv,argc, "usage: combine_waves OPTIONS\n" "Combine waves into single waveform\n" "-o <string> Output waveform\n" "-f <int> Input sample rate (for raw input)\n" "-itype <string> Input type, raw or headered\n" "-wavelist <string> File containing times and wave filenames\n", args); wavelist = get_wavelist(get_param_string(args,"-wavelist","-")); if (wavelist == 0) return -1; all = new_wave(); for (w = wavelist; w; w = val_cdr(w)) { ntime = decode_time(val_string(val_car(w))); nwfile = val_string(val_car(val_cdr(w))); nw = new_wave(); if (cst_wave_load_riff(nw,nwfile) != CST_OK_FORMAT) { fprintf(stderr, "combine_waves: can't read file or wrong format \"%s\"\n", nwfile); continue; } stime = ntime * nw->sample_rate; cst_wave_resize(all,stime+nw->num_samples,1); for (i=0,j=stime; i<nw->num_samples; i++,j++) { /* this will cause overflows */ all->samples[j] += nw->samples[i]; } delete_wave(nw); } cst_wave_save_riff(all,get_param_string(args,"-o","-")); return 0; }
int main(int argc, char **argv) { cst_wave *in, *out; cst_val *files; cst_features *args; int i,j; int w, a, t; args = new_features(); files = cst_args(argv,argc, "usage: dcoffset_wave OPTIONS\n" "Subtract window average from waveform\n" "-i <string> Input waveform\n" "-o <string> Output waveform\n" "-w <int> Window size (in samples)\n", args); w = flite_get_param_int(args,"-w",20); in = new_wave(); cst_wave_load_riff(in,flite_get_param_string(args,"-i","-")); out = copy_wave(in); for (i=0; i<=out->num_samples; i++) { for (t=a=0,j=i-w/2; j < i+w/2; j++) { if ((j > 0) && (j < out->num_samples)) { t += 1; a+=in->samples[j]; } } /* printf("%d %d %d %d %d\n",i,out->samples[i],a/t,t,out->samples[i]-a/t); */ out->samples[i] -= a/t; } cst_wave_save_riff(out,flite_get_param_string(args,"-o","-")); return 0; }
int main(int argc, char **argv) { cst_track *lpc; cst_wave *sig, *sig2; cst_sts *sts; if (argc != 6) { fprintf(stderr,"usage: find_sts lpc_min lpc_range LPC WAVEFILE STS\n"); return 1; } lpc_min = atof(argv[1]); lpc_range = atof(argv[2]); lpc = new_track(); cst_track_load_est(lpc,argv[3]); sig = new_wave(); if (cst_wave_load_riff(sig,argv[4]) == CST_WRONG_FORMAT) { fprintf(stderr, "cannot load waveform, format unrecognized, from \"%s\"\n", argv[4]); exit(-1); } sts = find_sts(sig,lpc); /* See if it worked */ sig2 = reconstruct_wave(sig,sts,lpc); compare_waves(sig,sig2); cst_wave_save_riff(sig2,"sig2.wav"); save_sts(sts,lpc,sig,argv[5]); return 0; }
int main(int argc, char **argv) { cst_wave *w; cst_relation *r; cst_utterance *u; if (argc != 3) { fprintf(stderr, "usage: mimic_play_wave_sync WAVEFILE LABELFILE\n"); return 1; } w = new_wave(); if (cst_wave_load_riff(w, argv[1]) != CST_OK_FORMAT) return -1; u = new_utterance(); r = utt_relation_create(u, "FOO"); if (relation_load(r, argv[2]) != CST_OK_FORMAT) return -1; mimic_play_wave_sync(w, r, my_call_back); return 0; }
int main(int argc, char **argv) { cst_wave *w; int port; char *server; char *encoding; int i,iw; port = CST_AUDIO_DEFAULT_PORT; server = CST_AUDIO_DEFAULT_SERVER; encoding = CST_AUDIO_DEFAULT_ENCODING; if (argc == 1) { play_client_main_usage(); return 1; } if ((cst_streq("-h",argv[1])) || (cst_streq("-help",argv[1])) || (cst_streq("--help",argv[1]))) { play_client_main_usage(); return 1; } iw = 1; if (cst_streq("-s",argv[iw])) { if (argc < iw+1) { fprintf(stderr,"ERROR: no servername given\n"); play_client_main_usage(); return 1; } server = argv[iw+1]; iw+=2; } if (cst_streq("-p",argv[iw])) { if (argc < iw+1) { fprintf(stderr,"ERROR: no port given\n"); play_client_main_usage(); return 1; } port = atoi(argv[iw+1]); iw+=2; } if (cst_streq("-e",argv[iw])) { if (argc < iw+1) { fprintf(stderr,"ERROR: no encoding given\n"); play_client_main_usage(); return 1; } encoding = argv[iw+1]; iw+=2; } for (i=iw; i<argc; i++) { w = new_wave(); if (cst_wave_load_riff(w,argv[i]) != CST_OK_FORMAT) { fprintf(stderr, "play_wave: can't read file or wrong format \"%s\"\n", argv[i]); continue; } play_wave_client(w,server,port,encoding); delete_wave(w); } return 0; }