#GAMEMAKER STUDIO 2 SOUND CODE#
The above code checks if the instance is past the right bound of the room and plays a sound with a gain of 1.1 and a pitch of 2 (twice the normal pitch). On the HTML5 target this will have no effect as the target does not support more than one listener.Īudio_play_sound(snd_Goodbye, 10, false, 1.1, 0, 2) OPTIONAL The bitmask data to set for the sound. OPTIONAL The pitch multiplier (default 1). Values longer than the length of the given sound are ignored. OPTIONAL The time (in seconds) to set the start point to.
![gamemaker studio 2 sound gamemaker studio 2 sound](https://freeappstorepc.com/wp-content/uploads/2017/10/Screenshot_13-1024x603.jpg)
This means that if you have multiple instances of the same sound playing at any one time you can target just one instance of that sound to deal with using the audio functions.Īudio_play_sound(index, priority, loop,, ,, ) Argument This function will also return a unique index number for the sound being played which can then be stored in a variable so that you can then pause it or stop it with the appropriate functions. NOTE To change the value of one of these properties after playback of a sound has started, see audio_sound_gain for gain, audio_sound_set_track_position for offset, audio_sound_pitch for pitch and audio_sound_set_listener_mask for listener mask.
![gamemaker studio 2 sound gamemaker studio 2 sound](https://steamcdn-a.akamaihd.net/steam/apps/585410/ss_1802c10e1e362256ef9742aaa9077f0cddd3db20.1920x1080.jpg)
Initializing these properties here, before playback has started, will prevent issues with the sound, where a sudden change in gain or pitch will lead to an audible "pop" (for gain) or warp (for pitch), a sudden change in offset will cause the sound to jump from one position to another and the listener mask being changed only afterwards might lead to the sound being audible to listeners that aren never supposed to hear it.
![gamemaker studio 2 sound gamemaker studio 2 sound](https://img.itch.zone/aW1nLzE4ODgwMjkucG5n/508x254%23mb/d1zoA3.png)
The four last arguments are optional and can be provided to immediately initialize the sound's common playback properties to the desired value: the gain, (time) offset, pitch and listener mask. Check your audio group settings at tools > audio group and also check the sound mixer settings found in tools.