Changeset 9562f08


Ignore:
Timestamp:
Jul 22, 2016, 9:30:31 PM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
65fc06f
Parents:
f280ebd
Message:

examples/utils.c: change send_noteon to accept floating point midi note number

Location:
examples
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • examples/aubionotes.c

    rf280ebd r9562f08  
    2727
    2828aubio_notes_t *notes;
    29 uint_t lastnote = 0;
     29smpl_t lastmidi = 0.;
    3030
    3131void process_block (fvec_t *ibuf, fvec_t *obuf)
     
    3434  // did we get a note off?
    3535  if (obuf->data[2] != 0) {
    36     send_noteon(obuf->data[2], 0);
     36    lastmidi = aubio_freqtomidi (obuf->data[2]) + .5;
     37    send_noteon(lastmidi, 0);
    3738  }
    3839  // did we get a note on?
    3940  if (obuf->data[0] != 0) {
    40     send_noteon(obuf->data[0], obuf->data[1]);
    41     lastnote = (uint_t) floor(obuf->data[0]);
     41    lastmidi = aubio_freqtomidi (obuf->data[0]) + .5;
     42    send_noteon(lastmidi, obuf->data[1]);
    4243  }
    4344}
     
    6869
    6970  // send a last note off
    70   send_noteon (lastnote, 0);
     71  send_noteon (lastmidi, 0);
    7172
    7273  del_aubio_notes (notes);
  • examples/utils.c

    rf280ebd r9562f08  
    182182
    183183void
    184 send_noteon (int pitch, int velo)
    185 {
    186   smpl_t mpitch = floor (aubio_freqtomidi (pitch) + .5);
     184send_noteon (smpl_t pitch, smpl_t velo)
     185{
    187186#ifdef HAVE_JACK
    188187  jack_midi_event_t ev;
     
    192191  if (usejack) {
    193192    ev.buffer[2] = velo;
    194     ev.buffer[1] = mpitch;
     193    ev.buffer[1] = pitch;
    195194    if (velo == 0) {
    196195      ev.buffer[0] = 0x80;      /* note off */
     
    205204    outmsg ("\n");
    206205  } else {
    207     outmsg ("%f\t", mpitch);
     206    outmsg ("%f\t", pitch);
    208207    print_time (blocks * hop_size);
    209208    outmsg ("\t");
  • examples/utils.h

    rf280ebd r9562f08  
    6464
    6565typedef void (aubio_print_func_t) (void);
    66 void send_noteon (int pitch, int velo);
     66void send_noteon (smpl_t pitch, smpl_t velo);
    6767
    6868/** common process function */
Note: See TracChangeset for help on using the changeset viewer.