Programming the Pocket Miku, Details, Part 6


Most of what I’d done in the last blog entry was to summarize the translations of Polymoog’s MIDI guide, which brings me to page 16 of that guide. Most of what follows concerns manipulating the pointer to the phoneme character strings that Miku “sings” when you touch the stylus to the carbon keyboard. You can issue these commands either as a “command” (0D) or as an instruction string placed in one of the command slots (0C) to be implemented when a particular button action occurs (pressing “A”, or releasing SHIFT + “U”).

F0 43 79 09 11 0C … F7, or
F0 43 79 09 11 0D … F7

These character pointer operations include setting the pointer (MOJI_SET_KASHI = 09 05 00), incrementing the pointer (KASHI_POS_INC = 09 01 00 00), selecting the pointer position (0 to 63: KASHI_POS_SEL = 09 02 00 nn, where nn is 00 to 3F), selecting the lyrics slot (KASHI_SLOT_SEL = 09 03 00 0n, where n is 0 to F), and phoneme character entry (MOJI_SEL = 09 04 00 nn, where nn is 00 to 7F from the character table on page 10 of Polymoog’s MIDI guide). (Japanese translations appear below.)

Page 17 gets into some of the other commands from the command table on page 23, such as NOTEON, NOTEOFF, ADV_PB (pitch bend), VOL_UP, VOL_DOWN, etc. They work as you’d expect them to as regular MIDI messages.

F0 43 79 09 11 0D 0A 02 00 00 F7 – Like pressing the Volume Up key on the front panel.

VOL_SET: Set volume level (0-8)
VOL_UP: Increase volume one level
VOL_DOWN: Decrease volume one level

KEY_UP: With NOTEON or REVOICE,
KEY_DOWN: changes the keyboard up or down one octave.

TUNING_STOP: Lets you calibrate the carbon keyboard.
TUNING_START:
TUNING_TOGLE:

NSX1_GOKAN_OFF: Turns NSX-1 compatibility mode on and off.
NSX1_GOKAN_ON:
NSX1_GOKAN_TOGLE:

MODE_DOREMI: Puts keyboard into Do-Rei-Mi mode.
MODE_NORMAL: Miku sings from the lyrics tables.

MIDI_RESET: (Panic) Resets the phoneme chip.

ROM_RESET: (Initialize) Returns the Flash ROM settings to the defaults .

Section 3-6 on page 20 discusses the concept of CACCO, which is the Japanese word for “brackets” or “parentheses”. This mode is used to assign a string of unrelated commands to a specific command slot as if they were within a pair of parentheses. Once CACCO_START is encountered, the NSX-39 will execute the subsequent commands until encountering CACCO_END.

The example is to assign certain commands to the SHIFT button when pressed (CS_SW7D = 11).

0C 02 00 00 – CACCO_START (command list start)
09 02 00 00 – KASHI_POS_SEL(0) (reset lyrics list character pointer to position 0)
0C 03 00 0A – CACCO_END (command list end)
0C 02 00 00 – CACCO_START (command list start)
09 05 00 00 – MOJI_SET_KASHI (set pointer to play current character)
08 01 00 00 – REVOICE (replay the character)
09 01 00 00 – KASHI_POS_INC (point to the next character in the lyrics list)
0C 03 00 05 – CACCO_END (command list end)

From these commands we can see that when you press the SHIFT key, Miku will sing the first character in the currently selected lyrics slot.

The full SysEx message would be (all one line, no comments):

F0 43 79 09 11 // Start of SysEx message (fixed)
0C 11 // Change Command Slot for CS_SW7D
0C 02 00 00 // As given above
09 02 00 00
0C 03 00 0A
0C 02 00 00
09 05 00 00
08 01 00 00
09 01 00 00
0C 03 00 05
F7 // End of SysEx message (fixed)

Section 3-7 (page 21) describes timing. You can specify a wait time (TIME_WAIT = 0D nn nn nn, where nn can be from 00 to 7F). A value of 500 is roughly 1 second. You can cancel wait time with TIME_CANCEL (0C 05 00 00), and specify a TIME_TAIL (0C 04 00 00), which lets the timing buffer clear out. The pattern would look like:

CACCO_START > A > B > TIME_TAIL > C > D > CACCO_END

The example on page 22 is to assign a string to VOL UP + VOL DOWN + “A” (panic reset). (All one line, no comments.)

F0 43 79 09 11 // Start of SysEx message (fixed)
0C 32 // Change the command slot for CS_SW89_1D (Up + Dn + A)
04 65 12 66 // Direct MIDI 3 command mode to play a music note (see below)
0C 02 00 00 // CACCO_START
0D 00 00 C4 // Wait 200 ms
0A 07 00 00 // MIDI_RESET
0C 04 00 00 // TIME_TAIL
0A 07 00 00 // MIDI_RESET resets even with Cancel
0C 03 00 0F // CACCO_END
F7 // End of SysEx message (fixed)

Note: The 04 65 12 66 portion is a repeat of the 7-bit direct MIDI format, which takes “99 49 66” (Note Number 49 from the Drum Kit sound bank ON with a velocity of 0x66) and converts it to “04 65 12 66”.

Everything else is tables. Page 23 shows the command table. Translations:
“kashi” is “song lyric” (used to refer to the current lyrics string).
“Gokan” is “compatibility mode”.
“cacco” is “parentheses”.

Pages 24 to 27 describe the operations of the Command Slots. These are addresses within the Flash ROM pointing to instructions to execute when specific events occur, such as pressing or releasing one of the front panel buttons, power up (kidou), turning audio on/off, or activating the USB port. The slots themselves are listed in the tables on pages 28 to 30. I think most of this is self-explanatory so I’m not going to translate the tables. If there are enough requests for it, though, I’ll reconsider.

Advertisements
Previous Post
Leave a comment

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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: