Working with Sound

From Multiverse

Jump to: navigation, search

Contents

Overview

You can add sounds to your world in several ways. Using World Editor, you can add server-based sound regions or point sounds. Using Client scripting, you can add client-based sounds.

Supported file types

Multiverse currently supports .wav, .ogg, and .mp3 sound files.

Adding sounds in the world file (server-side)

You can incorporate sounds into your world file in two basic ways:

  • Sound regions, also known as ambient sounds
  • Point sounds, also known as positional sounds.

Point sounds have attenuation, that is, their loudness decreases with distance from the marker or object to which they are attached; whereas ambient sounds have a constant loudness within a region.

NOTE: World Editor currently does not play sounds. You can only hear sounds when you load the world into a server and use the client to access it.

For information on adding sounds using World Editor, see Adding sounds.

Sound regions

Sounds associated with regions (ambient sounds) have a constant loudness within the region.

You can assign a sound to a region, so that a player hears the sound when the PC is within the region. To add an ambient sound:

  1. Choose an existing region, or create a new region, as described in Adding a region.
  2. Select the region.
  3. Click the Add Sound button or right click and choose Add Sound.
  4. Select the name of the sound file.
  5. Click Add.

World Editor adds the sound to the selected region. You can then set the following properties for the ambient sound:

  • Gain (volume multiplier between zero and one)
  • Loop (whether the sound should loop continuously or play once only)

If sound regions overlap, the Client will play all the sounds simultaneously.

Point sounds

Point sounds are associated with a marker or object. Their loudness decreases linearly with distance from the marker or object, based on the two properties:

  • MaxAttenuationDistance - Distance at which a point sound can no longer be heard.
  • MinAttenuationDistance - Distance at which volume of a point sound starts to diminish.

Adding a sound with a Client script

You can add a point sound in a client script with a call to ClientAPI.GetSoundSource(). The SoundSource object represents a sound source in the Client scripting API.

To play a sound that each player hears, use the Client Python code:

player = ClientAPI.GetPlayerObject()
sound = ClientAPI.GetSoundSource(sound-file, player.Position)
sound.Looping = 0
sound.Play()

where sound-file is the name of the sound file.

The ClientAPI.GetSoundSource() also has several optional parameters:

  • looping - whether to repeat the sound in a loop
  • gain - amount by which to amplify the sound
  • ambient - whether the sound is ambient, that is, not affected by position
  • local - whether the sound comes from a local sound file in the asset repository or from a streaming server

Using streaming sound

To play sound from a streaming media server, specify the local parameter as false, and use a URL instead of the sound file location. For example:

exterior = 'http://72.13.81.178:8010/'
sound = ClientAPI.GetSoundSource(exterior, ClientAPI.Vector3.Zero, False, 0.0, True, False)

Sound editing

The GoldWave Digital Audio Editor is available from http://www.goldwave.com/. It is an excellent free tool for editing and working with sound. It can load and save sounds in wav, ogg and other formats.

Personal tools