This object is in archive! 

Lower volume or pause music when playing Navigationsounds

brotbuexe shared this idea 12 years ago
Completed

When I play music in the background and use navigation with tts, the volume of the navigation speech is as loud as the music.


Would be nice to lower the music for the time the navigation speechs, if this is possible.


When I get a message or a email and the notification sound is played it stops or lowers the music for this time.

Replies (18)

photo
1

Hi,


because I do not listen music during navigation, I completely miss this problem.


Thanks @music4all for creating a new topic with precise description of this problem (I've merged it into this idea).


In current Locus, this already works, but only for a basic sounds (beep, TomTom voices). I found a solution how to correctly handle this task also for TTS. So in next version (probably 3.3.0), this will work as expected!

photo
1

You're certainly most welcome, Menion. And... WOW. I posted that new topic just a few hours ago, and, already, you've marked it as Complete. You guys, seriously, you're *AMAZING.* Thanks so very, very, very much!! Cheers, music4all

photo
1

Wait, no, really, I'm still amazed here... Thanks again, Menion. Big, BIG thanks :).

photo
1

Rather say "Thanks", after you test new change/imporvements and it will work.


And we are usually not so quick - just in case, it's something easy to do and something that should be already done for a long time ;)

photo
1

Sounds reasonable, yes. Will wait, and, hopefully, thank you a second time after testing your change/improvement. Sure, I can do that. No probs. For now, then, many thanks for the prompt reply! :)

Cheers

photo
1

Hi Menion. Now that I've waited (for more than long enough ;)) to test the improvements, I'd say I'm quite sure that they work--aha, and very well. So, I'd like to officially say thanks!! Great work, indeed. I continue to be super impressed. Truly. I wonder though, would it be possible to further refine this feature, by adding into the settings an option where the user can specify one of two possibilities for how much the music volume should be lowered when Locus needs to beep a notification or speak navigation instructions? Right now, the music volume gets temporarily lowered *all the way down to ZERO*. It'd be fantastic if I could select an options in the settings that would tell Locus to, instead, temporarily lower the music volume *down to 20% or so*. Lowering the music down to 20% or so allows notifications and navigation instructions to be complete and clearly heard, and yet is quite a bit less disruptive than constantly having your music interrupted by total silence. I know you're familiar with Google Maps. Google Maps does this, what I'm describing. It temp lowers the music only down to about 20%, rather than completely silencing it. I'm thinking that you already did the really challenging part when you figured out how to code this behavior in the first place--and that adding a way to tweak it a bit as described above should then be fairly quick and easy for you. Am I assuming correctly? Hope so! Because it sure would be nice to see it implemented. Let me know, ok? Thanks in advance, and cheers!

photo
1

Hello,


glad it works. Unfortunately I'm worried that I cannot do more here. What I use is this parameter http://developer.android.com/reference/android/media/AudioManager.html#AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK , which should do exactly what you wrote. For example on my device, it really only lower volume of media player, not completely silent. Why it do not work for you, when with Google Maps it works? Sorry, I have no idea ...

photo
1

The link you mention is directly related to the link I gave you when we started this thread, so yes, that makes sense. Now I'm perplexed as to why on your device it only lowers the vol (not completely silent), whereas on mine (G-S6) it completely zeroes the volume (unlike with Google Maps). Well, then simply let me know if, later, you think of a way you might be able to get this to work on devices like mine, will you? I'll be more than glad to help you test beta versions and such. Thanks again, Menion!!

photo
1

Hmm I'm trying to find some clue, why this may happen and as I think about it, only difference should be stream, that Locus use for notification.


Please check "Audio stream" settings: http://docs.locusmap.eu/doku.php?id=manual:user_guide:settings:misc . And change it to the second option. Maybe this should help. We will see ...

photo
1

Many thanks for your reply, Menion. On my ride today, I tried your

suggestion, and changed "Audio Stream" to the second option

("Notification stream"). Nothing was different though. Still, just as

before.


I wonder what might be going on. The music temporarily

lowers--and gradually, which is nice--but, yep, still lowers all the way

down to zero. Then gradually (again, nice that it's gradual) back up to

original volume.


Great that it works at least. Awesome if, even

for devices like mine (Galaxy S6, Android Lollipop 5.0.2), you can

think of any coding adjustments that might make it possible for the

volume to so very nicely and gradually go down--but only to about 20%,

as described above.


If you do, then, like I wrote before, I'll be more

than glad to help by testing beta versions and such, ok? Thanks again!


Cheers

photo
1

Hi,


I just finished one moring run and test this feature (music and TTS notification from training manager) and for my suprise, same effect, so I have to invest some time to test it.


Anyway I think:


1) there is no option from developer point of view, to affect volume of another app

2) if volume is lowered to zero or to 20%, depends on app that lower it's volume

3) every app act differently


I'm now using PowerAmp player for music, so I have to try some different media player and we will see. Anyway no matter what will be result of this testing, I still have absolutely no idea how this may be improved on Locus side, as I see no option in Android development tools, sorry.

photo
1

I see what you're saying. I went back to http://android-developers.blogspot.com/2013/08/respecting-audio-focus.html, and found a link to an example source code that I'm hoping might be helpful to find out more; here: https://android.googlesource.com/platform/development/+/master/samples/RandomMusicPlayer.

photo
1

BTW, yes, I think you're right, in that it is the OTHER app that needs to be coded to lower its vol down to 20% and not silence itself completely. However, I sent you the example source code above because, well, again, when I use *Google Maps and Pandora*, then Pandora lowers its vol down to about 20% for any and all of Google Maps' navigation instructions. Why then, when I use *Locus and Pandora*, Pandora lowers its vol to 0%, instead? What it different in Locus, compared to Google Maps, that makes Pandora behave differently in this respect? I'll see if I can find any more clues on my side, and, if I can, I'll gladly share them with you. Hopefully, there's a relatively easy way to tweak the code in Locus so it's possible to achieve the same results. Thanks again for even looking into this, Menion.

photo
1

Thank you for your searching. I do not know, how much you know about java and developing for Android. Anyway these two functions:


https://android.googlesource.com/platform/development/+/master/samples/RandomMusicPlayer/src/com/example/android/musicplayer/MusicFocusable.java


are called in this music player, when something change in focus. This is exactly as I wrote - it is on the side of music play, how it will handle changes in focus for playing music.


Testing:


Player: Poweramp

channel: notification - music completely silent

channel: music - music completely silent


Player: AIMP

channel: notification - absolutely no change! (so music volume still same even that Locus speak TTS message

channel: music - absolutely no change


Player: PlayerPro

channel: notification - works as expected!

channel: music - works as expected!


Player: Google Music

channel: notification - works as expected!

channel: music - works as expected!


Result:


Four random music players (as I wrote before, I now use Poweramp) and as you see, result is also random. So just confirmation, that result depend on music player, not Locus!

photo
1

Many thanks for your reply. I'll take a look at the link you sent me, do a bit more digging after that, and later let you know if I find something that may help figure this puzzle out. As I wrote above, yes, I do think you're right, and that it's the OTHER app that needs to be coded for a 20% vol (rather than total silence).


Still, I'm perplexed as to why this combo: *Google Maps with Pandora* yields different results than this one: *Locus with Pandora*. In both cases, it the SAME OTHER APP (Pandora). The difference is whether Pandora interacts with Google Maps or Locus. So, what is different about Locus that makes Pandora behave differently than it does with Google Maps?


Boggling, indeed. Anyway, once again, big thanks for even looking into this, Menion. I'll keep you posted if and when I find any other clues that might help. In the meantime, if you could take a peek at the link I sent you a few minutes ago with that example source code (https://android.googlesource.com/platform/development/+/master/samples/RandomMusicPlayer), just in case there may be a small clue there, that'd be awesome. Cheers

photo
1

Fine. And sorry, I think I've invested into this topic more time, then needed. If you find some specific information, that may solve it, I'll gladly implement it. But I have no idea why it works with Google Maps, sorry.

photo
1

Thanks for your reply, and no worries. Thought I'd update you with new findings. Even though now I'm more perplexed... But happy, because, good news:


Yesterday, I took Locus Offline. Then, also in Locus, I went to Settings, Miscellaneous, "Audio Stream" and selected the first option (Music stream). Also, on my phone, I turned Mobile Data off (again, with Locus on Offline mode). This time, I used Rdio (also Offline--with previously downloaded songs synced to my phone). I also tried Google Play Music--AKA Google Music (ditto, Offline, with previously downloaded songs synced to my phone).


Results: BOTH Rdio and Google Play Music temporarily lowered their volume down to about 20% (rather than all the way to 0% as was happening before).


Even more strangely, after this now worked properly with everything Offline, I kept Locus in Offline Mode but tested Rdio and Google Music with Mobile Data turned back on, for streaming. Both Rdio and Google Music continued to work as expected (vol lowered to about 20%, *not* silence, as before).


I'm sure you'll be just as surprised, and, well, who knows why now things are working properly after the above steps, and why they weren't before. FYI, yes, I had already tried Rdio before, not just Pandora; but, before, both were going all the way down to silent when ducking.


Aaaaaanyway, now that things are working so nicely with the three players I use the most, I'm hoping this is not an intermittent thing, and things continue to work so well after whatever it is that happened when I took the above steps fixed whatever it is that was going on before.


You're so right, too, results are random and depend hugely on the music player.


Still, maybe sometime in the future, some other clues related to this just haphazardly come your way, and the info I'm writing here helps you (even if only a tiny bit), to piece this puzzle together. If so, how cool! If not, hey, just thought I'd thank you once more, because it was already so great that the ducking you coded was mostly working... but, now that, for whatever bizarre reason, it's working fully as you intended it from the beginning, it's even better! So, yep, thanks again, Menion!


Cheers

photo
1

Hi, I just quickly checking on internet if I may find more about this, but seems there is a lot of posts about similar problems, but none have results as "it started to work again for now reason", as in your case. Interesting :).


Anyway no matter what happen, I'm glad it started to work. Next time, I'll suggest to you restart of device, as this is best cure on various problems and maybe it should help here also.


You are welcome!

Replies have been locked on this page!