void examples_common_init(int argc,char ** argv) {
- aubio_file_t * onsetfile = new_file_ro(onset_filename);
+ aubio_file_t * onsetfile;
/* parse command line arguments */
parse_args(argc, argv);
+ woodblock = new_fvec(buffer_size,1);
+ if (output_filename || usejack) {
+ (onsetfile = new_file_ro(onset_filename)) ||
+ (onsetfile = new_file_ro("sounds/woodblock.aiff")) ||
+ (onsetfile = new_file_ro("../sounds/woodblock.aiff"));
+ /* read the output sound once */
+ file_read(onsetfile, overlap_size, woodblock);
+ }
+
if(!usejack)
{
debug("Opening files ...\n");
ibuf = new_fvec(overlap_size, channels);
obuf = new_fvec(overlap_size, channels);
- woodblock = new_fvec(buffer_size,1);
fftgrain = new_cvec(buffer_size, channels);
if (usepitch) {
note_buffer2= new_fvec(median, 1);
}
}
- /* read the output sound once */
- file_read(onsetfile, overlap_size, woodblock);
/* phase vocoder */
pv = new_aubio_pvoc(buffer_size, overlap_size, channels);
/* onsets */
AUBIO_MEMSET(&sfinfo, 0, sizeof (sfinfo));
if (! (f->handle = sf_open (outputname, SFM_READ, &sfinfo))) {
- AUBIO_ERR("Not able to open input file %s.\n", outputname);
+ AUBIO_ERR("Unable to open input file %s.\n", outputname);
AUBIO_ERR("%s\n",sf_strerror (NULL)); /* libsndfile err msg */
- AUBIO_QUIT(AUBIO_FAIL);
+ return NULL;
}
if (sfinfo.channels > MAX_CHANNELS) {
AUBIO_ERR("Not able to process more than %d channels\n", MAX_CHANNELS);
- AUBIO_QUIT(AUBIO_FAIL);
+ return NULL;
}
f->size = MAX_SIZE*sfinfo.channels;