picture home | pixelblog | qt_tools

omino code blog

We need code. Lots of code.
David Van Brink // Sat 2008.03.8 00:33 // {wbl weird blinking lights}

Retro USB MIDI Device V

The MIDI USB Spec

Whoo-eee, the MIDI Over USB spec is a bit nightmarish.

http://www.usb.org/developers/devclass_docs/midi10.pdf

Sometimes with a spec, you can just tell what happened: Too many people in the room! The USB MIDI Spec describes some complicated way to express the internal topology of hypothetical musical devices using a tangle of nomenclature involving embedded and external jacks, pins, elements, entities, functions, and converters.

To add insult to ignorance, Chapter 8: Glossary defines useful terms like “Roland GS” and “Yamaha XG”, but remains silent on “jack”, “pin”, “element”, “entity”, “function”, and “converter”.

(To be sure, that’s my old world, at Apple, and Staccato, and my stint on the MIDI Manufacturer’s Association technical board. And if you think you’ve seen engineers argue over pointless details and speculative features, well, I assure you, musicians-who-have-engineering-day-jobs are the worst.)

Ok, the spec is a mess. The best way to figure this out, I think, is to look at something that works, and copy it. Under Mac OS X is a handy tool called USB Prober, installed with XCode.

Unfortunately, USB Prober doesn’t know about MIDI device descriptors. Fortunately, it lets you dump a hex file, and, fortunately, I like to write gobs of Perl code to parse the mess. Here’s the reference-relationship of the MIDI-specific descriptors for two devices which were handy.

The tombstones are USB “endoint descriptors”, and the roundrects are “jack descriptors”, each of which is either EMB or EXT. (Don’t try to attach meanings to EMB or EXT, it only confuses the puzzle. Really.) The Photon X25 gadget has two 5-pin MIDI plugs, and a built-in keyboard.

The Trigger Finger has one built-in drumpad controller, and one 5-pin MIDI plug.

A pattern begins to emerge! Not tidy, and not symmetric, but at least imitable.

And if you just love looking at data, the Perl descriptor dump is presented below.


poly@Omino-Lux ~/Sites/src/pic/UsbMisc: ./parseUsbConfig.pl photon.txt
+------------------------------
| INTERFACE 
| 09 04 03 00 02 01 03 00 02
| interfNum : 3        alt : 0   endpoints : 2       type : 1/3/0     str : 2   
+------------------------------
| (1/3/0) MIDI STREAMING HEADER 
| 07 24 01 00 01 51 00
|  version : 1.0   length : 81  
+------------------------------
| (1/3/0) MIDI STREAMING IN JACK 
| 06 24 02 01 01 02
|     type : embedded      id : 1        str : 2   
+------------------------------
| (1/3/0) MIDI STREAMING IN JACK 
| 06 24 02 02 02 02
|     type : external      id : 2        str : 2   
+------------------------------
| (1/3/0) MIDI STREAMING IN JACK 
| 06 24 02 02 03 02
|     type : external      id : 3        str : 2   
+------------------------------
| (1/3/0) MIDI STREAMING OUT JACK 
| 09 24 03 01 04 01 02 01 02
|     type : embedded      id : 4       pins : 1     jackId : 2     1stPin : 1        str : 2   
+------------------------------
| (1/3/0) MIDI STREAMING OUT JACK 
| 09 24 03 01 05 01 03 01 02
|     type : embedded      id : 5       pins : 1     jackId : 3     1stPin : 1        str : 2   
+------------------------------
| (1/3/0) MIDI STREAMING OUT JACK 
| 09 24 03 02 06 01 01 01 02
|     type : external      id : 6       pins : 1     jackId : 1     1stPin : 1        str : 2   
+------------------------------
| (1/3/0) ENDPOINT 
| 09 05 03 02 20 00 00 00 00
| endpoint : 3 OUT maxsize : 32  interval : 0   settings : BULK NONE DATA
+------------------------------
| (1/3/0) MIDI STREAMING JACKS ENDPOINT 3 OUT
| 05 25 01 01 01
|    jacks : 1   jackIdList : 1   
+------------------------------
| (1/3/0) ENDPOINT 
| 09 05 84 02 20 00 00 00 00
| endpoint : 4 IN  maxsize : 32  interval : 0   settings : BULK NONE DATA
+------------------------------
| (1/3/0) MIDI STREAMING JACKS ENDPOINT 4 IN 
| 06 25 01 02 04 05
|    jacks : 2   jackIdList : 4,5 
+------------------------------

poly@Omino-Lux ~/Sites/src/pic/UsbMisc: ./parseUsbConfig.pl triggerFingerConfig.txt 

2008.03.07 23:31:34 Displaying USB Descriptors From: triggerFingerConfig.txt

0000: 09 02 65 00 02 01 03 C0  3C 09 04 00 00 00 01 01  
0010: 00 00 09 24 01 00 01 09  00 01 01 09 04 01 00 02  
0020: 01 03 00 00 07 24 01 00  01 41 00 06 24 02 01 01  
0030: 00 06 24 02 02 02 00 09  24 03 01 03 01 02 01 00  
0040: 09 24 03 02 04 01 01 01  00 09 05 81 02 40 00 00  
0050: 00 00 05 25 01 01 03 09  05 02 02 40 00 00 00 00  
0060: 05 25 01 01 01 

+------------------------------
| CONFIG 
| 09 02 65 00 02 01 03 c0 3c
|   allLen : 101  interfs : 2         id : 1        str : 3   
+------------------------------
| INTERFACE 
| 09 04 00 00 00 01 01 00 00
| interfNum : 0        alt : 0   endpoints : 0       type : 1/1/0     str : 0   
+------------------------------
| (1/1/0) AUDIO CONTROL INTERFACE 
| 09 24 01 00 01 09 00 01 01
|  version : 1.0   allLen : 9    interfs : 1       list : 1   
+------------------------------
| INTERFACE 
| 09 04 01 00 02 01 03 00 00
| interfNum : 1        alt : 0   endpoints : 2       type : 1/3/0     str : 0   
+------------------------------
| (1/3/0) MIDI STREAMING HEADER 
| 07 24 01 00 01 41 00
|  version : 1.0   length : 65  
+------------------------------
| (1/3/0) MIDI STREAMING IN JACK 
| 06 24 02 01 01 00
|     type : embedded      id : 1        str : 0   
+------------------------------
| (1/3/0) MIDI STREAMING IN JACK 
| 06 24 02 02 02 00
|     type : external      id : 2        str : 0   
+------------------------------
| (1/3/0) MIDI STREAMING OUT JACK 
| 09 24 03 01 03 01 02 01 00
|     type : embedded      id : 3       pins : 1     jackId : 2     1stPin : 1        str : 0   
+------------------------------
| (1/3/0) MIDI STREAMING OUT JACK 
| 09 24 03 02 04 01 01 01 00
|     type : external      id : 4       pins : 1     jackId : 1     1stPin : 1        str : 0   
+------------------------------
| (1/3/0) ENDPOINT 
| 09 05 81 02 40 00 00 00 00
| endpoint : 1 IN  maxsize : 64  interval : 0   settings : BULK NONE DATA
+------------------------------
| (1/3/0) MIDI STREAMING JACKS ENDPOINT 1 IN 
| 05 25 01 01 03
|    jacks : 1   jackIdList : 3   
+------------------------------
| (1/3/0) ENDPOINT 
| 09 05 02 02 40 00 00 00 00
| endpoint : 2 OUT maxsize : 64  interval : 0   settings : BULK NONE DATA
+------------------------------
| (1/3/0) MIDI STREAMING JACKS ENDPOINT 2 OUT
| 05 25 01 01 01
|    jacks : 1   jackIdList : 1   
+------------------------------

poly@Omino-Lux ~/Sites/src/pic/UsbMisc: 


1 comments
Tracking Gamed Ankh and the MetaReal World of David Van Brink // Mon 2008.03.10 20:298:29 pm

[…] Ankh in 1984, because i have never seen the box until now, (pic above). The creator turns out to be David Van Brink a hardware hacker amongst other things. only props go out. They dont make em like they used […]

oh, i dont know. what do you think?



(c) 2003-2011 omino.com / contact poly@omino.com