Sorry this forum is so dead and unhelpful here!
What you’re talking about is daisy as a USB host, which I just had a search around and found this page talking about it: USB Host/OTG support
I would suggest just getting a different keyboard if it doesn’t have a normal midi in/out.
Think what you need for basic midi operation is an optoisolator, a diode and a resistor, along with the midi din or you can do over 3.5mm jack, that’s getting more common, as to save space in designs.
Midi uses the UART pins on the daisy, RX/TX I believe off the top off the noggin.
To display your values as your going via the serial monitor, you can use an extension in vscode to connect to the daisy and do serial monitoring.
There’s a logger class, have a look in the examples.
your midi reading function is here:
// Typical Switch case for Message Type.
void HandleMidiMessage(MidiEvent m)
{
switch(m.type)
{
case NoteOn:
{
NoteOnEvent p = m.AsNoteOn();
char buff[512];
sprintf(buff,
"Note Received:\t%d\t%d\t%d\r\n",
m.channel,
m.data[0],
m.data[1]);
hw.seed.usb_handle.TransmitInternal((uint8_t *)buff, strlen(buff));
// This is to avoid Max/MSP Note outs for now..
if(m.data[1] != 0)
{
p = m.AsNoteOn();
osc.SetFreq(mtof(p.note));
osc.SetAmp((p.velocity / 127.0f));
}
}
break;
case ControlChange:
{
ControlChangeEvent p = m.AsControlChange();
switch(p.control_number)
{
case 1:
// CC 1 for cutoff.
filt.SetFreq(mtof((float)p.value));
break;
case 2:
// CC 2 for res.
filt.SetRes(((float)p.value / 127.0f));
break;
default: break;
}
break;
}
default: break;
}
}
this what you do in the main loop to get it crack-a-lacking:
hw.midi.StartReceive(); // start receive function, nice and self explanatory!
for(;;)
{
hw.midi.Listen(); // listen like a good little ear person
// Handle MIDI Events
while(hw.midi.HasEvents()) // while this has some event
{
HandleMidiMessage(hw.midi.PopEvent()); // handle the sausages
}
}
// Typical Switch case for Message Type.
void HandleMidiMessage(MidiEvent m)
{
switch(m.type)
{
case NoteOn:
{
// this essentially your call back for midi Note on messages.
// this will fire when there's a note on event. You could try logging this data now
// as a challenge, find the Logger class, find how it's printing, and now use that
// information to print the midi value, once you've done setting up the logger.
// you can just use hw.PrintLine() to print your debugging statements
[spoiler] // remember to : hw.StartLog(true); //true == wait for PC, will block here until you connect[/spoiler]
}
Hth’s.