Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In-Game: Add support for setting an individual audio instance's gain higher than 1 #5580

Closed
gl326 opened this issue Apr 19, 2024 · 4 comments
Assignees
Labels
documentation Improvements or additions to documentation are required by this issue feature request New feature (or a request for one)
Milestone

Comments

@gl326
Copy link

gl326 commented Apr 19, 2024

Is your feature request related to a problem?

Currently we're using Gamemaker's audio_bus feature set as a mixing tool to control the volume of grouped assets. This has been an overall improvement of our own custom-writ "bus" system we used previously, but it has some limitations in how it interacts with audio instances.

With the way our audio designers expect to work with audio assets, a bus can be used to turn down a group of assets, but then they want to adjust the gain on individual audio instances using the bus volume as a center. This means that some sounds should be turned down lower, but other sounds need to be turned up. The issues is that, because audio instances don't get any louder when their gain is set over 1, this means that it's impossible to turn sounds up, even if the final output after passing through a bus would be less than 1.

For example, consider an audio instance whose gain is set to +6dB playing through a bus set to -6dB. Any audio designer would assume that the output volume would be 0dB. However, because the asset is invisibly capped at +0dB, the final output audio is at -6dB.

Describe the solution you'd like

Setting the gain of an audio instance to a value greater than 1 should make it louder.

Describe alternatives you've considered

This is possible in Gamemaker if we make use of a "Gain" audio effect - this actually allows you to set gain greater than 0dB. For now we are using this as a workaround.

However, it introduces more code and data to manage than what seems necessary. This audio effect is useful for situations where we want to dynamically adjust a playing sound's gain, but for "fire and forget" situations where we simply want to play a sound at a specified volume, it's an overwrought solution.

Another possible solution we considered is artificially doubling the volume of every audio bus we create and halving the volume of every played audio asset, so our audio effectively sounds identical but has artificial headroom above every asset's volume. If audio busses can have their volume set to greater than 0dB then it would work (I haven't tested it). However, it's a janky and strange workaround.

In either case, since it's technically possible to get the output we want with the game engine, it feels like it should also be possible to achieve that output by using the most simple, obvious and direct method (set the gain on a played audio instance to a value greater than 1).

Additional context

No response

@gl326 gl326 added the feature request New feature (or a request for one) label Apr 19, 2024
@YYDan YYDan changed the title Setting audio instance gain over 1 In-Game: Add support for setting an individual audio instance's gain higher than 1 Apr 22, 2024
@stuckie stuckie added this to the 2024.6 milestone Apr 22, 2024
@toby-yoyo
Copy link

Removed a historic upper limit on source gains, which are the product of voice (instance), asset, group and emitter gains. This means that the constituent gains should always have an effect if set above 1.

Listener (master), bus and effect gains were untouched as they already had this behaviour.

Here's a little test project for this: gmb-5580-x.zip

Please be aware that audio devices/operating systems can sometimes attempt to normalise the audio stream in order to protect the user from what would otherwise be very loud sounds. As a result, you may find that increasing gains might have an inconsistent effect - we have no control over this.

@gurpreetsinghmatharoo gurpreetsinghmatharoo added the documentation Improvements or additions to documentation are required by this issue label Apr 23, 2024
YYBartT added a commit to YoYoGames/GameMaker-Manual that referenced this issue May 1, 2024
YoYoGames/GameMaker-Bugs#5580

* Added a note snippet explaining audio may not be heard as expected, since OS or audio device might modify it
* Inserted this snippet on all gain setter function pages and on the Audio Properties Overview page
@YYBartT
Copy link

YYBartT commented May 1, 2024

Added a note on all gain setter function pages explaining that either OS or audio device might change the sound's final amplitude.

gurpreetsinghmatharoo added a commit to YoYoGames/GameMaker-Manual that referenced this issue May 9, 2024
* develop.bart:
  docs(feature): added documentation for physics_raycast YoYoGames/GameMaker-Bugs#2762
  docs(feature): documented gamepad_enumerate YoYoGames/GameMaker-Bugs#5329
  docs(feature): skeleton_animation_clear optional parameters YoYoGames/GameMaker-Bugs#1570
  docs(feature): documented dbg_view_exists and dbg_section_exists YoYoGames/GameMaker-Bugs#4931
  docs(feature): documented dbg_view_exists and dbg_section_exists YoYoGames/GameMaker-Bugs#4931
  docs(feature): YoYoGames/GameMaker-Bugs#1570
  docs(general): mentioned that any attached files are uploaded privately
  docs(feature): smaller custom format screenshot YoYoGames/GameMaker-Bugs#5495
  docs(feature): documented the new dbg_text_separator function YoYoGames/GameMaker-Bugs#4998
  docs(feature): Switch to the docking branch of imgui YoYoGames/GameMaker-Bugs#4905
  docs(general): document OS and audio device limitations when using audio YoYoGames/GameMaker-Bugs#5580
  docs(feature): Add an option to specify "step" in the ImGUI slider control YoYoGames/GameMaker-Bugs#2971

# Conflicts:
#	Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Audio/audio_sound_length.htm
#	Manual/contents/GameMaker_Language/GML_Reference/Debugging/dbg_slider.htm
#	Manual/contents/GameMaker_Language/GML_Reference/Debugging/dbg_slider_int.htm
@caitlinrmcintyre
Copy link

Verified in IDE v9.9.1.676 Runtime v9.9.1.818, thanks.

@caitlinrmcintyre
Copy link

Verified changes are in the manual.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation are required by this issue feature request New feature (or a request for one)
Projects
Status: Verified
Development

No branches or pull requests

7 participants