UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    sound issue playing music and voice navigation

    Scheduled Pinned Locked Moved Support
    18 Posts 5 Posters 1.4k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • P Offline
        padu
        last edited by

        I can observe different behaviour between uNav and Pure Maps when doing voice navigation while playing music. While uNav mixes voice directions with existing audio stream from music app, Pure Maps is able to pause the title currently played, gives voice directions, but then fails to resume music app playing the title. In either case, the behaviour is unsatisfactory. I can observe the same behaviour when playing audio via phone speakers and with a headset connected via Bluetooth.

        What I would prefer is

        1. Mix voice directions with current audio, like uNav does. But tune down existing audio volume for other apps for the time voice directions are played.
        2. Like Pure Maps, pause all other audio streams. Play voice directions. But finally, resume audio streams from other apps automatically.

        Before making a bug report on uNav and Pure Maps, I'd like to ask if UT's app model is able to cover the outlined behaviour or if there is a reason both apps don't work that way?

        tested with:

        • OTA-12
        • Nexus 5 (hammerhead)
        • OnePlus One (bacon)
        1 Reply Last reply Reply Quote 0
        • K Offline
          kugiigi
          last edited by

          My guess is that uNav does not use media hub while PureMaps use it. I'm not sure how advanced media hub though in terms of features. My guess is that it's not yet capable of doing the ideal behaviors.

          P 1 Reply Last reply Reply Quote 0
          • P Offline
            padu @kugiigi
            last edited by

            @kugiigi One more observation: When playing music and either taking a photo with camera app or making a screenshot (pressing vol up+down), music volume is reduced while playing the "click" sound. So it looks like UT apps can already control foreign app's audio volume.

            Well, I could observe reduced volume with the OPO (bacon) only, but not with Nexus 5 (hammerhead). Don't know if that's device specific or if and how I disabled the "click" sound with the latter device (my daily driver).

            Can anyone reproduce reduced music app volume when taking photos with any other device than bacon?

            AppLeeA 1 Reply Last reply Reply Quote 0
            • AppLeeA Offline
              AppLee @padu
              last edited by

              @padu said in sound issue playing music and voice navigation:

              So it looks like UT apps can already control foreign app's audio volume

              In fact that is good to know.
              This might help someone investigating this behavior.

              I'll test later on the N5 if I can have the same as with your OPO. IIRC there is an option to enable/disable the shutter sound.

              1 Reply Last reply Reply Quote 0
              • U Offline
                UniSuperBox
                last edited by

                This is actually handled by Pulse directly. When an "alert" stream is playing, other streams "duck", or become quieter.

                https://github.com/ubports/ubuntu-touch-session/blob/743214a6b0af70f719bec3c1b789ede316e75319/touch.pa#L134

                P 1 Reply Last reply Reply Quote 0
                • P Offline
                  padu @UniSuperBox
                  last edited by

                  @UniSuperBox said:

                  This is actually handled by Pulse directly. When an "alert" stream is playing, other streams "duck", or become quieter.

                  Thank you! I can't help, but playing voice directions as "alert" stream sounds much more appropriate to me than the shutter sound. 😃 Will file bug reports.

                  P 1 Reply Last reply Reply Quote 0
                  • P Offline
                    padu @padu
                    last edited by

                    @padu said in sound issue playing music and voice navigation:

                    Will file bug reports.

                    Done.

                    uNav: Added GitHub issue use alert audio stream for voice directions #23
                    Pure Maps: Added a comment to existing GitHub issue Prevent voice navigation stopping other audio #120

                    1 Reply Last reply Reply Quote 0
                    • R Offline
                      rinigus
                      last edited by

                      Pure Maps is using QML Audio for sound. We tested SoundEffect as well on SFOS, but it had some issues with the bluetooth - will have to retest it. I don't know how to patch it to PA alert. You could see if SoundEffect will work for you (change it at https://github.com/rinigus/pure-maps/blob/master/qml/pure-maps.qml#L88) and whether it works better.

                      P 1 Reply Last reply Reply Quote 0
                      • P Offline
                        padu @rinigus
                        last edited by

                        @rinigus said in sound issue playing music and voice navigation:

                        You could see if SoundEffect will work for you (change it at https://github.com/rinigus/pure-maps/blob/master/qml/pure-maps.qml#L88) and whether it works better.

                        Never got anywhere with Qt/QML or clickable before. Good opportunity to change that. Will try my best. 😃 Might take a couple of days, though.

                        R 1 Reply Last reply Reply Quote 0
                        • R Offline
                          rinigus @padu
                          last edited by

                          @padu , indeed! there are too few on mobile linux side - have to get hands dirty at some point. Good luck!

                          1 Reply Last reply Reply Quote 0
                          • P Offline
                            padu
                            last edited by padu

                            Wow, that turned out to be quite easy (on Ubuntu 20.04). I have not been able to do production tests, yet, due to missing API keys.

                            Am I correct that I need one key for Mapbox for tiles rendering (Western Europe) and one key for MapQuest for the routing service?

                            I did test audio with the TTS test in the settings section. (Compiled the slim version with Pico TTS only.) After applying the following patch

                            -    Audio {
                            +    SoundEffect {
                                     id: sound
                            -        autoLoad: true
                            -        loops: 1
                                     }
                            

                            as per this GH issue comment, test voice was mixed with existing audio at the same volume level. No pausing and no damping of other audio streams. Tested with phone speakers and Bluetooth headset connected to N5 and OPO. No Bluetooth problems otherwise.

                            R 2 Replies Last reply Reply Quote 0
                            • R Offline
                              rinigus @padu
                              last edited by

                              @padu , can you change the volume of the instructions? this seems to be the second issue with this approach

                              P 1 Reply Last reply Reply Quote 0
                              • R Offline
                                rinigus @padu
                                last edited by

                                @padu: forgot to reply - yes, you need mapbox api key. or use osm scout server offline for testing

                                1 Reply Last reply Reply Quote 0
                                • P Offline
                                  padu @rinigus
                                  last edited by padu

                                  @rinigus said in sound issue playing music and voice navigation:

                                  @padu , can you change the volume of the instructions? this seems to be the second issue with this approach

                                  SoundEffect property volume has an effect with and without Bluetooth (tested with N5 and headset). Or do you mean changing volume with buttons?

                                  R 1 Reply Last reply Reply Quote 0
                                  • R Offline
                                    rinigus @padu
                                    last edited by

                                    @padu: yes, with volume bottons

                                    1 Reply Last reply Reply Quote 0
                                    • P Offline
                                      padu
                                      last edited by

                                      Discussion continued in GitHub issue Prevent voice navigation stopping other audio #120.

                                      1 Reply Last reply Reply Quote 0
                                      • P Offline
                                        padu
                                        last edited by

                                        New Pure Maps release 1.29.0 contains a patch that applies audio role notification to voice directions. Normal audio, e.g., music, is no more stopped, but damped now.

                                        VW carkits have an infamous bug, that auto-mute Bluetooth audio after music was paused/stopped. When the next voice direction came in, unmuting took some time, cutting-off part of directions. This problem does not happen any more with the new Pure Maps release.

                                        Using Ubuntu Touch as daily driver got a little more comfortable again. Thanks @rinigus and jonnius!

                                        1 Reply Last reply Reply Quote 2
                                        • R Offline
                                          rinigus
                                          last edited by

                                          That's thanks to you for finding it out 🙂

                                          1 Reply Last reply Reply Quote 2
                                          • First post
                                            Last post