Second Life Rock Band
.
Project Goal
Initial Issues
One of the first issues with this project is latency issues. Since Second Life is located entirely online inside servers, it is expected that information will take a few seconds to be delivered. With baseline tests I have established that the first initial communication can take up to 0.23 seconds to broadcast and then about 0.09 seconds for each additional signal. This lag creates a few issues:
- If there is a lag between the button of the guitar pressed then the user in the "first life" will not be able to hear what they are playing. This issue can be solved with a separate controller that can process the music in real time.
- Music in second life might sound very distorted and staggered, it may no be enjoyable to hear which is an automatic turnoff.
- Is the ethernet connection on the mbed fast enough to process all that information or will the mbed have to be connected to a computer which can make the http requests?
Hardware
A visit to the local refurbished outlet bought back a great find, well two in fact. I found these wireless guitars for the playstation 2 for all of $9.99. Im pretty sure that it cost more for the plastic and components inside. I decided to buy two just incase I broke one or something. If not maybe I can use both of them, that would be neat. I opened the box and to my surprise there was a good quality rock-band looking guitar. It even had stickers to choose the look of the guitar, very cool. Next thing that needed to happen was to see how they were built. I took a screwdriver and opened all 15 screws by hand, after 15 minutes and a sore wrist I had the guitar opened. | ||
Inside was very cool, it was very simply built and this would make my job a lot easier. The whammy bar was connected to a simple pot, and everything else was a simple button. What made me really happy was the fact that there was a ribbon cable attached to the 5 buttons on the neck of the guitar which meant I could steal this connection and use it to connect to the mbed. No messy soldering or modifications needed. | ||
I did not remove anything or take anything apart because I first want to see if I could get the wireless module working. It made me also very happy to see that it was a standard connection, it will make finding resources much easier since its a PS2 standard. Lets check out the PS2 standard pinout: |
The Playstation Controller Pinouts (from http://www.gamesx.com/controldata/psxcont/psxcont.htm): LOOKING AT THE PLUG ------------------------------- PIN 1->| o o o | o o o | o o o | \_____________________________/ 1.DATA (Signal from Controller to PSX.) 2.COMMAND (Signal from PSX to Controller) 3.N/C (9 Volts unused) 4.GND 5.VCC (can vary from 5V down to 3V) 6.ATT (select) 7.CLOCK (Signal from PSX to Controller) 8.N/C 9.ACK (Acknowledge signal from Controller to PSX)
After looking through google I found a few examples of people connecting a WIRED controller with an arduino. Since my wireless guitar came with a plug that is the exact same as a wired controller I thought I should give it a try.
I found some code here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1240088460
I wired my arduino and with some modification I was able to without any problems get values for each of the buttons on the guitar.
I figured out that each button had a number value and when it was pressed its number value would be subtracted from the total, so each button, or combination of buttons had their own value. The green button was valued at 2, so 255-2 = 253. I wrote a simple program to check for the numbers of the buttons and output a colour.
Connecting to mBed
This code does simply the same thing as the the other arduino code but it is much easier to code and use.
The first part of the code is the inital communication setup:
const char enter_config_mode[5] = {0x01, 0x43, 0x00, 0x01, 0x00};
Next we tell the controller to switch to analog mode:
const char enable_analog_mode[9] = {0x01, 0x44, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00};
Last we exit the setup mode:
const char exit_config_mode[9] = {0x01, 0x43, 0x00, 0x00, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A};
Possible Alternative
- User presses button on wireless guitar
- Arduino calculates which button is pressed and prints a serial value for each button
- Wave shield connected to arduino is playing a sound effect when the button is pressed
- Arduino sends a serial command to mbed
- mBed will process this command and send an apropriate HTTP request to second life to play that sound.
To Dos
- Find a way to connect a rockband guitar to an mbed. (DONE)
- Secure a location in second life to place code and object. (DONE)
- Record/licence sound files for each of the guitar buttons. (In Process)
- Initial performance test to decide how to communicate with second life (ethernet or serial > pc > second life)
- Addition of drums and or second guitar (Second Guitar a Possibility)
First Test
6 comments
You need to log in to post a comment
Sounds cool! What about latency issues though?