Suono 3D

Standard Edition.

3D sounds refers to sound that has a position (and velocity) with respect to the listener.

Although its most prominent use is in 3D games you can also effectively use it in 2D games.

  • The idea is that a sound has a position in space.
In all functions the listener is assumed to be at position (0,0,0).
The system calculates how the listener would hear the sound and adapt it accordingly.
The effect is especially good when you have a good speaker system but is already works on small speakers.
  • Besides a position, the sound can also has a velocity.
This leads to well-known doppler effects which are correctly modelled.
  • Finally the sound can have an orientation and, again, the sound is adapted accordingly.

Game Maker supports 3D sound options through the functions below.
They only work for sound resources that were indicated to be 3D.
The disadvantage is that 3D sounds will be mono, not stereo.

sound_3d_set_sound_position() snd
x
y
z
Sets the position of the indicated sound with respect to the listener to the indicated position in space. Values on the x-axis increase from left to right, on the y-axis from down to up, and on the z-axis from near to far. The values are measured in meters. The volume with which the sound is heard depends on this measure in the same way as in the real world.
sound_3d_set_sound_velocity() snd
x
y
z
Sets the velocity of the indicated sound to the indicated vector in space. Please note that setting the velocity does not mean that the position changes. The velocity is only used for calculating doppler effects. So if you want to move the sound you must yourself change the position of the sound.
sound_3d_set_sound_distance() snd
mindist
maxdist
Sets the minimum distance at which the sound does no longer increase in loudness and the maximum distance at which the sound can no longer be heard. So when the distance lies between 0 and the minimum distance the sound is at maximal amplitude. When between the minimal distance and the maximal distance the amplitude slowly decreases until either the maximal distance is reached or the sound is anyway no longer audible. Default the minimum distance is 1 meter and the maximal distance is 1 billion meters.
sound_3d_set_sound_cone() snd
x
y
z
anglein
angleout
voloutside
Normally sound has the same amplitude at a given distance in all directions. You can set the sound cone to change this and make sound directional. x,y,z specify the direction of the sound cone. anglein specifies the inside angle. If the listener is inside this angle it hears the sound at its normal volume. angleout specifies the outside angle. When the listener is outside this the volume is indicated with voloutside. To be precise, voloutside is a negative number that indicates the number of hundreds of decibel that must be subtracted from the inside volume. Between the inside and outside angle the volume gradually decreases.