void pitchDetector::setup(char_t * unit, char_t * method) { samplerate = 44100; uint_t win_s = 2048; // window size uint_t hop_s = 512; // hop size pitch_tolerance = 0; silence_threshold = -90.; pitch_unit = unit; pitch_method = method; blocks = 0; o = new_aubio_pitch (pitch_method, win_s, hop_s, samplerate); if (pitch_tolerance != 0.) aubio_pitch_set_tolerance (o, pitch_tolerance); if (silence_threshold != -90.) aubio_pitch_set_silence (o, silence_threshold); if (pitch_unit != NULL) aubio_pitch_set_unit (o, pitch_unit); pitch = new_fvec (1); }
uint_t aubio_notes_set_silence(aubio_notes_t *o, smpl_t silence) { uint_t err = AUBIO_OK; if (aubio_pitch_set_silence(o->pitch, silence) != AUBIO_OK) { err = AUBIO_FAIL; } if (aubio_onset_set_silence(o->onset, silence) != AUBIO_OK) { err = AUBIO_FAIL; } o->silence_threshold = silence; return err; }
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; }