Second Life Rock Band

Project Goal

As a final project for my digital virtual environment's class, I would like to create an installation that connects a "RockBand" PlayStation 2 guitar, to the popular online virtual world of Second Life. This application will let real users in the lobby of my university play guitar for people logged on in second life. I am currently in talks with a popular concert sim to place the project there for most exposure. Depending on the time restrictions I will attempt to connect a guitar and a drum set which will allow multiple users to play together. There are many issues that do need to be figured out.

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

I have been working on connecting the wireless guitar to the mbed and there is some progress so far. I have learned from Simon in the forum that the process used to connect to the PS2 controller is very similar to an SPI communication interface. I have never used this type of communication before.
Simons SPI interface.
PlayStationController

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};
This is all consistent with the pervious code, as well as this great resource: http://www.curiousinventor.com/guides/ps2
For some reason the only data we are getting back is FF FF FF FF FF FF FF after all this is sent.

 

Possible Alternative

Since it is becoming very hard to establish a connection with the mbed, I have decided to put this part of the project on hold and continue forward rather then staying stuck on this issue. I can get analog values from my wireless guitar with my arduino so I will use basic serial communication to send commands to my mbed.
Process Flow:
  • 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

20 Nov 2009

Sounds cool! What about latency issues though?

20 Nov 2009

This is one of the major issues, I do have another microcomputer that can play sounds at the time the button on the guitar is pressed. That way the user in the first life will be able to hear the music when they play it. The key presses will be stored in a buffer and sent out to second life, I will assume there will be lag issues but my goal is to create a somewhat seamless experience.

Anyone attempt any playstation 2 interfacing? This is my first goal.

20 Nov 2009

Really cool. I'm looking forward to see many test videos ;-)

20 Nov 2009

There will be a lot of documentation for everyone to see :)

25 Nov 2009

Did you try turning down the SPI frequency and flipping the mode?

25 Nov 2009

Yes sir, I have tried 100 KHz mode 3.

Realized that the acknowledge pin was pointless works with or without it on the arduino. Very stumbled on what it can be, the code is doing the exact same thing, but the controller does not like it. If I do flip the mode I get 00 00 00 00 00 as an output and not FF FF FF FF FF FF like before, not sure if that says anything.

Any other suggestions as this would be great to get rid of that damn arduino

You need to log in to post a comment