This section contains the functions necessary to use the GameMaker: Studio audio API

GameMaker: Studio has a re-vamped audio engine that is based on the *.ogg sound format. You must still load your sounds into the IDE as either *.wav or *.mp3 but you can select compressed audio from the Audio Editor and GameMaker: Studio will convert the sounds to *.ogg (Ogg Vorbis) format when your finished game is compiled. In this way you can keep the final file size of your game to a minimum while ensuring maximum quality. The added benefit of the new GM:S Audio engine is that you now have access to full audio streaming as well as 3D sound with the ability to place a "listener" for all sounds as well as different sound "emitters" to create some stunning special audio effects!

Please note that for compatibility with older projects, GameMaker: Studio still has some legacy audio functionality. However, you cannot have both the new audio engine and the legacy engine active at the same time. For old games created with other versions of GameMaker or for those games started before the new audio engine was added, the Legacy Audio will be used as default, while for all new games GameMaker: Studio will default to the new audio engine. This behaviour can be changed from the Global Game Settings - General Tab.

Basic Audio Functions

The following functions are for dealing with audio in the most straightforward and simple way possible, avoiding the use of emitters and permitting the user to generate sounds and play music easily as these sounds are always generated at the listener position (see below for more details on the listener) and so are generally not affected by any changes to the listener:

  1. audio_exists
  2. audio_get_name
  3. audio_get_type
  4. audio_play_sound
  5. audio_play_sound_at
  6. audio_pause_sound
  7. audio_pause_all
  8. audio_resume_sound
  9. audio_resume_all
  10. audio_stop_sound
  11. audio_stop_all
  12. audio_is_playing
  13. audio_is_paused
  14. audio_create_stream
  15. audio_destroy_stream

Advanced Audio Functions

The following functions are designed to give more control over how the audio engine works, and how the sounds played through it will be "heard" by the listener. As such it is recommended that you have a good working knowledge of how the rest of the GameMaker: Studio audio engine works before using any of the following functions:

  1. audio_sound_set_track_position
  2. audio_sound_get_track_position
  3. audio_sound_length
  4. audio_sound_pitch
  5. audio_sound_get_pitch
  6. audio_falloff_set_model
  7. audio_sound_gain
  8. audio_sound_get_gain
  9. audio_master_gain
  10. audio_set_master_gain
  11. audio_get_master_gain
  12. audio_channel_num
  13. audio_debug

Further advanced functionality, like setting listeners, recording audio, or synchronising multiple audio tracks over time can all be found from the sub-sections listed below:

  1. Audio Emitters
  2. Audio Listeners
  3. Audio Groups
  4. Audio Buffers
  5. Audio Synchronisation

Legacy Sound

The following section also contains information on the Legacy Sound System, provided for compatibility with previous versions of GameMaker and also still of use when dealing with HTML5 and JS games:

  1. Legacy Sound

The legacy functions are still valid and available due to the fact that certain browsers for HTML5 games do not support the newer sound system. This means that you may wish to check in-game which sound system is actually being used and change the functions being used as appropriate. To that end there is a special function available:

  1. audio_system

Obsolete Functions

There are also some obsolete audio functions which were designed specifically for music. These functions no longer work and will give an unknown function or script error when they have been used, and you should update any legacy projects that use these functions to use the standard audio_*() functions instead:

  1. audio_play_music
  2. audio_pause_music
  3. audio_resume_music
  4. audio_stop_music
  5. audio_music_is_playing
  6. audio_music_gain
  7. audio_get_type

Back: Game Assets
Next: Fonts
© Copyright YoYo Games Ltd. 2018 All Rights Reserved