eVY1をAndroidのUSB HOSTに接続

日本Androidの会 横浜支部で動いてるの見せてもらったのでマネしてみました。


eVY1をAndroidに接続するとこんな感じ

Device Info 
Device Path: /dev/bus/usb/002/002
Device Class: Use class information in the Interface Descriptors (0x0)
Vendor ID:  2938
Vendor Name:  
Product ID:  07d2
Product Name:  

Interfaces 
Interface #0 
Class: Audio Device (0x1)
	Endpoints: none
Interface #1 
Class: Audio Device (0x1)
	Endpoint: #0
Address        : 2 (000000010)
Number         : 2
Direction      : Outbound (0x0)
Type           : Bulk (0x2)
Poll Interval  : 0
Max Packet Size: 64
Attributes     : 000000010
	Endpoint: #1
Address        : 129 (10000001)
Number         : 1
Direction      : Inbound (0x80)
Type           : Bulk (0x2)
Poll Interval  : 0
Max Packet Size: 64
Attributes     : 000000010


USB MIDIの規格書はここにあった
Universal Serial Bus Device Class Definition for MIDI Devices
http://www.usb.org/developers/devclass_docs/midi10.pdf


USB HOSTの部分は作ろうと思ったのですがドライバーがあったので使わせてもらいました。
kshoji/USB-MIDI-Driver
https://github.com/kshoji/usb-midi-driver


Galaxy Nexus(4.2.2)にUSB HOSTケーブルでeVY1を接続
アプリで認識されて音がでることは確認しました


sendMidiSystemExclusiveで歌詞を送ればよいみたい

このコードだと固定で「わ」って歌います

 byte systemExclusive[] = {(byte)0xf0, (byte)0x43, (byte)0x79, (byte)0x09,
 (byte)0x00, (byte)0x50, (byte)0x10, 'w', ' ', 'a', (byte)0x00, (byte)0xf7};
 midiOutputDevice.sendMidiSystemExclusive(0, systemExclusive);
 midiOutputDevice.sendMidiNoteOn(0, 0, note, 127);


アプリを作りました

ローマ字入力で歌詞をいれてボタンを押してくと歌う
追加モードも付けた