sound and mute in mobile games and apps

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

User avatar
gilan
Posts: 30
Joined: Fri Mar 13, 2015 2:43 pm UTC
Location: Interwebs
Contact:

sound and mute in mobile games and apps

Postby gilan » Sun Mar 15, 2015 9:46 am UTC

I just programmed and published my first mobile game, and noticed that it's a real headache to get hardware mute and volume controls to work as I would expect them, on both Android and iOS. When your device is in mute or vibrate mode do you expect your games and other apps to respect that?
Trying to make games for smart people since 1986. http://beacegames.nfshost.com/

User avatar
WanderingLinguist
Posts: 237
Joined: Tue May 22, 2012 5:14 pm UTC
Location: Seoul
Contact:

Re: sound and mute in mobile games and apps

Postby WanderingLinguist » Sun Mar 15, 2015 11:39 pm UTC

Yes, absolutely. On my iPhone, if the physical ringer switch is off, I expect the device to make no sound ever, under any circumstances, unless I take specific action.

Some games get this wrong, and you have no idea how embarrassing it is to be in an important business meeting, unlock your phone to look something up in response to a question, and have game music blast out from whatever game you were playing on the subway during your commute. Apple has gotten pretty good about not approving apps that get this wrong, but a few still slip through; for those, if the mute doesn't work right, I delete the app and don't use it. It's not worth my job. When that switch is set to mute, no sound should come from the device.

With games and YouTube videos, if I want sound, I can hit the "volume up" button after the game or video is on the screen (in which case it affects the game audio for that instance only, but it goes back to mute when I exit). This setting is also kept separately for headphones, so if you have the volume temporarily up when using your headphones, and then unplug your headphones, it goes back to mute. This is just done for you by the OS on most cases, so as an app developer, as long as you respect the OS settings and follow the guidelines it should work fine, but be sure to test it!

Android lacks a physical ringer switch, in general. Rather, audio streams are categorized based on whether they are app audio or alert audio (well, it's a bit more detailed than that, but generally). If there's active audio output from a game or video, the volume controls adjust app audio; if not, they adjust ringer audio. Again, respecting these settings is really important.

Both Apple and Google publish app design guidelines and testing guidelines, and when it comes to app audio, I'd say follow those to the letter, and test thoroughly. In general, it's a good idea to be deeply familiar with the recommended practices for apps on both platforms and adhere strictly to them—even the optional ones—except where there's a really really good reason to deviate from them.

As an example of a deviation from guidelines, one app I've been involved with had to override the user's font size settings because there's simply to way we could make the app design work well with dynamically changing font sizes. But this was not an easy decision, because it has major side effects on accessibility, so we had to make sure that the app was usable even if you can't read the text, through use of other visual cues, iconography, etc. I'm still not happy with that break from convention, but it was the best possible solution we could come up under the constraints we had to work under.

A lot of those guidelines are there for good reasons, and even if your reasons for deviating from them are good, it can be confusing to users who are used to the standard behavior on that platform and have formed habits around it. So it's usually best to play it safe and stick with the guidelines unless you have really good reasons to do otherwise. And for me, audio is one of the biggest ones to be careful about.

User avatar
phlip
Restorer of Worlds
Posts: 7572
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: sound and mute in mobile games and apps

Postby phlip » Mon Mar 16, 2015 1:15 am UTC

For Android, or at least the devices I've used, there's 4 separate volume controls: Ringtone, Notifications, System and Media. The first two are pretty obvious, System covers things like audio feedback on button presses and other filler noises, and Media covers things like music and games. The way I think about it is that Media covers things you're specifically telling the device to play, whether that's from a media player app, or game sound, or whatnot... while System covers more incidental sound, like the noises it makes when you're typing on the keyboard.

Putting the phone onto Vibrate mode will typically mute the Ringtone, Notifications and System sliders, but leave the Media slider up... so my music player will still play, but everything else is muted... but putting the phone onto Silent will pull all 4 volume controls down to zero, at which point nothing should be making any sound whatsoever.

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

User avatar
gilan
Posts: 30
Joined: Fri Mar 13, 2015 2:43 pm UTC
Location: Interwebs
Contact:

Re: sound and mute in mobile games and apps

Postby gilan » Mon Mar 16, 2015 8:32 am UTC

Thanks for the advice.

I hope we got it right. We tried to play it safe, so that if your phone is on mute or vibrate mode, the game will not produce any sound. While the game is active, the volume controls control game volume even if no sound is currently playing. These two requirements were more complicated to implement in Cordova than I expected. And I still don't think we have control over the ad audio from admob. :(
Trying to make games for smart people since 1986. http://beacegames.nfshost.com/

User avatar
phlip
Restorer of Worlds
Posts: 7572
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: sound and mute in mobile games and apps

Postby phlip » Mon Mar 16, 2015 2:22 pm UTC

Oh yeah, this goes double for ads... if my phone's on mute but your game still plays sound? That's an annoyance I might try to fix in the game options or somesuch if the game is enjoyable enough to be worth the effort, though it'll lower my opinion of the game somewhat. But if my phone's on mute and some ad still plays sound? Insta-uninstalled. No game is worth that.

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 3 guests