Teensy 3.6 USB MIDI host development status

Status
Not open for further replies.

mattomatto

Well-known member
Hi Paul,

I'm keen to make use your USB MIDI Host support on Teensy 3.6 as soon as I can! What's it's current state of development?

If you need someone to do some testing, please let me know and I'll be happy to oblige.

Thanks
 
Look at File > Examples > USBHost_t36 > Test.

Since releasing Teensyduino 1.36, I've been focusing on other stuff. Planning to work on USB host again in June.
 
Usb midi

I'm also very interested in this capability, so I hope you will keep it on the agenda. Thanks, Paul!

Look at File > Examples > USBHost_t36 > Test.

Since releasing Teensyduino 1.36, I've been focusing on other stuff. Planning to work on USB host again in June.
 
Look at File > Examples > USBHost_t36 > Test.

Since releasing Teensyduino 1.36, I've been focusing on other stuff. Planning to work on USB host again in June.


Hey Paul,

Just checking in on this - when do you plan to progress development on USB Host?

I'm interested in MIDI host for multiple devices through a hub, and unfortunately UHS_30 and USB_HostShield_2.0 both have bugs which prevent this from working for me.

Many thanks,

Matt
 
I'm interested in MIDI host for multiple devices through a hub, and unfortunately UHS_30 and USB_HostShield_2.0 both have bugs which prevent this from working for me.

I tested 2 MIDI devices through a hub. It works, at least with the 2 devices I have... a cheap keyboard and a cheap drum pad thingie. So far the MIDI device driver only receives messages. I plan to add transmit, but so far I don't have any commercial devices (other than another Teensy) that receive USB MIDI messages.
 
I've been away for a while and just found the USB host lib for the 3.6. I tested it with an Oxygen 25 controller and it works great! My next step is to link one of the color displays and audio boards to it and start monkeying with synth output. I haven't tried it through a hub, but will at some point. I could envision a 3.6 driving a 3.2 as a synth through usb midi, or as a standalone USB midi bridge to whatever. Very cool stuff, thanks for working on this Paul.
 
I've been hoping the MIDI driver would get some work, specifically sending out MIDI Bytes, this would make all my projects a lot easier as at the moment i have to use a USB Host Shield which takes up extra pins.

Hopefully Paul will be able to implement sending bytes to the connected MIDI device :)
 
Can you be more specific about "specifically sending out MIDI Bytes"?

The MIDI protocol works in messages. With 31250 baud serial, these are usually 2 or 3 bytes. With USB, the MIDI messages are packed into 32 bit fields, even when only 2 or 3 bytes are meaningful.
 
Hey Paul, yes I just have a bad habit of calling a midi message MIDI Bytes as midi data bytes are only 7-bits, sorry for the confusion, I just really want to be able to transmit midi messages like PC, CC and specially sysex, you had mentioned that you only have other teensys to transmit and test it with but if you implement it i could test it here as well using my guitar processors which have MIDI support.
 
Hi Paul! I've been putting together an audio project and have incorporated your USB MIDI host, it's working (nearly) perfectly! :) I bought a Pyle PMIDIKPD50 which has keys, pads, and encoders. I'm using a "stacked" (4+4=7) hub and am able to receive messages without problem.
I did see one issue though... When multiple MIDI commands are strung together in the same transfer, the 2nd/3rd commands "repeat" in all following single command transfers. Investigating further, I believe this is already on your TODO list...
In midi.cpp, MIDIDevice::rx_data apparently doesn't know the receive length and processes the whole thing. When single commands are sent the remnant of the previous 2nd/3rd processes again. I see the TODO is "use actual received length", which of course id the correct fix. I looked at transfer->length, but it was always 64 (if it were that easy, you would have implemented it) so I hacked in something to zero it out after adding the message to the receive queue...
Code:
void MIDIDevice::rx_data(const Transfer_t *transfer)
{
	println("MIDIDevice Receive");
	print("  MIDI Data: ");
	print_hexbytes(transfer->buffer, rx_size);
	uint32_t head = rx_head;
	uint32_t tail = rx_tail;
	uint32_t len = rx_size >> 2; // TODO: use actual received length
	for (uint32_t i=0; i < len; i++) {
		uint32_t msg = rx_buffer[i];
		if (msg) {
			if (++head >= RX_QUEUE_SIZE) head = 0;
			rx_queue[head] = msg;
			rx_buffer[i]=0; // <-----  unknown length work-around 12/3/17 TJS
		}
	}
<snip>

This fixes the problem with this version, sorry I wasn't able to dive deep enough to implement the correct length TODO.
I have USBHOST_PRINT_DEBUG enabled captures if you like, but I'm sure you get the idea. ;)
Everything else seems to working perfectly, thank you for all your hard work Paul!
 
Is this the right library to use (on Teensy3.6) to implement a USBMIDI-to-LegacyMIDI adapter?
I'd like to build "something" which accepts a USB MIDI keyboard and just forwards everything to a DIN MIDI (serial/legacy) OUT port (using this circuit https://www.pjrc.com/teensy/td_libs_MIDI.html)
This would allow me to control old MIDI synths from current USB keyboards (like M-Audio and the likes).
 
I am also looking at USB HOST MIDI implementation and would love to build out *sending* MIDI (it currently only receives MIDI input).
I couldn't find any of the USB HOST device drivers that send data out... to get an idea of how to actually send data back out using the USB host port.

Is there a good resource to get started or someone who can kickstart the process with some basic code for sending USB output to through a host driver?
 
Is this the right library to use (on Teensy3.6) to implement a USBMIDI-to-LegacyMIDI adapter?
I'd like to build "something" which accepts a USB MIDI keyboard and just forwards everything to a DIN MIDI (serial/legacy) OUT port (using this circuit https://www.pjrc.com/teensy/td_libs_MIDI.html)
This would allow me to control old MIDI synths from current USB keyboards (like M-Audio and the likes).

Yes, confirmed, Teensy 3.6 and USBHost_t36 would be the way to build this sort of converter. You would write a fairly simple program to receive the MIDI messages you're interested in forwarding, and then just use the normal MIDI library to transmit them.

The Teensy 3.6 output is only 3.3V. Usually that can work if you use lower value resistors. Or you could add a 3 to 5V buffer chip, like 74AHCT125, to transmit a fully 5V signal with the usual 220 ohm resistors.
 
Yes, confirmed, Teensy 3.6 and USBHost_t36 would be the way to build this sort of converter. You would write a fairly simple program to receive the MIDI messages you're interested in forwarding, and then just use the normal MIDI library to transmit them.

The Teensy 3.6 output is only 3.3V. Usually that can work if you use lower value resistors. Or you could add a 3 to 5V buffer chip, like 74AHCT125, to transmit a fully 5V signal with the usual 220 ohm resistors.

Thanks a lot Paul!
Lots of good infos.
 
Any change MIDI transmition will be added next? another addition that would be great would be being able to check the state of the usb port, specifically if there's a device attached
 
MIDI transmission would be great. Most important use-case for me would be to light up the keys on the pad controller I plug in.
 
Ok, I've made a first attempt to add MIDI transmit.

https://github.com/PaulStoffregen/USBHost_t36/commit/fcfecee43b2d41826418244a5fb23e601e40dafb

This should work, but it's not as efficient as it could be. Only 1 message is sent in each packet, rather than packing up to 16 if you're sending rapidly. It should work, but limited to about the same speed as regular serial MIDI.

Please let me know how this works for you? I don't own much MIDI gear and I'm not a musician, so I'm really depending on feedback for improving MIDI support.
 
(I'm traveling and don't have access to electronics stuff or to MIDI stuff until the last week of January, unfortunately. Or I would test it.)
 
Hi Paul, testing it today, i just wrote a couple of sketches to test between teensy's 3.2 as clients for the 3.6 and then i'll test it with all my midi gear, may I also suggest adding a getSysExArray() like the usbMIDI library? i'll post results in the upcoming hours, thank you for your work!!!!!!!!!!
 
Status
Not open for further replies.
Back
Top