![](/media/cache/profiles/ddac1f6f13bb372a177804adcd3b8a31.50x50_q85.jpg)
Quick hack to make NSX-39 (Poke-Miku) USB MIDI device to speak "mbed" from mbed which acts as an USB host.
Dependencies: FatFileSystem mbed
Fork of MIDI_BlueUSB by
Description of the project
This is quick hack to control Poke-miku (NSX-39) from mbed. The mbed acts as an USB host and controls USB MIDI device NSX-39. It speaks "mbed" if you send "s¥n" from virtual USB serial (connected to PC or Mac) or push SW connected to p21. It plays MIDI file "test.mid" on local file-system if you push SW connected to p22. You can find files that I have tested at the bottom. The standard MIDI file support is still preliminary. See TestShell.cpp for the hack. This program is derived from MIDI_BlueUSB (http://mbed.org/users/radiojunkbox/code/MIDI_BlueUSB/) by Radio Junk Box.
ポケミク(NSX-39)を無改造のままmbedから鳴らせるようにしてみました。mbedがUSB hostになって、USB MIDIデバイスのポケミクを鳴らします。mbedのバーチャルシリアル(USBシリアル)にPCからs\nを送るか、p21につないだスイッチを押すとmbedとしゃべります。p22につないだスイッチを押すと、ローカルファイルシステム(.binと同じ場所)に保存した test.mid を再生します。試したファイルは下にある test1.mid と test2.mid です。MIDIファイルのサポートはまだまだ完全とはいえません。
tested MIDI files
Video: Poke-miku speaks `mbed'
Diff: main.cpp
- Revision:
- 2:7576d1327cf1
- Parent:
- 1:892f8922bdc4
- Child:
- 3:31fbce33c25b
diff -r 892f8922bdc4 -r 7576d1327cf1 main.cpp --- a/main.cpp Sat Apr 05 06:25:43 2014 +0000 +++ b/main.cpp Sun Apr 27 01:36:30 2014 +0000 @@ -29,6 +29,9 @@ #include "Utils.h" #include "FATFileSystem.h" +#include "common.h" +#include "TestShell.h" + int MassStorage_ReadCapacity(int device, u32* blockCount, u32* blockSize); int MassStorage_Read(int device, u32 blockAddr, u32 blockCount, u8* dst, u32 blockSize); int MassStorage_Write(int device, u32 blockAddr, u32 blockCount, u8* dst, u32 blockSize); @@ -115,14 +118,24 @@ return c; } -void TestShell(); -void InitSerialMIDI(); // Added by RadioJunkBox +bool IsConsoleReadable() +{ + return pc.readable(); +} +static DigitalIn mySW(SWpin); +static DigitalOut myLED(LED1); + int main() { // pc.baud(460800); printf("BlueUSB\nNow get a bunch of usb or bluetooth things and plug them in\n"); InitSerialMIDI(); // Added by RadioJunkBox + if (mySW.read() == 0) { + myLED = 1; + wait(0.5); + myLED = 0; + } TestShell(); }