26.10. SoundButtons

The SoundButtons are used for loading and managing sounds for the Blender game engine. Look at Section 24.6 for a method to visualize the waveform.

Figure 26-10. The SoundButtons

In the SoundButtons Header you can see the name of the SoundObject (here "SO:MiniGunFire.wav"). This name is set to the name of the sound sample by default. With the MenuButton you can browse existing SoundObjects and create new SoundObjects. The blue color of the sound name indicates that more than one user uses the sound, the number button indicates the number of users.

Listener settings

The "Listener settings" on the right side of the SoundButtons define global settings for the listener. The listener is the current camera. The "Volume:" slider sets the global volume of all sounds. The "Veloc:" slider controls the overall strength of the Doppler effect.

Sound settings

In the SoundSettings section you can then assign or load samples for the SoundObject. So the SoundObject name doesn't have to be the name of the sample. For example you can use a SoundObject "SO:explosion" and then load "explosion_nuke.wav" later. You load samples using the "Load Sample" button in the SoundButtons. The sample name and the location on disk are shown in the text field to the right of the "Load Sample" button. Using the MenuButton to the left of the location, you can browse samples already loaded and assign one to the SoundObject.

Above the sample location Blender gives you some basic information about the loaded sample, like the sample frequency, 8 or 16bit and if the sample is Stereo or Mono.

The NumberButton indicates how many SoundObjects share the sample. When the pack/unpack button (parcel) is pressed, the sample is packed into the *.blend file, which is especially important when distributing files.

The "Play" button plays the sound, you can stop a playing sound with ESC.

The "Copy Sound" Button copies the SoundObject with all parameters.

Parameter settings

The "Vol:" slider sets the volume of the sample.

With the Pitch: value you can change the frequency of the sound. Currently there's support for values between half the pitch (-12 semitones) and double the pitch (+12 semitones). Or in Hertz: if your sample has a frequency of 1000 Hz, the bottom value is 500 and the top 2000 Hz.

The "Loop" button sets the looping for the sample on or off. Depending on the play-mode in the Sound Actuator this setting can be overridden.

The "3D Sound" Button activates the calculation of 3-D sound for this SoundObject. This means the volume of the sound depends on the distance and position (stereo effect) between the sound source and the listener. The listener is the active camera.

The "Scale:" slider sets the sound attenuation. In a 3-D world you want to scale the relationship between gain and distance. For example, if a sound passes by the camera you want to set the scaling factor that determines how much the sound will gain if it comes towards you and how much it will diminish if it goes away from you. The scaling factor can be set between 0.0. All positions get multiplied by zero, no matter where the source is, it will always sound as if it is playing in front of you (no 3-D Sound), 1.0 (a neutral state, all positions get multiplied by 1) and 5.0 which over accentuates the gain/distance relationship.