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_track *t1; cst_track *me_filters = NULL; cst_wave *w1, *w2, *res = NULL; cst_val *files; cst_features *args; int i, j; int order, o, s; int frame_length; float *lpcs, *residual; float m; const char *f1, *f2; const char *resfn = NULL; int last_peak = 0, next_peak; int period; float power; int rfc = 0; int str = 0; int fn, fo, ss; float xpulse, xnoise; float fxpulse, fxnoise; float x, me; float *hpulse = NULL, *hnoise = NULL; float *xpulsesig = NULL, *xnoisesig = NULL; int q = 0; int position; int lpc_start = 0; args = new_features(); files = cst_args(argv, argc, "usage: lpc_resynth OPTIONS INTRACK OUTWAVE\n" "Resynth an lpc track\n" "-res <string> residual (as waveform)\n" "-save_res Save the generated residual\n" "-lpc_start <int> start of lpc params in lpc track {1}\n" "-order <int> LPC order {16}\n" "-str mixed excitation strengths\n" "-me_filters <string> mixed excitation filters\n" "-rfc Coefficents are reflection coefficients\n", args); f1 = val_string(val_car(files)); f2 = val_string(val_car(val_cdr(files))); t1 = new_track(); lpc_start = mimic_get_param_int(args, "-lpc_start", 1); if (feat_present(args, "-rfc")) rfc = 1; if (feat_present(args, "-str")) str = 1; if (feat_present(args, "-me_filters")) { me_filters = new_track(); if (cst_track_load_est (me_filters, mimic_get_param_string(args, "-me_filters", "me_filters.track")) != CST_OK_FORMAT) { fprintf(stderr, "lpc_resynth: can't read file or wrong format \"%s\"\n", f1); return -1; } hpulse = cst_alloc(float, me_filters->num_channels); hnoise = cst_alloc(float, me_filters->num_channels); xpulsesig = cst_alloc(float, me_filters->num_channels); xnoisesig = cst_alloc(float, me_filters->num_channels); }