Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 2 FirstFirst 1 2
Results 26 to 30 of 30

Thread: MIDI Problems

  1. #26
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,124
    Quote Originally Posted by el_supremo View Post
    That only leaves the mystery of how this code was supposed to work on a Mega and Teensy2 ...
    OP namedrops 'Hairless' which appears to be a kludge around Arduino's clumsy USB connectivity. So it was using regular MIDI to send via serial USB connection.

    Of course this why so many MIDI projects find their way on to Teensy but the non-symmetrical implementation in usbMIDI compared with the standard MIDI library does lead to some confusion and porting working sketches isn't as trivial as it might be.

  2. #27
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,109
    I've just realized why the <<7 was necessary.
    The original code had its own function to send the MIDI message:
    Code:
    MIDImessage(pitchBEND, 0, bendVal);
    The three bytes were sent in the order they appear as arguments. Therefore the low-order 7 bits of bendVal were sent as the third byte of the message which is the high-order 7 bits of the pitchbend value. In effect, it was doing an implicit <<7 of the value.
    When the switch was made to usbSerial, it uses this statement structure
    Code:
    usbMIDI.sendPitchBend( bendVal,1);
    The bendVal is split into low- and high-order pieces. In this case the low-order 7 bits of bendVal are sent as the low-order 7 bits of the command (2nd byte). To make this work the same as the original code, the <<7 is necessary.

    Pete

  3. #28
    Quote Originally Posted by el_supremo View Post
    That only leaves the mystery of how this code was supposed to work on a Mega and Teensy2 but needs a modification to work with USBSerial when AFAICT all the drivers involved handle the pitchbend value in the same way.

    Pete
    Yes......maybe the other ones aren't using the full 14 bit and this: MIDImessage(pitchBEND, 0, bendVal); sends a different byte order.........As I say, I'm more a muso than a coder. Thanks again.

  4. #29
    Senior Member Pensive's Avatar
    Join Date
    Aug 2014
    Location
    Basingstoke, UK
    Posts
    561
    Love your project sir, that's awesome!!!!!!

  5. #30
    Quote Originally Posted by Pensive View Post
    Love your project sir, that's awesome!!!!!!
    Cheers, I hope to head over your way next year for the festivals - you guys have some brilliant ones!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •