Second Life Rock Band Integration

On November 25, 2009, in Interactive Media, by Vlad Cazan

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.

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


Tagged with:  

2 Responses to “Second Life Rock Band Integration”

  1. Luffie says:

    I have a Dell Latitude Laptop using Windows XP. I took it to Geek Squad because it was skipping and the freezing up when I played DVDs or any kind of audio. When it freezes I have to turn it off witut shutting it down. It also wouldn’t freeze right away..it freezes into about 10 minutes of playing the DVD. It was also making weird noises when it froze. Best Buy informed me that the noise wasn’t any hardware issue, but the kind of noise the computer makes when it’s frozen. They said nothing was wrong hardware wise, and that I had 6 viruses on the laptop. Well now, all those viruses are removed, and my laptop is still skipping and freezing when I play DVDs..to the point where I have to turn off the computer without shutting it down. Also, now it freezes and makes a weird noises when I’m not playing any audio. If it’s not viruses, and geek squad said everything is fine with the computer physically, then what is it? santoramaa

  2. Vlad Cazan says:

    What does this have to do with second life? It could be one of one million things, just reformat your computer with a clean OS running XP, VISTA or WIndows7 and if it is not a hardware issue then everything should be fine. If everything stays the same then obviously it is not a software issue.

Leave a Reply

Free WordPress Themes

Page 1 of 1 1

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

Highslide for Wordpress Plugin Weboy