Daisy MIDI Input via USB Workaround/ Usage in Windows

Hello, while starting on a synth project on my Daisy Pod, I saw a few threads asking about this feature only to see that the MIDIHandler does not directly support this feature yet.

Since I have not seen anything similar posted here yet: I would like to demonstrate a simple temporary workaround, which is based off of the MIDI and USB CDC seed examples.

In short, my code copies the data buffer and size from the USB callback and sets a flag to notify that the there are MIDI packets to process. Once the main function is called, my code then simply passes each byte through the MIDIHandler’s parse function, which will then create Midi Events that will later be processed.

Example Code:

   static DaisyPod pod;
   static MidiHandler midi;
   uint8_t buffer[128];
   bool MsgRcvd = false;
   uint8_t MsgSize = 0;
   void UsbCallback(uint8_t* buf, uint32_t* len)
     if(!buf || !len)
     uint8_t tmpSize;
     if(*len < 128U)
       tmpSize = *len;
       tmpSize = 128U;
     for(size_t i = 0; i < tmpSize; i++)
       buffer[i] = buf[i];
     MsgRcvd = true;
     MsgSize = *len;
   // …
   int main(void)
     // Initialize MIDI with UART so that state machine is initialized
     midi.Init(MidiHandler::INPUT_MODE_UART1, MidiHandler::OUTPUT_MODE_NONE);
     // …
     pod.seed.usb_handle.SetReceiveCallback(UsbCallback, UsbHandle::FS_INTERNAL);
       // If there is USB Data to process, process the data and clear the buffers
       if(MsgRcvd == true)
         for(int i = 0; i < MsgSize; ++i)
           buffer[i] = 0;
         MsgRcvd = false;
          MsgSize = 0U;
        // Handle MIDI Events

Usb Device Setup
Port Settings:
Data bits: 8
Parity: None
Stop Bits: 1
Flow Control: None

Tools for Midi
LoopMidi (Virtual Midi port)
Hairless MIDI Serial (Used to route messages from the Virtual Midi port to the Daisy’s COM port):

Other tools:
Realterm: Super useful USB Com port tool for testing messages, I was using this to quickly test the response when the keyboard did not work at the first attempt.

Hopefully this information is useful to anyone else!

This looks promising!
However this does not compile out of the box (in my setup):

error: ‘MidiHandler’ does not name a type
static MidiHandler midi;

Am I missing an #include or what could cause this? Any help is appreciated!

Assuming that you are also using the pod, these are my includes:

#include "daisysp.h"
#include "daisy_pod.h"
using namespace daisysp;
using namespace daisy;
1 Like

Thx for your reply. The code is compiling now.
I’m using a Seed, but that does not seem to make a difference.

The problem was caused by the sequence of defining the namespaces and then the MidiHandler, which I had swapped.

I’m having difficulties getting Ableton to see the Daisy via USB. Do I need to do something additional for this to work?

Since Daisy acts as a COM port with this setup, there are 2 things that are needed to get messages to the Daisy:

A virtual Midi Host that Ableton Live or any DAW can use: I used LoopMidi, which is in the reference post. After installation, you just need to add a loopback MIDI port by pressing the “+” button on the bottom left.

Secondly, you need a tool to route the LoopMidi’s messages to the Com port, for this I used Hairless MIDI Serial. This is also in the reference post, notice how “MIDI In” is set to the loopMIDI port, this is where Hairless will grab the MIDI messages from to route to the USB Serial Device.

Also note the “Serial<->MIDI Bridge On” checkbox: every time that I reset the daisy, I have to manually turn this off/on for messages, perhaps this is when Hairless opens up a connection with the Daisy’s COM port.

Lastly, in Ableton itself I have used the following settings:

One additional caveat: it seems that the MIDI loop driver mirrors its input back to its own output, meaning that if you use “all midi ins” in Ableton, you will get a never ending feedback loop of the MIDI messages that you send to the device. To get around this, I explicitly set the “MIDI From” field, so that the loopMidi device only receives messages from the piano roll or my midi keyboard. There may be other Virtual Midi ports for Windows which do not loop messages back, but I could not find one quickly in a pinch.

Ableton’s website seems to give Loop Midi as the only 64 bit option for Windows:

Hope this all helps.

Thx for your reply! I’m using a Mac, so according to the Ableton page I will have to go the IAC route.