With its updated audio engine, GameMaker has added the ability to simulate 3D sound. This doesn't mean that you have to make a 3D game to utilize it, however; you can use this feature to add depth (figurative and literal) to your 2D world. Let's take a look at some basics for creating location-dependent audio.
This recipe calls one sound file (I used a 13-second loop of rushing water; it is a public domain sound I downloaded from http://soundbible.com/): a player object (our listener) and emitter object. Give the player and the emitter their own sprites. Though a sprite for the latter isn't necessary, we're going to make it visible so that you have a point of reference when you test it. We'll call the emitter, obj_water
, and our player character something crazy such as obj_player
. Create a room and place both the objects in it with obj_water
near the center.