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
[SFOS] Prevent voice navigation stopping other audio #120
Comments
I have noticed that also a lot of other applications struggle with this, while the core Sailfish OS applications don't really. It might be that the latter have custom handling for this (e.g. music is dimmed for a short while to play an "incoming message" sound for example) through PulseAudio? |
Its not a priority for me right now, but I will look into it when time permits. If someone wants to investigate the issue and propose a solution, that would help a lot. |
@paulvt maybe that's a thing to ask the jolla devs on TJC or the in the community meetings? |
@bonanza123 Yes, I was considering this too. Had no time for it yet, though! |
Hmm, I looks like quite easy: Change: Line 71 in e84bf7f
And remove the lines with Those do not work. Then, when I have my media player running, the voice will play over the music. Only there is no volume option. So the voice is not always loud enough. So when we need to crank up the volume, the voice generators should produce WAV files with higher volume in it. |
Is the SoundEffect quieter than Audio? I cannot increase WAV volume, at least using some switch for flite/mimic. Sounds line SoundEffect requires more resources. Otherwise, we should surely test it. I don't have anything playing on the background, so cannot test that aspect. |
Does that not depend on the relative volume settings for media and notifications/ringtone in the OS? |
Good question - I don't know what is it linked to. |
Hmm, I could only find a ringtone volume setting, no notification volume setting. And when the media player is running, the volume buttons it will increase the playback volume. And I guess that the SoundEffect will just use the same volume. I do get the feeling that when a notification sound is played, the media player volume is reduced... but I could also imagine that... Also I have not investigated the difference between Audio and SoundEffect object and their limitations. So then I turned to the SoundEffect, and that just worked out of the box. With some minor changes in the QML file. So, now I have found a way to increase the Voice volume. I was able to install ffmpeg and ffmpeg-tools on my Sailfish OS, and then used ffmpeg to increase the volume: https://trac.ffmpeg.org/wiki/AudioVolume So, in order to make the audio crank up logic work for all Voice generators, I added the following code to the 'voice_worker' function at https://github.com/rinigus/pure-maps/blob/master/poor/voice.py#L220
ffmpeg will take only miliseconds to process the WAV files. And you could make a setting for the amount of dB, so that you can make an adjustable Voice volume setting. I test and made this code just by changing you app code on my device directly. That works the easiest for me. So no pull request at the moment |
I looked into audioRole as well, but it was a failure for me too. As for using ffmpeg - interesting. It adds one more dependency, but its probably OK. I'll have to check it, give me couple of days. So, we are also looking for solution of #16 , which I closed since I couldn't see additional option on generator. Good job! |
Cool! Did not see that. :) As I did some testing, the value 11dB is the max value. If you go higher, it gets awful. Also, there is a 'loudnorm' option, which does its job, but had the feeling that was not loud enough for me. But it could maybe be added as an option somewhere at sound settings or voice settings. |
Also, ffmpeg itself is installed automatically. According to my zypper:
But you need the ffmpeg-tools to get the ffmpeg binary.
And they are available by Jolla itself, so I think you need only to depend on ffmpeg-tools. But that should be tested, as I have already installed it. |
Hi, is it at least possible to update the code in https://github.com/rinigus/pure-maps/blob/master/qml/pure-maps.qml#L76 to:
basically, that is the answer to this issue. It is not the nicest option, it does do the job. Now I have to patch that. For now, the volume is secondary. I do like my music more.... ;) |
I will have to test it again, but I think that |
Tested it finally. On my device, there are issues with Bluetooth (BT) switching when using
For |
When applying the change mentioned above and testing it with my BT headset I have different test results:
So maybe something changed in Sailfish OS in the meantime (they noticeably did fix some BT/audio routing stuff for me), our tests are different or something else is going on? On a different note, I was confused by the discussion about the notification volume, because I had assumed that using the "sound effect" style, it would work the same as an incoming sms/XMPP message notification, namely that the media volume is slightly dampened for the duration, but that does not seem to be the case, that is very unfortunate! So, I still wonder how they do that in.. Lipstick? |
I will retest with the latest SFOS with SoundEffect, I don't understand your third test result. Did you hear the notification over speaker? I presume you tested it with SoundEffect, right? |
Yes, with SoundEffect patched in the QML and yes, sorry, the notification was still sent over the speaker, but not over the music, as that is stopped when one disconnects the BT headset. |
After struggling with this on UT, I've opened a thread at the UBports forum sound issue playing music and voice navigation. There was a comment about PA providing "alert" audio streams that damp all other audio. Maybe that helps? |
Pure Maps is using QML Audio for sound. We tested SoundEffect as well on SFOS, but it had some issues with the bluetooth for me - 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. |
Reading QTMultimedia docs, I stumbled upon audioRole: AlarmRole to the
A web search indicates that property |
@padu22: try to bump https://github.com/rinigus/pure-maps/blob/master/qml/pure-maps.qml#L20 to 5.6. It is part of UT for you. |
Thanks! Pure Maps starts indeed again when using
Obviously, I'm stabbing in the dark. |
I think it should be |
That's it! With |
@padu22, what about adjusting volume by buttons when using notificationrole? |
You can use uVolMan to control the different volumes btw. |
Have to get an API key first. Test voice is too short to do proper testing. Will report back. |
You can test with OSM Scout Server. No need for an API key then. |
While the test voice works, I get no voice directions when doing true navigation, whether I use |
I can't reproduce the issue. Are you sure that voice is enabled in the navigation menu? |
Thanks! Works now. Need to find some more time for real life testing. |
First quick tests show that notification volume can be changed via buttons. Volume then also applies to the next voice directions. Volume of background music (tested music app only) and notification are completely unrelated. Volume change always applies to current foreground audio source. Getting timing right, I have been able to get quieter voice directions than background music. Tested with phone speakers as well as Bluetooth headset with Nexus 5. Tested A2DP profile only, that is, volume change via phone buttons only. Can't test with AVRCP profile. Will continue testing and report back if there are additional findings. |
I've tested one more thing so far: Of the audio roles listed here, the entertaining ones The remaining audio roles |
Using With Phone volume buttons affect current Bluetooth foreground audio stream. Since only A2DP profile is used, carkit volume controls affect carkit side volume only. Therefore, carkit volume controls have an effect on all (Bluetooth) audio streams, not the current foreground audio stream only. (Things might be different with AVRCP profile.) Tested with Nexus 5 and OnePlus One (both Ubuntu Touch, OTA-12) against VW Composition Media carkit. |
OK, so from that testing, do you recommend NotificationRole then? |
Speaking for UT only: By any means, yes! For other platforms, I suggest some prior testing for obvious side effects. After all we're talking Bluetooth. What could go wrong with that? 😄 |
Looks like we at least can use it on SFOS. I will test it in the car when I can |
To simplify testing by others, I made the changes in master: e34df3c |
Solution found by @Karry for OSMScout, as described in - https://forum.sailfishos.org/t/playing-audio-file-with-qmediaplayer-pause-media-player/2732/5 - Karry/osmscout-sailfish@84dd522 - qt/qtmultimedia@1c5ea95 Fixes #120
Should be fixed in 5370762, closing. Reopen if bit fixed after the next release |
I have tested it with my Bluetooth headset on (on Sailfish OS 3.4). It works in so far that it pauses music during a notification and it resumes the music again afterwards, great! Except, it turns out that the the navigation notification come out of my phone speaker instead also out of my headphones, is this normal? Do you want me to reopen, file a new issue or is this going to be it? |
Frankly, I tend to consider this as a bug of SFOS. In some respect, Pure Maps does use the correct stream for notifications but they are voiced over a wrong channel. Maybe we should open an issue at SFOS forum. |
I just found out that audio class also affects pulseaudio routing. It is configured in
So, for proper voice routing and good behaviour with music player, there are two options:
|
@Karry: What a find!!! Please file an issue at FSO and hopefully it will get fixed on device level. As the same code is used for different platforms, it would be silly to start swapping to Thank you very much for reporting it here as well. It is just thanks to you the original solution was established and now I hope it will be restored in future. |
I wonder did you report that in the forums? |
Coming back to the original issue with playback being completely stopped, the fix you implemented in 2020 is unfortunately not complete. With native music applications it does in fact work, so after the voice finishes the native music gets unpaused. But Android applications don't do so. |
In principle, this is not Pure Maps bug, but a bug of underlying OS. Pure Maps does not issue a command "STOP" to other apps running on device, it just plays its own sounds. The fact that OS stops other audio streams and forgets to resume them, is up to OS. On Pure Maps side, after @Karry's findings, correct audiostream was selected that is sufficient to indicate to OS the intention. Unless Pure Maps has to use some other stream, I don't see much we should do here. Indeed, it would be good to report the issue to SFOS forum. Just state what you observe and feel free to link here - no need to use specific terms. Closing it here as it is not Pure Maps bug. |
If I am listening music while navigation, the music stops after each voice navigation announcement and I have to resume it again (while not paying attention to traffic). This probably also ties into #104.
There are a few options here, I guess:
As a last remake: Pure Maps is an awesome application, almost got all, amazing!
The text was updated successfully, but these errors were encountered: