In Second Life and the Open Sims, small WAV sound files can be uploaded to be used to make objects emit sounds. Second Life has a limit of 10 seconds on a file. I had seen other people create devices that could play full songs, so I decided to learn how, and I created the sound player. My goal was to create a Piano in the world, that could play some my songs.
To make one song, it takes many files depending on the length of the song. The average is over 30 files. Since they have to wav files, I first had to create a way to cut the files into the 10 second chunks. To upload 30 files into Second Life, it costs 10 Linden Dollars (L$10) per file. The files have to be less than 10 seconds, so to mathematically cut up the files, it was easier to use 9 second files. I started by using sound editing software "Audacity" to cut the files.
Next, I had to rename the files. Based on how I had seen other people do it, I used the following format.
To do the song "All of Me", I ended up with 33 files that look like this:
I uploaded all of the files into Second Life, using the Bulk Upload option, so I didn't have to do them one at a time. The files were copied into a an object inside the world. Later, one of our programmers at work made me a script that would automatically, make the files as loud as possible, converth them to wav, cut them up, and name the files. This entire process now could be done in seconds. At about this same time, the open sims started allowing 60 second files. With less files, you could have more songs, less lag, and less chance of hearing any switching between the file changes as the played in sequence.
The Player scripts
There are three scripts for the player. Many people use scripts like these for their objects that can play sounds.
The first script called wavplay menu.lsl, was created. This script would also be added to the object with the sound files. It would read the wav files, and determine the song names, and then create a menu structure. When a person clicks the object, the menu would appear with a list of songs that could be played. If a song was chosen, the information would be broadcast for the next two scripts, such as each filename in-order, and the number of seconbds to play (from the filename). This script could also broadcast a stop message to stop a song from playing, if a stop option was chosen from the menu.
The second script was wavplay pre-load.lsl that would get the broadcast from first the first script, and start pre-loading the song, to prevent any lag when the song was played.
Finally, The third script was called wavplay engine.lsl that would play the files, in the order they were given by the first script, ultimately playing an entire song. The second script continued to pre-load each file while this third script was playing the one before it.
More is better
I later discovered that two or more exact sounds, played at the exact same time, would be louder than just one. This gave me a brilliant idea. I decided to make multiple player objects that could surround the piano, and all play at the same time. The closer you are to the object, the louder it's sound was. By surrounding the person with these obejcts, they were more likely to be close to a playing object. Since there would be multiple objects playing, the overall sound would be much louder also.
So, the main object contained all the three scripts and all the sound files. The additional onjects had the same contents, except for the first script "wavplay menu.lsl". Since the first script broadcasted to the pre-loaders and players, they could all start playing at the exact same time. I named the first object the "player", and additional objects the "speakers". The first object became a player piano module mounted under the keyboard of the piano. The speakers became invisible to create the effect that the music was comming from the piano. My personal piano can play music for over two hours and it has every testure I have ever made in it, and I can wear it, and play it anywhere, even if I don't have permission to put it on the land I am at.
Other applications for the sound player
I used this technology in other ways. The next invention was the "Wave Player". Wave as in ocean waves, and Wave as in wav files. In Second Life, when you drive boats, you travel from region to region. Each region's land has different internet radio station set, so it's almost impossible to listen to music because it changes as you cross each region. Since my player is not tied to the region, I made it have the ability to be tied to the avatar. I filled it full of some classic old-school rock songs. You could wear it and listen to the music you wanted, as you traveled.
The next idea was "Piano Talent". Instead of having the player be part of the piano, I could make part of the avatar like the wave player. This way, the avater could sit at any piano, and produce piano music. This exended to "Organ Talent" and other things.
The next scripts I wrote would be added to the piano bench of my pianos. This script would start if an avatar sat on the bench. When it started, it would enable an animation script that would cause the avatar to put it's hands ont he keyboard and move as if to play a song.
The base portion of the piano was created using Mesh Graphics and exported from Windows software to a DAE file. Mesh is a polygon collection of vertices, edges and faces that defines the shape of a polyhedral object in 3D computer graphics and solid modeling. Mesh graphics are used many places besides virtual worlds.
The DAE file, when uploaded to the world, shows as a blank looking white object in the shape of a piano. This is an example of a mesh model with animation. Click for larger image.
Next, I created several different custom textures to lay over the mesh model. The textures are TGA graphics made in Photoshop, that have color for the piano, the keys, the hinges, hinges, the casters, the harp and strings, etc. When placed on the imorted mesh object, we end up with a piano. Some changes were also made to the object to add some shine to the TGA graphic texture to make the piano appear to have a gloss finish. Later I added music for the music stand, and logos with my name. On a final version of my piano, I copied all of the textures I had made, into the piano and wrote a script that would bring up a menu and allow you to pick the look of your piano.
Here are some of the Texture Names:
Black, White, Ivory, Rosewood, Granite, Green, Forest Green, Blue,
Wood (3 different kinds), Brown, and even Pink, and Purple
Piano build evolution. Click image for larger view.
Space Ball was a colaborative project with myself and Molly Rosenberg. This is a full size arena style soccer/foorball game. There are two teams, red and blue. Two or more players are require. Each person gets in a small shuttlecraft and drives/flies it around the feild, hitting the 5ft tall ball trying to get it into the goal. The scripting automatically starts the ball in the center in the center of court. The score board can be set for the number goals needed to win, and it will automatically keep score. The player that wins, gets a fireworks show in the color of their team. This project took a lot of time and has a lot of scripts. This ia very fun game!
Star-Pod started as a project in an Open Sim World. I used scripts from the shuttlecraft in Space Ball to make it fly. Building in Open Sims is free. There no fees to upload files there. So, I found a Mesh Model for this craft and decided I would texture it and make it fly. It turned out real good. I added lots of scripts to inside also, to make the controls and lights blink.
Open Sims don't support vehicles very well, so flying around on one region works ok, but it's still laggy. The land impact of the craft was low. I attempted to upload the completed projected into Second Life, but it handles mesh uploads differently, and the land impact ended up being too high to use as a vehicle, and by the time I got that far, I was tired of working on it and other caught my attention.
Many Other Projects
I build scripts for my clubs, my stores, and my homes. The scripts do things like tell me when a friend is on-line, or tell strangers they shouldn't enter my private home. I have scripts for my stores that allow people to pay money to buy my products. Scripts to open doors, or to make people dance. There are many objects I have built as well. There is so much you can do. You are only limited by your imagination.
Here are some more pictures: Click for larger image