mapbox-navigation-ios icon indicating copy to clipboard operation
mapbox-navigation-ios copied to clipboard

Enable developers to set/adjust the volume of spoken instructions

Open akitchen opened this issue 6 years ago • 4 comments

It should be possible for developers to easily set the volume of spoken instructions during turn-by-turn navigation. Unfortunately this may be more complicated than it seems as the SDK adaptively switches between a media player and the built-in TTS system depending on network and other conditions.

Ideally we could address #1826 , but at least we should make it possible to set the volume programmatically so that developers can control this and/or expose it to their users for finer-grained control.

We have some code in place which appears to be trying to do this, but I don't think it is working as expected. Therefore I've also marked this as a bug.

akitchen avatar Feb 15 '19 20:02 akitchen

AVAudioPlayer.volume and AVSpeechUtterance.volume are both relative to the system audio volume on a scale of 0–1, with 1 being the default. Per #1826, an MPVolumeView is the preferred way to set the system audio volume on an absolute basis. For a non-UI setting, AVMutableAudioMixInputParameters.setVolume(_:at:) might do the trick, as described in QA1716. Another option is to modify the <prosody volume="…"> attribute in the SSML instructions. However, the SSML is generated by the Directions API; since we don’t have ready access to an XML parser, we should avoid munging XML strings as much as possible.

1ec5 avatar Mar 13 '19 15:03 1ec5

I think I may know what is going on. I've been testing with 4 of the different English Polly voices and comparing what I'm hearing between Mapbox and other GPS providers. I think it may not be that the voice isn't loud enough...it may be that the voice is equalized so that it's too mellow. Is there a way to adjust the the way the voice is equalized so that it's much more treble and stands out against all of the other noises in a car?

The reason I've come to this conclusion is because when there is a terrible connection, the Polly voice its replaced with the Text-To-Speech voice I've set on the device. That voice has much more treble in it and is much easier to hear in the car. I feel that the Polly voices are two mellow and focused toward the midrange of the sound spectrum. Does this make sense?

Regardless, I keep getting asked by users to make the voice louder, if possible. Any changes that could be made would be really nice.

billyking991 avatar Mar 20 '19 22:03 billyking991

Is there a way to adjust the the way the voice is equalized so that it's much more treble and stands out against all of the other noises in a car?

MapboxSpeechSynthesizer currently uses an AVAudioPlayer to play back the MP3 files returned by the Mapbox Voice API. It is possible to apply equalizer effects using AVAudioEngine, but I don’t know if that would play well with the AVAudioSession ducking settings.

On the backend, we might be able to have the Directions API set a higher volume and pitch in SSML, but I don’t know if this option will yield the desired improvement and whether there would be any downsides for other languages.

1ec5 avatar Nov 23 '20 19:11 1ec5

@jyrigo @AhmerKhan1 we are getting reports from iOS drivers that the spoken instructions are too low and they can't hear them regardless of the volume of their device. This is for both iOS and Android. Does this ticket track an update that will allow us to remedy this?

cc @mapbox/straightaway-android-team @mapbox/straightaway-ios-team

zacharyblank avatar Mar 29 '21 15:03 zacharyblank