DaisyExamples icon indicating copy to clipboard operation
DaisyExamples copied to clipboard

WIP: Patch/Nimbus: Midi Support

Open baumgartnerniels opened this issue 4 years ago • 6 comments

Hi

I'm working on a feature to control all the parameters in the Nimbus Firmware with midi.

I'm marking this as Work in Progress, as the midi handling in the current libdaisy is a bit buggy. Never the less, here is a first working draft. It will work as long as there are no Midi RealTime (clock) messages coming in. Otherwise (and that is usually the case when connecting a midi sequencer) the Midi parser in libdaisy has to be patched to ignore the buggy clock messages. I saw a bit too late that there is a PR https://github.com/electro-smith/libDaisy/pull/350 fixing the Midi parser. I think it makes sense to change this to use the new parser as soon as the mentioned PR is merged.

If you want to test this out in the meantime, here is the midi parser patch:

diff --git a/src/hid/midi.cpp b/src/hid/midi.cpp
index 1df5860..7cb4ec4 100644
--- a/src/hid/midi.cpp
+++ b/src/hid/midi.cpp
@@ -77,8 +77,10 @@ void MidiHandler::Parse(uint8_t byte)
     switch(pstate_)
     {
         case ParserEmpty:
+            // ignore single-byte realtime (Clock) messages
+            if (byte == kRealTimeMask) {}
             // check byte for valid Status Byte
-            if(byte & kStatusByteMask)
+            else if(byte & kStatusByteMask)
             {
                 // Get MessageType, and Channel
                 incoming_message_.channel = byte & kChannelMask;

baumgartnerniels avatar Jun 08 '21 21:06 baumgartnerniels

just marked as a draft since you have it marked as WIP. Feel free to mark it as ready to review when it's ready 😄

stephenhensley avatar Jun 10 '21 23:06 stephenhensley

Also, we'll be reviewing, and getting the MidiHandler updates merged into libdaisy (and the examples here) sometime next week. Since I know this is semi-dependent on that, that I'd give you an update since that PRs been sitting for a little.

stephenhensley avatar Jun 10 '21 23:06 stephenhensley

@baumgartnerniels It's been a little bit, but I just wanted to ping you to see if you had any interest in picking this back up?

All the MIDI stuff you were initially waiting on should be resolved (this could actually work with UART and/or USB MIDI now as well).

stephenhensley avatar Dec 01 '21 21:12 stephenhensley

Hi @stephenhensley Right! Sorry, I kind of forgot about this as i just quickly patched the missing bits back then and flashed it to my unit. I'm in the middle of an exam period atm. But I could probably clean this up sometime in january/february.

baumgartnerniels avatar Dec 01 '21 21:12 baumgartnerniels

@baumgartnerniels sounds good!

No worries. I just wanted to ping since the PR has been sitting for a while, and it is certainly a very cool feature!

Thanks!

stephenhensley avatar Dec 01 '21 22:12 stephenhensley