static void *aubiotempo_tilde_del(t_aubiotempo_tilde *x) { if(x->t) del_aubio_tempo(x->t); if(x->output) del_fvec(x->output); if(x->vec) del_fvec(x->vec); return 0; }
//-------------------------------------------------------------- aubioAnalyzer::~aubioAnalyzer(){ del_aubio_pitchdetection(pitch_output); del_fvec(in); del_fvec(beats); del_aubio_beattracking(tracker); aubio_cleanup(); }
void del_aubio_pitch (aubio_pitch_t * p) { switch (p->type) { case aubio_pitcht_yin: del_fvec (p->buf); del_aubio_pitchyin (p->p_object); break; case aubio_pitcht_mcomb: del_aubio_pvoc (p->pv); del_cvec (p->fftgrain); del_aubio_filter (p->filter); del_aubio_pitchmcomb (p->p_object); break; case aubio_pitcht_schmitt: del_fvec (p->buf); del_aubio_pitchschmitt (p->p_object); break; case aubio_pitcht_fcomb: del_fvec (p->buf); del_aubio_pitchfcomb (p->p_object); break; case aubio_pitcht_yinfft: del_fvec (p->buf); del_aubio_pitchyinfft (p->p_object); break; case aubio_pitcht_specacf: del_fvec (p->buf); del_aubio_pitchspecacf (p->p_object); break; default: break; } AUBIO_FREE (p); }
int main(){ /* allocate some memory */ uint_t win_s = 1024; /* window size */ fvec_t * in = new_fvec (win_s); /* input buffer */ fvec_t * out = new_fvec (win_s/4); /* input buffer */ /* allocate fft and other memory space */ aubio_beattracking_t * tempo = new_aubio_beattracking(win_s); uint_t i = 0; smpl_t curtempo, curtempoconf; while (i < 10) { aubio_beattracking_do(tempo,in,out); curtempo = aubio_beattracking_get_bpm(tempo); if (curtempo != 0.) { fprintf(stdout,"%f\n",curtempo); return 1; } curtempoconf = aubio_beattracking_get_confidence(tempo); if (curtempoconf != 0.) { fprintf(stdout,"%f\n",curtempo); return 1; } i++; }; del_aubio_beattracking(tempo); del_fvec(in); del_fvec(out); aubio_cleanup(); return 0; }
int main () { uint_t win_s = 64; // window size // create biquad filter with `b0`, `b1`, `b2`, `a1`, `a2` aubio_filter_t * o = new_aubio_filter_biquad(0.3,0.2,0.1,0.2,0.3); fvec_t * in_vec = new_fvec (win_s); // input buffer fvec_t * tmp_vec = new_fvec (win_s); // temporary buffer fvec_t * out_vec = new_fvec (win_s); // output buffer uint_t times = 100; while ( times-- ) { // copy to out, then filter out aubio_filter_do_outplace(o, in_vec, out_vec); // in-place filtering aubio_filter_do(o, in_vec); // in-place filtering aubio_filter_do_filtfilt(o, in_vec, out_vec); fvec_print(in_vec); } // memory clean-up, one for each new del_aubio_filter(o); del_fvec(in_vec); del_fvec(tmp_vec); del_fvec(out_vec); return 0; }
int main(){ /* allocate some memory */ uint_t win_s = 4096; /* window size */ uint_t channels = 100; /* number of channels */ fvec_t * in = new_fvec (win_s, channels); /* input buffer */ cvec_t * fftgrain = new_cvec (win_s, channels); /* fft norm and phase */ fvec_t * out = new_fvec (win_s, channels); /* output buffer */ /* allocate fft and other memory space */ aubio_mfft_t * fft = new_aubio_mfft(win_s,channels); /* fill input with some data */ //printf("initialised\n"); /* execute stft */ aubio_mfft_do (fft,in,fftgrain); //printf("computed forward\n"); /* execute inverse fourier transform */ aubio_mfft_rdo(fft,fftgrain,out); //printf("computed backard\n"); del_aubio_mfft(fft); del_fvec(in); del_cvec(fftgrain); del_fvec(out); //printf("memory freed\n"); aubio_cleanup(); return 0; }
int main (void) { uint_t win_s = 16; // window size uint_t impulse_at = win_s / 2; fvec_t *in = new_fvec (win_s); // input buffer fvec_t *out = new_fvec (win_s); // input buffer aubio_filter_t *o = new_aubio_filter_c_weighting (44100); in->data[impulse_at] = 0.5; fvec_print (in); aubio_filter_do (o, in); fvec_print (in); del_aubio_filter (o); o = new_aubio_filter_a_weighting (32000); in->data[impulse_at] = 0.5; fvec_print (in); aubio_filter_do_outplace (o, in, out); fvec_print (out); aubio_filter_set_a_weighting (o, 32000); in->data[impulse_at] = 0.5; fvec_print (in); aubio_filter_do_filtfilt (o, in, out); fvec_print (out); del_fvec (in); del_fvec (out); del_aubio_filter (o); aubio_cleanup (); return 0; }
int main (int argc, char **argv) { uint_t err = 0; if (argc < 2) { err = 2; PRINT_ERR("not enough arguments\n"); PRINT_MSG("read a wave file as a mono vector\n"); PRINT_MSG("usage: %s <source_path> [samplerate] [win_size] [hop_size]\n", argv[0]); return err; } uint_t samplerate = 0; if ( argc >= 3 ) samplerate = atoi(argv[2]); uint_t win_size = 1024; // window size if ( argc >= 4 ) win_size = atoi(argv[3]); uint_t hop_size = win_size / 4; if ( argc >= 5 ) hop_size = atoi(argv[4]); uint_t n_frames = 0, read = 0; char_t *source_path = argv[1]; aubio_source_t * source = new_aubio_source(source_path, samplerate, hop_size); if (!source) { err = 1; goto beach; } if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(source); // create some vectors fvec_t * in = new_fvec (hop_size); // input audio buffer fvec_t * out = new_fvec (1); // output position // create tempo object aubio_tempo_t * o = new_aubio_tempo("default", win_size, hop_size, samplerate); do { // put some fresh data in input vector aubio_source_do(source, in, &read); // execute tempo aubio_tempo_do(o,in,out); // do something with the beats if (out->data[0] != 0) { PRINT_MSG("beat at %.3fms, %.3fs, frame %d, %.2fbpm with confidence %.2f\n", aubio_tempo_get_last_ms(o), aubio_tempo_get_last_s(o), aubio_tempo_get_last(o), aubio_tempo_get_bpm(o), aubio_tempo_get_confidence(o)); } n_frames += read; } while ( read == hop_size ); PRINT_MSG("read %.2fs, %d frames at %dHz (%d blocks) from %s\n", n_frames * 1. / samplerate, n_frames, samplerate, n_frames / hop_size, source_path); // clean up memory del_aubio_tempo(o); del_fvec(in); del_fvec(out); del_aubio_source(source); beach: aubio_cleanup(); return err; }
int main(){ /* allocate some memory */ uint_t win_s = 1024; /* window size */ fvec_t * in = new_fvec (win_s); /* input buffer */ fvec_t * out = new_fvec (2); /* input buffer */ aubio_tempo_t * o = new_aubio_tempo("complex", win_s, win_s/4, 44100.); uint_t i = 0; smpl_t curtempo, curtempoconf; while (i < 1000) { aubio_tempo_do(o,in,out); curtempo = aubio_tempo_get_bpm(o); if (curtempo != 0.) { fprintf(stdout,"%f\n",curtempo); return 1; } curtempoconf = aubio_tempo_get_confidence(o); if (curtempoconf != 0.) { fprintf(stdout,"%f\n",curtempo); return 1; } i++; }; del_aubio_tempo(o); del_fvec(in); del_fvec(out); aubio_cleanup(); return 0; }
void del_aubio_tss(aubio_tss_t *s) { del_fvec(s->theta1); del_fvec(s->theta2); del_fvec(s->oft1); del_fvec(s->oft2); del_fvec(s->dev); AUBIO_FREE(s); }
void del_aubio_notes (aubio_notes_t *o) { if (o->note_buffer) del_fvec(o->note_buffer); if (o->note_buffer2) del_fvec(o->note_buffer2); if (o->pitch_output) del_fvec(o->pitch_output); if (o->pitch) del_aubio_pitch(o->pitch); if (o->onset_output) del_fvec(o->onset_output); if (o->onset) del_aubio_onset(o->onset); AUBIO_FREE(o); }
void del_aubio_pvoc(aubio_pvoc_t *pv) { del_fvec(pv->data); del_fvec(pv->synth); del_fvec(pv->dataold); del_fvec(pv->synthold); del_aubio_mfft(pv->fft); AUBIO_FREE(pv->w); AUBIO_FREE(pv); }
void del_aubio_pitchfcomb (aubio_pitchfcomb_t * p) { del_cvec (p->fftOut); del_fvec (p->fftLastPhase); del_fvec (p->win); del_fvec (p->winput); del_aubio_fft (p->fft); AUBIO_FREE (p); }
void del_aubio_pitchspecacf (aubio_pitchspecacf_t * p) { del_fvec (p->win); del_fvec (p->winput); del_aubio_fft (p->fft); del_fvec (p->sqrmag); del_fvec (p->fftout); AUBIO_FREE (p); }
void examples_common_del (void) { #ifdef HAVE_JACK if (ev.buffer) free(ev.buffer); #endif del_fvec (ibuf); del_fvec (obuf); aubio_cleanup (); fflush(stderr); fflush(stdout); }
int main (void) { uint_t n = 10; // compute n times uint_t win_s = 1024; // window size uint_t hop_s = 256; // hop size // create some vectors fvec_t * in = new_fvec (hop_s); // input buffer cvec_t * fftgrain = new_cvec (win_s); // fft norm and phase cvec_t * cstead = new_cvec (win_s); // fft norm and phase cvec_t * ctrans = new_cvec (win_s); // fft norm and phase fvec_t * stead = new_fvec (hop_s); // output buffer fvec_t * trans = new_fvec (hop_s); // output buffer // create phase vocoder for analysis of input signal aubio_pvoc_t * pv = new_aubio_pvoc (win_s,hop_s); // create transient/steady-state separation object aubio_tss_t * tss = new_aubio_tss(win_s,hop_s); // create phase vocoder objects for synthesis of output signals aubio_pvoc_t * pvt = new_aubio_pvoc(win_s,hop_s); aubio_pvoc_t * pvs = new_aubio_pvoc(win_s,hop_s); /* execute stft */ while ( n-- ) { // fftgrain = pv(in) aubio_pvoc_do (pv, in, fftgrain); // ctrans, cstead = tss (fftgrain) aubio_tss_do (tss, fftgrain, ctrans, cstead); // stead = pvt_inverse (cstead) // trans = pvt_inverse (ctrans) aubio_pvoc_rdo (pvt, cstead, stead); aubio_pvoc_rdo (pvs, ctrans, trans); } aubio_tss_set_alpha(tss, 4.); aubio_tss_set_beta(tss, 3.); aubio_tss_set_threshold(tss, 3.); del_aubio_pvoc(pv); del_aubio_pvoc(pvt); del_aubio_pvoc(pvs); del_aubio_tss(tss); del_fvec(in); del_cvec(fftgrain); del_cvec(cstead); del_cvec(ctrans); del_fvec(stead); del_fvec(trans); aubio_cleanup(); return 0; }
void aubio_destruct() { del_aubio_pvoc(pv); del_fvec(ibuf); del_cvec(fftgrain); del_aubio_onsetdetection(o); del_aubio_peakpicker(parms); del_fvec(onset); if (usedoubled) { del_aubio_onsetdetection(o2); del_fvec(onset2); } }
void del_aubio_pitchyinfft (aubio_pitchyinfft_t * p) { del_fvec (p->win); del_aubio_fft (p->fft); del_fvec (p->yinfft); del_fvec (p->sqrmag); del_cvec (p->res); del_cvec (p->fftout); del_fvec (p->winput); del_fvec (p->weight); AUBIO_FREE (p); }
void del_aubio_tempo (aubio_tempo_t *o) { del_aubio_onsetdetection(o->od); del_aubio_beattracking(o->bt); del_aubio_peakpicker(o->pp); del_aubio_pvoc(o->pv); del_fvec(o->out); del_fvec(o->of); del_cvec(o->fftgrain); del_fvec(o->dfframe); AUBIO_FREE(o); return; }
int main(int argc, char **argv) { // override general settings from utils.c buffer_size = 1024; hop_size = 512; rgb_music_init(); examples_common_init(argc,argv); verbmsg ("using source: %s at %dHz\n", source_uri, samplerate); verbmsg ("tempo method: %s, ", tempo_method); verbmsg ("buffer_size: %d, ", buffer_size); verbmsg ("hop_size: %d, ", hop_size); verbmsg ("threshold: %f\n", onset_threshold); tempo_out = new_fvec(2); tempo = new_aubio_tempo(tempo_method, buffer_size, hop_size, samplerate); if (onset_threshold != 0.) aubio_tempo_set_threshold (tempo, onset_threshold); pitch = new_aubio_pitch (pitch_method, buffer_size, hop_size, samplerate); if (pitch_tolerance != 0.) aubio_pitch_set_tolerance (pitch, pitch_tolerance); if (silence_threshold != -90.) aubio_pitch_set_silence (pitch, silence_threshold); if (pitch_unit != NULL) aubio_pitch_set_unit (pitch, pitch_unit); pitch_out = new_fvec (1); wavetable = new_aubio_wavetable (samplerate, hop_size); aubio_wavetable_set_freq ( wavetable, 2450.); //aubio_sampler_load (sampler, "/archives/sounds/woodblock.aiff"); examples_common_process((aubio_process_func_t)process_block,process_print); del_aubio_tempo(tempo); del_aubio_wavetable (wavetable); del_fvec(tempo_out); del_aubio_pitch (pitch); del_fvec (pitch_out); examples_common_del(); return 0; }
AubioPitch::~AubioPitch(){ del_aubio_pitchdetection(pitchDetect); del_fvec(vec); aubio_cleanup(); //delk fvec }
int main(int argc, char **argv) { // override general settings from utils.c buffer_size = 1024; hop_size = 512; examples_common_init(argc,argv); verbmsg ("using source: %s at %dHz\n", source_uri, samplerate); verbmsg ("tempo method: %s, ", tempo_method); verbmsg ("buffer_size: %d, ", buffer_size); verbmsg ("hop_size: %d, ", hop_size); verbmsg ("threshold: %f\n", onset_threshold); tempo_out = new_fvec(2); tempo = new_aubio_tempo(tempo_method, buffer_size, hop_size, samplerate); // set silence threshold very low to output beats even during silence // aubio_tempo_set_silence(tempo, -1000.); if (onset_threshold != 0.) aubio_tempo_set_threshold (tempo, onset_threshold); wavetable = new_aubio_wavetable (samplerate, hop_size); aubio_wavetable_set_freq ( wavetable, 2450.); //aubio_sampler_load (sampler, "/archives/sounds/woodblock.aiff"); examples_common_process((aubio_process_func_t)process_block,process_print); del_aubio_tempo(tempo); del_aubio_wavetable (wavetable); del_fvec(tempo_out); examples_common_del(); return 0; }
int main () { uint_t win_s = 512; // fft size uint_t n_filters = 40; // number of filters uint_t n_coefs = 13; // number of coefficients smpl_t samplerate = 16000.; // samplerate cvec_t *in = new_cvec (win_s); // input buffer fvec_t *out = new_fvec (n_coefs); // output coefficients // create mfcc object aubio_mfcc_t *o = new_aubio_mfcc (win_s, n_filters, n_coefs, samplerate); cvec_set_all_norm (in, 1.); aubio_mfcc_do (o, in, out); fvec_print (out); cvec_set_all_norm (in, .5); aubio_mfcc_do (o, in, out); fvec_print (out); // clean up del_aubio_mfcc (o); del_cvec (in); del_fvec (out); aubio_cleanup (); return 0; }
void del_aubio_pitchmcomb (aubio_pitchmcomb_t * p) { uint_t i; del_fvec (p->newmag); del_fvec (p->scratch); del_fvec (p->theta); del_fvec (p->scratch2); AUBIO_FREE (p->peaks); for (i = 0; i < p->ncand; i++) { AUBIO_FREE (p->candidates[i]->ecomb); AUBIO_FREE (p->candidates[i]); } AUBIO_FREE (p->candidates); AUBIO_FREE (p); }
int main(int argc, char **argv) { // params buffer_size = 512; overlap_size = 256; examples_common_init(argc,argv); /* phase vocoder */ pv = new_aubio_pvoc (buffer_size, overlap_size); fftgrain = new_cvec (buffer_size); //populating the filter mfcc = new_aubio_mfcc(buffer_size, n_filters, n_coefs, samplerate); mfcc_out = new_fvec(n_coefs); //process examples_common_process(aubio_process,process_print); //destroying mfcc del_aubio_pvoc (pv); del_cvec (fftgrain); del_aubio_mfcc(mfcc); del_fvec(mfcc_out); examples_common_del(); debug("End of program.\n"); fflush(stderr); return 0; }
int main(int argc, char **argv) { buffer_size = 2048; examples_common_init(argc,argv); verbmsg ("using source: %s at %dHz\n", source_uri, samplerate); verbmsg ("pitch method: %s, ", pitch_method); verbmsg ("pitch unit: %s, ", pitch_unit); verbmsg ("buffer_size: %d, ", buffer_size); verbmsg ("hop_size: %d, ", hop_size); verbmsg ("tolerance: %f\n", pitch_tolerance); o = new_aubio_pitch (pitch_method, buffer_size, hop_size, samplerate); if (pitch_tolerance != 0.) aubio_pitch_set_tolerance (o, pitch_tolerance); if (pitch_unit != NULL) aubio_pitch_set_unit (o, pitch_unit); pitch = new_fvec (1); wavetable = new_aubio_wavetable (samplerate, hop_size); aubio_wavetable_play ( wavetable ); examples_common_process((aubio_process_func_t)process_block,process_print); del_aubio_pitch (o); del_aubio_wavetable (wavetable); del_fvec (pitch); examples_common_del(); return 0; }
int main(int argc, char **argv) { // change some default params buffer_size = 512; hop_size = 256; examples_common_init(argc,argv); verbmsg ("using source: %s at %dHz\n", source_uri, samplerate); verbmsg ("buffer_size: %d, ", buffer_size); verbmsg ("hop_size: %d\n", hop_size); pv = new_aubio_pvoc (buffer_size, hop_size); fftgrain = new_cvec (buffer_size); mfcc = new_aubio_mfcc(buffer_size, n_filters, n_coefs, samplerate); mfcc_out = new_fvec(n_coefs); examples_common_process((aubio_process_func_t)process_block, process_print); del_aubio_pvoc (pv); del_cvec (fftgrain); del_aubio_mfcc(mfcc); del_fvec(mfcc_out); examples_common_del(); return 0; }
AubioOnsetDetector :: ~AubioOnsetDetector(){ aubio_onsetdetection_free (o); del_aubio_pvoc(pv); del_aubio_peakpicker(parms); del_fvec(vec); aubio_cleanup(); }
void del_aubio_wavetable( aubio_wavetable_t * s ) { del_aubio_parameter(s->freq); del_aubio_parameter(s->amp); del_fvec(s->wavetable); AUBIO_FREE(s); }
int main (void) { /* allocate some memory */ uint_t win_s = 512; /* fft size */ uint_t n_filters = 40; /* number of filters */ cvec_t *in = new_cvec (win_s); /* input buffer */ fvec_t *out = new_fvec (win_s); /* input buffer */ fmat_t *coeffs = NULL; smpl_t samplerate = 16000.; /* allocate fft and other memory space */ aubio_filterbank_t *o = new_aubio_filterbank (n_filters, win_s); /* assign Mel-frequency coefficients */ aubio_filterbank_set_mel_coeffs_slaney (o, samplerate); coeffs = aubio_filterbank_get_coeffs (o); if (coeffs == NULL) { return -1; } //fmat_print (coeffs); //fprintf(stderr, "%f\n", fvec_sum(coeffs)); aubio_filterbank_do (o, in, out); del_aubio_filterbank (o); del_cvec (in); del_fvec (out); aubio_cleanup (); return 0; }