Programming the Pocket Miku, Details, Part 1

The Miku, AKA – the NSX-39, is based on the Yamaha NSX-1 chip, which is the heart of the Vocaloid products, and includes the eVocaloid system. It has a USB connector, so you can plug it into your PC or Mac, and run it using any sequencer software you like (the Perfect Guide book focuses mainly on Garage Band). Most of the examples in the Perfect Guide revolve around tweaking the sequencer to customize it for the Miku, or showing how to send SysEx messages within the body of a song. But, if you have Java, you can create your own applet to make the Miku do what you want as a regular synthesizer.

The starting point is the Yamaha MIDI spec doc. I wish it was more instructional, but it’s basically just a bunch of code tables. The first table in the Yamaha doc has the channel messages. Since the Yamaha MIDI spec is in English, there’s no point in repeating all the codes here. The important things to note are the Control Change and Mode Messages, which both use the “Bn” status byte (where “n” is the MIDI channel you want to control, 0-15. The Pocket Miku can play 16 instruments simultaneously, with channel 0 assigned to eVocalod and channel 9 is the internal General MIDI drum kit.)


The Vocaloid system apparently (I’m still trying to understand this, since the documentation is all in Japanese) divides speech phonemes up into “heads”, “bodies” and “tails”, combined with “joints” and “shots” (as mentioned in the product brief). These phoneme components can be mixed and matched as part of Yamaha’s “Real Acoustic Sound” (RAS). I mention this because the Yamaha MIDI doc shows which MIDI options apply to which operating mode, including GM (General MIDI), eVocaloid and RAS. But, the Pocket Miku Perfect Guide Book only shows the GM and eVocaloid modes. So far, I haven’t found any documentation on how to program the RAS mode and I’m thinking that Miku doesn’t support it.

The other reason for mentioning RAS is that in the MIDI doc, there are three sound banks, which you can select using Control Change: “Normal” (0x00), “Drum Kit” (0x7F) and “RAS” (0x08). The Perfect Guide only gives the “Normal” and “Drum Kit” banks. The “Normal” bank contains the standard 128 instrument voices that all MIDI devices support. The “Drum Kit” bank is actually the percussion voices available on channel 9 of the “Normal” bank.


To select sound banks in Java:

ShortMessage myMsg1 = new ShortMessage();
ShortMessage myMsg2 = new ShortMessage();
int channel = 1;  // 0 to 15
myMsg1.setMessage(ShortMessage.CONTROL_CHANGE + channel, 0x00, msb);  // MSB = 0x00 or 0x7F.
myMsg2.setMessage(ShortMessage.CONTROL_CHANGE + channel, 0x20, 0x00);
nsxRcvr.send(myMsg1, -1);
nsxRcvr.send(myMsg2, -1);

To select specific instrument voices within the selected bank:

myMsg1.setMessage(ShortMessage.PROGRAM_CHANGE + channel, n, 0);  // n = 0x00 – 0x7F
nsxRcvr.send(myMsg1, -1);

As mentioned above, the NSX-39 supports all 16 MIDI channels, with numbering starting at 0 (the Perfect Guide starts numbering at 1). Channel 0 is for the eVocaloid; 9 is the Drum Kit.

To select the channel, look closer at the above code:

channel = 0; // For channel 0.

CC List:

The other CC parameters may need a little description. Note that not all of them apply to General MIDI or eVocaloid. Also, you need to turn General MIDI ON (AKA: NSX-1 compatibility mode) to get things like Portamento to activate.

Modulation: Varies the note pitch.
Portamento Time: Time needed to sweep from one note to the next.
Panpot: Pans stereo sound between the left and right speakers.
Expression: Acts like a volume control.
Sustain (Damper): How long the note plays after Note Off.
Portamento: Steps to sweep from one note to the next.
Sostuneto: Switches “sustain note” on and off.
Soft Pedal: Switches “soften note” on and off.
Harmonic Control: Varies the amount of harmonics added to the note.
Release Time: Changes the ADSR release time.
Attack Time: Changes the ADSR attack time.
Decay Time: Changes the ADSR decay time.
Brightness: Adds higher frequencies to the note.
Vibrato Rate: Cycle rate for the vibrato effect.
Vibrato Depth: Size of pitch variation applied to the note.
Vibrato Delay: Time after the note starts that vibrato is applied.
General Purpose Control: RAS only, not included in the Perfect Guide.
Portamento Control: Key to apply portamento to.
Effect 1 Depth: Applies reverb (echo) to the note.
Effect 3 Depth: Applies a “chorus” effect to the note.
Effect 4 Depth: Applies a “variation” effect to the note.
RPN Increment: Increments the current RPN parameter.
RPN Decrement: Decrements the current RPN parameter.
NRPN LSB: Allows you to change NRPN parameters.
NRPN MSB: Allows you to change NRPN parameters.
RPN LSB: Allows you to change RPN parameters.
RPN MSB: Allows you to change RPN parameters.


Some of the above parameters only work for General MIDI, when General MIDI is turned on, and that’s something you do through SysEx (System Exclusive) messages, which I’ll get to later.  I’ll cover RPN and NRPN messages next time.


Previous Post
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: