Name: Echo Tube
Description: A 30 m long tube stretches into the sky from the Splo Main building. When you touch the exhibit you will be given a dialog asking if your avatar can be animated. When you give permission your avatar will clap, and you will hear the sound of the clap and the sound of the echo from the Echo Tube.
Creator: DrSteph Scanlan, Paul Doherty, Sequoia Hax, Emileigh Starbrook
On the exhibit "Echo Tube, Touch, Listen."
Lessons: This exhibit has many parts:
1. It must sense a touch
2. Offer a dialog box to obtain permission to animate the avatar
3. Animate the avatar
4. Play a sound
1. The script must have an touch event to sense when the exhibit is touched: touch_start(integer total_number)
This event preloads the sound and requests permissions needed to animate the avatar.
2. Request permisiion from the avatar to animate the avatar. llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION);
The llDetecedKey(0) is the key number of the avatar touching the exhibit.
and the fixed constant in SL named PERMISSION_TRIGGER_ANIMATION, gives the name of the permission requested.
This permission is coupled always to the event run_time_permissions(integer perm)
Which is triggered by the granting of permission by the avatar.
3. You need a full permission animation to place into the prim and animate the avatar.
Animations can be created with a program such as quavimator. This animation was created by Alisa Cleanslate and it is available with full permissions if you buy the exhibit.
The command to play the animation is: llStartAnimation(anim); the name of the animation is anim = "1clap"
After starting the animation I put the script to sleep for 0.7 seconds: llSleep(0.7); to allow the animation to finish.
4. The sound of the clap and echo must be recorded digitally and saved as a .wav file. It must be recorded at 16 bits and at a rate of 44,100. the sound is monaural.
We used the free application Audacity to record the sound, process the sound, and save it in the correct format.
The sound can be uploaded into SL under the file menu. (This costs $10L)
The sound is placed into the prim contents.
Since there is only one sound it can be preloaded, ready to play. llPreloadSound(sound); where sound in this case is the name of the sound in inventory "echotube". Preload only preloads one sound at a time.
The sound is played by this command: llPlaySound(sound,1.0); "sound" is the name of the sound followed by the loudness of the sound from 0 quiet to 1.0 loudest.
After starting to play the sound the script sets a timer for 9 seconds that then triggers a timer event to end the animation.
integer CHANNEL = 42; // dialog channel
list MENU_MAIN = ["1clap"]; // the main menu
string sound = "echotube";
touch_start(integer total_number) //wait for an avatar to touch the poster
llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION); //ask permission to animate the avatar (detected key) that touched the poster
anim = "1clap";
Comments: Users of this exhibit must have the sound turned on in their computer and also in second life.
The physics of the echo tube is interesting.
At one level, low frequency sound waves have a wavelength greater than the diameter of the tube and so diffract continuously as they propagate along the tube, strongly interacting with the walls and slowing down. While high frequency sound waves have a wavelngth sorter than the diameter of the tube and so diffract less and interact with the tube less travelling more rapdily down the tube. Thus a pulse of sound, like a clap, which contains many different frequencies will be stretched out in time as it travels down the echo tube and reflects back down the tube to the observer. The high frequencies will arrive first and the low frequencies later.
The echo tube is a frequency analyzer that spreads frequencies over time.
A more difficult explanation treats the echo tube as an acoustic waveguide. This explanation gives a quantitative description of the spreading of the sound.
DrSteph was the lead designer for this exhibit, helped by: Patio Plasma who fixed the script and did the sound recording, Sequoia Hax did the building, Emileigh Starbrook helped with the textures, and Alisa Cleanslate created the single clap animation.
Updated 4 Dec 2008