There are some posts/examples online on how to detect the current volume of the mater bus. This code (below), for example, returns 0 when nothing is playing in side an application or greater than zero if something is playing inside the application.

But this code only reports what your application is sending to the operating system. It does not report if the user is able to hear anything that you are playing. So if the phone's volume button is set to 0, or the phones mute button is muted, this code will not help.

Sometimes users complain sound is not working because they forget their phone is muted. I have seen a few apps detect if the phone is muted and warn the users. Is there a way to detect if a phone is muted?

func check_volume():
	if spectrum == null:
		spectrum = AudioServer.get_bus_effect_instance(0, 0)
	if spectrum == null:
		print("cant get volume")
		return -999
	var volume = spectrum.get_magnitude_for_frequency_range(0, 10000).length()
	return volume
8 days later

Not sure it'll help with phones but maybe there's something useful to be found in the OS class? Though my first instinct is to say that either the AudioServer has something for this or the answer is 'probably not'.

I don't see anything in the OS class, I would assume that is where that is. Other apps might be native, so have more access.

    cybereality I don't see anything in the OS class, I would assume that is where that is. Other apps might be native, so have more access.

    I was thinking more along the lines of the execute method, but I don't think that works on phones so you can't really poll some system library or utility for it I guess.

    edit: nvm, Android and iOS should both support it:

    Note: This method is implemented on Android, iOS, Linux, macOS and Windows.

    It does seem like the OS class is where detecting system sound support or sound level should exist if it existed, but I can't see it there either.

    I figure if such a thing was possible already in godot, someone would have replied. I guess this is more of a "feature request" type of thing now.

      Megalomaniak Perhaps the above page has some useful insight to be gained.

      That's for Android Auto (car devices) I don't think it works on phones.

      Here is the Java code, if you want to make an add-on module.

        cybereality Yes, but it does refer to the same relevant AudioManager that is likely used across all variations of android and it was the first relevant link that came up when searching for android volume control/management. And both phones and cars are designed to rely on physical buttons for the top level audio volume control.