contents.gifindex.gif

pueblo00000000.gif Building TinyMUSH sound generators

First, let's create a simple CD object which causes people who look at it to hear a MIDI file:

@create Jaws CD

@lock Jaws CD==me

@Adesc Jaws CD=@pemit/noreturn %#=The soundtrack of the film 'Jaws', more or less.<img xch_sound=play href="http://www.chaco.com/pueblo/midi/samples/jaws22.midi">%r

When this object is looked at, it will emit an <img xch_sound...> HTML tag to the player who looked at it, and their browser will begin playing the MIDI file at the specified URL.

To add a bit more realism to the situation, let's make a CD player to go with the CD, and generalize the CDs so we can expand our collection easily:

@create CD Player

@lock CD Player==me

@Desc CD Player=A standard cd player. There is a play, stop, and loop button.

&PLAY CD Player=$play *:@emit/noreturn %n inserts '%0' into the player and press the 'play' button.<img xch_sound=play href="[get(%0/sound_url)]">%r

The 'play' command uses an HTML tag like the Jaws CD above did, but gets the URL of the MIDI file out of the CD object the user specifies in their 'play' command. Here's a sample CD:

@create 'Jazz for Airy Nights' album

@lock 'Jazz for Airy Nights' album==me

@desc 'Jazz for Airy Nights' album=This is an album of light jazz for those mellow, romantic moments that everyone experiences in elevators.%r

&SOUND_URL 'Jazz for Airy Nights' album=http://www.chaco.com/pueblo/midi/samples/lite_jazz.midi

When a player types 'play jazz for airy nights', the SOUND_URL attribute on that object is read by the CD player, and the CD player emits the appropriate <img xch_sound....> HTML to everyone in the room.

Next, we can add a 'stop' command to the CD player:

&STOP CD Player=$stop:@emit/noreturn %n presses the stop button on the cd player.<img xch_sound=stop>%r

Also see

TinyMUSH extensions

Building TinyMUSH VRML animations

Adding Avatar support in VRML spaces