audio_sound_get_gain() will only get the sound's volume relative to other sounds in your game, not the actual amplitude at the current position.
There's no
easy way to do what you want, but it would be possible by using
audio buffers. Basically, you would load a WAVE file into a buffer. This will be somewhat more complicated than just doing buffer_load("sound.wav") since WAVEs contain some metadata and headers, though. You could convert your audio files into raw, headerless PCM-audio (
Audacity can do this), or you could write a system to parse the additional data (which would allow you to determine sample rate etc. automatically). There's an
example on /r/GameMaker about doing that, but the poster's Dropbox has apparently been disabled...
Anyway, once you have an audio buffer, you can create a sound from the buffer with
audio_create_buffer_sound(), which you can play as normally – and since you have all the audio data in a buffer, you can quite easily check the amplitude of the audio at a given moment. This should be as simple as
Code:
volume = buffer_peek(buffer, rate * position_in_seconds, buffer_u16) / buffer_sizeof(buffer_u16); // If you have an 8-bit sound file, you'd use buffer_u8 instead of buffer_u16, of course.
Which would return a value from 0 to 1 (where 1 is the highest amplitude possible). But don't quote me on that, I haven't tested it. You can get the current position of a sound that is playing (in seconds, conveniently) with audio_sound_get_track_position()