void Note2midi::send_noteon (int pitch, int velo) { // smpl_t mpitch = pitch; smpl_t mpitch = floor (aubio_freqtomidi (pitch) + .5); note.event.body.size = 3; note.event.body.type = map->map(map->handle, LV2_MIDI__MidiEvent); note.event.time.frames = counter; note.msg[2] = velo; note.msg[1] = mpitch; if (velo == 0) { printf("off "); note.msg[0] = 0x80; /* note off */ } else{ printf("on "); note.msg[0] = 0x90; /* note on */ } printf("FREQ :%i\n", pitch); printf("MIDI :%f\n\n", mpitch); lv2_atom_sequence_append_event(this->out, out_capacity, ¬e.event); }
smpl_t freqconvmidi (smpl_t f, uint_t samplerate UNUSED, uint_t bufsize UNUSED) { return aubio_freqtomidi (f); }
smpl_t aubio_bintomidi (smpl_t bin, smpl_t samplerate, smpl_t fftsize) { smpl_t midi = aubio_bintofreq (bin, samplerate, fftsize); return aubio_freqtomidi (midi); }