How To Control The WowWee Alive Elvis From An External PC (Part 4)

This is the last of four articles about adding a "parasitic" microcontroller to the WowWee Elvis Alive that allows control of this device from an external PC via a serial interface. This article covers the use of MIDI sequencer software (Multitrack Studio) to create animations for the modified Elvis Alive which I am now calling "PC Elvis". Any MIDI sequencer that supports audio clips can be used for this purpose but I have selected the Multitrack Studio sequencer because it has all the capabilities needed for this application and it is has a limited free demo which can still be used for this purpose. The MIDI events output by the sequencer are routed using a freeware program (Hubi's Loopback Cable) into my custom application (PC_Elvis.exe) which turns the events into motor control commands that are sent to the PC Elvis bust over a RS-232 interface.

Software Installation

All the PC Elvis software is provided in the single zip file PC_Elvis.zip. Links to this file and the Hubi's Loopback Cable and Multitrack Studio software were provided in the previous article (part 3). The installation steps below should be done in the order given.

-  Install Hubi's Loopback Cable Version 1.51

-  Install Multitrack Studio Version 5.0 or later.

-  Start Multitrack Studio

-  Click on the "Song" button at the top left and create a empty song and save it to create the song directory.

-  Click on the "Studio" button at the top left and select "Devices". 

-  From the Devices pop-up window click on "Properties".

-  Change "MIDI In Device" to "None" and "MIDI Out Devices" (1) to be "LoopBe Internal MIDI". Then exit the Devices window.

-  Click on the "Studio" button again and select "Preferences". In the "Transport-stopped Options" box turn off "Play MIDI notes being edited".        

-  Now exit Multitrack Studio

-  Extract the PC_Elvis.zip files.

-  Copy the files PC_Elvis.exe and MxMidi32.dll to your My Documents directory or to any directory that has write privileges for your user name.

-  Create a short cut to the PC_Elvis.exe file and drag this to your Desktop for easy access.

-  Copy the directory FatB to the C:\Documents and Settings\Your User Name\MultitrackStudio Songs\ directory created in the step above when you saved the empty song.

-  Copy the file PCElvis.pmp to the C:\Program Files\MtStudio\Patchmaps directory

-  Start Multitrack studio again and from the "Song" button select the "FatB" song directory and then select the "FatB.hdr" file and open it.

-  Start PC_Elvis using the icon you created.

-  From the PC_Elvis window check under the settings menu that the COM port number is correct for your serial port. It defaults to COM1.

-  The baud rate defaults to 19200 so this rate is correct unless you have changed it in the microcontroller software. The correct COM port number and baud rate will be saved in a file and re-read each time you restart PC_Elvis.

-  From the PC_Elvis menus check that the input device is "LoopBe Internal MIDI". It will always default to this as long as you have no MIDI interface installed.

-  Adjust the application windows so that Multitrack Studio is the top half of the screen and PC_Elvis is the lower half.

-  Using the transport buttons (top right of Multitrack Studio) click on the green arrow and you should see a trace of the MIDI note events in hex appear on the PC_Elvis screen. Once the time slider at the top reaches the end of the 22 second song you will need to press the stop transport button. The actual motor commands sent to the Elvis bust out the serial port are in brackets [] in the PC_Elvis window following each MIDI event shown in hex. If you are seeing the events and commands in the PC_Elvis window you can now minimize this window and maximize the Multitrack Studio window.

-  If you did not see the events in the PC_Elvis window then you will need to check that your MIDI input setting on the PC_Elvis window is "LoopBe Internal MIDI" and the MIDI output setting for Multitrack Studio are the same.

With the serial and audio cables plugged into your PC from the Elvis bust you are ready to playback the "Fat Elvis" demo. If you do not see any movement you will need to check your COM port assignment and your Elvis Number assignment from a terminal program. The Elvis number should be set to 9 and this is what the default value is in the delivered hex file. If your PC_Elvis program is crashing on an unhandled error, the problem is most probably with the serial port being used by another process or the COM port number selected is not present on your computer.  You can find the freebee program "Process Explorer" on the internet to find any process that might already be using the serial port.

[[page]]

Using the Sequencer Note Events for Animations

I will assume at this point you have read the Multitrack Studio manual and you are at at least familiar with the basic elements like a MIDI track contains the note events, an audio track has the sound waveform, and each track is represented as rack mounted panel in the main window. Mainly you need to know how to run this software but don't try to understand its musical context and notations and just think of it in terms of an audio file editor and a timeline sequencer of events.  

For the FatB example you have just loaded there is one MIDI track named "FATB Control" and one audio track named "belly2". If you click on the EDIT button on the far right of the "belly2" panel you can view the audio waveform. Since this audio does not begin until 18 seconds into the song you will have to move the time slider at the top of the screen to the 18 second mark to view it.

Now click on the EDIT button for the "FATB Control" panel on the far right. This track will expand into a "Piano Role" editor which is the default editor type for a MIDI track. Each note event is shown as a horizontal bar with a length that represents the event's duration. Each horizontal line containing events represents one type of event. For music this is the playing of one specific note. For animation this is the movement of one specific motor. You can move the time slider at the top of the screen to view all the note events. The view should be similar to what is shown below. If not you can click on the appropriate window gadgets to adjust them to this same appearance. For this song I have completely ignored what music time measures are and have just placed events where they need to be for initialization of the motor positions and motor actions as needed around the audio track. So unless you are attempting to create a music performance piece, this will be the way you will want to use this editor.

In the Piano Roll editor, the note events are only labeled at the far left by the music octave which is not too helpful for what we are doing. Now find the four tiny buttons in the lower right corner of the Piano Roll editor window (W,P,N,D) and click on the D button. P is for the Piano Roll Editor and D is for the Drum editor. The view for the drum editor should be similar to what is shown below. All images for this four part article in a higher resolution can be downloaded from here( http://www.mediafire.com/file/ivnk2gdzmyy/PCElvisImages.zip).

Now we finally have what we want to associate the events as motor control events and not musical notes. The events are labeled correctly on the left using the installed PCElvis.pmp file and can be changed to anything that is more meaningful if you wish by editing this file with notepad. However, you are limited to about 14 characters per label. These event labels and the commands they represent are in the table below.

[[page]]

The specific use of the velocity value for each of these commands is shown in the table. The velocity value can be changed by right clicking on the note events and adjusting the slider bar in the popup window. For a GOTO POSITION event, a velocity value toward zero is for movement toward the bust's left or up direction and toward 100 is for movement toward the bust's right or down direction. The velocity value's range is from 0 to 127 but the useable range is from 1-100. Never use a value of zero as this must be ignored because it represents a Note OFF event in the MIDI protocol. Values greater that 100 will always be interpreted as 100. The speed of the motor for a GOTO POSITION event is defined by the most recently ocurring SET SPEED event for that motor or by the SET GLOBAL SPEED event. The event's velocity for a SET SPEED event is divided by 10 to give a 1-10 range for the speed of that motor which is saved internally until it is changed by another SET SPEED event.

For the remaining event type, a RUN MOTOR event, the event velocity value represents the motor speed which is divided by 10 to give a 1-10 range for the speed of movement.  The duration of the motor run is determined by the duration of the event.

Event Label

Motor Command/Event Type Event's Velocity Represents
       
HUD GoTo Glb Head Up/Dn GOTO POSITION using global speed setting position 1-100
SLR GoTo Glb Swing Left/Right GOTO POSITION using global speed setting position 1-100
       
Neck L Run Neck Left RUN MOTOR motor speed 1-10
Neck R Run Neck Right RUN MOTOR motor speed 1-10
Lip GoTo Glb Lip Up/Dn GOTO POSITION position 1-100
Jaw Run Jaw Dn RUN RUN MOTOR motor speed 1-10
Brow Up Run Brow Up RUN MOTOR motor speed 1-10
Brow Dn Run Brow Dn RUN MOTOR motor speed 1-10
ELR GoTo Glb Eyes Left/Right GOTO POSITION using global speed setting

Comments

roschler's picture

Brilliant stuff Evilis!

GWJax's picture

OK now that the 4 part series is complete I'll sit back and re-read all of it from start to finish.

By the way Great Mod...

Jax