mapbox-navigation-android
mapbox-navigation-android copied to clipboard
How to play chinese text by MapboxVoiceInstructionsPlayer?
How to play chinese text by MapboxVoiceInstructionsPlayer?
my voiceInstructionsPlayer
voiceInstructionsPlayer = MapboxVoiceInstructionsPlayer( this, getMapboxAccessTokenFromResources(), Locale.SIMPLIFIED_CHINESE.language )
Android API: MapboxVoiceInstructionsPlayer Mapbox Navigation SDK version: mapbox-maps-android-android-v10.0.0-beta.18
@KayHung thanks for reporting this issue. I'm going to summarize what I've tested and observed so far so the team has more information.
Testing with our example activity I get the correct voice instructions when testing with English, Portuguese, and Japanese. When I configure the MapboxSpeechApi
, MapboxVoiceInstructionsPlayer
and the RouteOptions
for Locale.SIMPLIFIED_CHINESE.language. I can see (what looks like) Chinese is returned in the DirectionsRoute
and the voice instructions going to the speech player are Chinese with the street names in English (since i'm testing in the U.S.). I only hear the English spoken. There seems to be a blank pause where the Chinese should be spoken.
However, if I pass a sentence in Chinese or other language to the MapboxVoiceInstructionsPlayer
directly as on this line in the activity . Then I hear Chinese.
voiceInstructionsPlayer.play(
SpeechAnnouncement.Builder("Test hybrid speech player.").build(),
voiceInstructionsPlayerCallback
)
Sill investigating...
cc'ing @1ec5 for visibility and any thoughts on the topic.
It looks like there might be something wrong with the mp3 file that gets created. If I omit the file reference in MapboxSpeechApi
I hear the Chinese instructions.
Seems to be a problem with the file generated by the speech service. Check out these two URLs. Note: the tokens are omitted.
Not sure who to forward this issue to.
Chinese
https://api.mapbox.com/voice/v1/speak/
URL encoded: https://api.mapbox.com/voice/v1/speak/%3Cspeak%3E%3Camazon:effect%20name=%22drc%22%3E%3Cprosody%20rate=%221.08%22%3E%E5%87%BA%E5%8F%91%E5%90%91%E5%8C%97%EF%BC%8C%E9%A9%B6%E5%85%A5Main%20Street%EF%BC%8C%E9%9A%8F%E5%90%8E%E5%B7%A6%E8%BD%AC%EF%BC%8C%E9%A9%B6%E5%85%A5West%20%3Csay-as%20interpret-as=%22address%22%3E19th%3C%2Fsay-as%3E%20Street%3C%2Fprosody%3E%3C%2Famazon:effect%3E%3C%2Fspeak%3E?textType=ssml&language=zh&access_token=
Japanese
https://api.mapbox.com/voice/v1/speak/
URL encoded: https://api.mapbox.com/voice/v1/speak/%3Cspeak%3E%3Camazon:effect%20name=%22drc%22%3E%3Cprosody%20rate=%221.08%22%3EMain%20Street%E3%82%92%E5%8C%97%E6%96%B9%E5%90%91%E3%81%A7%E3%81%99%E3%80%82%E3%80%82%E3%81%9D%E3%81%AE%E5%85%88400%E3%83%95%E3%82%A3%E3%83%BC%E3%83%88%E3%81%A7%E5%B7%A6%E6%96%B9%E5%90%91%E3%81%A7%E3%81%99%E3%80%82%E3%81%9D%E3%81%AE%E5%85%88West%2019th%20Street%E3%81%A7%E3%81%99%E3%80%82%3C%2Fprosody%3E%3C%2Famazon:effect%3E%3C%2Fspeak%3E?textType=ssml&language=ja&access_token=
Not sure who to forward this issue to.
@mapbox/navigation-api @kshehadeh @danpat could you look into this when you have a chance? 🙏
@mandeepsandhu @dgearhart Anything come to mind with this issue?
@cafesilencio Do you have any updates about this issue?
@KayHung Other than confirming your initial bug report I don't have any updates at this time. The team that manages the service that produces the audio will be investigating.
@mandeepsandhu @dgearhart Do either of you have any updates?
Where does Locale.SIMPLIFIED_CHINESE.language
come from? language=zh
is incorrect. It should be language=cmn
https://api.mapbox.com/voice/v1/speak/%3Cspeak%3E%3Camazon:effect%20name=%22drc%22%3E%3Cprosody%20rate=%221.08%22%3E%E5%87%BA%E5%8F%91%E5%90%91%E5%8C%97%EF%BC%8C%E9%A9%B6%E5%85%A5Main%20Street%EF%BC%8C%E9%9A%8F%E5%90%8E%E5%B7%A6%E8%BD%AC%EF%BC%8C%E9%A9%B6%E5%85%A5West%20%3Csay-as%20interpret-as=%22address%22%3E19th%3C%2Fsay-as%3E%20Street%3C%2Fprosody%3E%3C%2Famazon:effect%3E%3C%2Fspeak%3E?textType=ssml&language=cmn&access_token=
Locale.SIMPLIFIED_CHINESE.language comes from java.util.Locale. Where does cmn
come from? Is it defined in a constant somewhere?
Our documentation here: https://docs.mapbox.com/api/navigation/directions/#instructions-languages indicates Chinese (Simplified) is zh-Hans.
Our documentation looks to be incorrect. cmn
comes from AWS docs - https://docs.aws.amazon.com/polly/latest/dg/ph-table-mandarin.html
When requesting a route, the RouteOptions
takes a language parameter. A value of "cmn" for the RouteOptions
doesn't return Chinese in the DirectionsRoute
but a value of Locale.SIMPLIFIED_CHINESE.language will. Having to pass a different language value (cmn) for the speech API doesn't make sense IMO. I think this is more than a documentation issue. The speech API should take the same value as the RouteOptions
.
l. Having to pass a different language value (cmn) for the speech API doesn't make sense IMO.
I agree and I would expect Locale.SIMPLIFIED_CHINESE
to work. I'll cut a ticket to tweak api-voice to handle that.
I looked at the list of language codes between the Amazon link you referred to an the Mapbox documentation. Arabic looked like it might also be affected by this.
Support for Chinese is broken due to mapbox/locale-utils#7, and support for Arabic is also broken due to mapbox/locale-utils#9.
Our documentation looks to be incorrect.
The Voice API uses locale-utils to match the written language codes from text instructions to spoken language codes expected by text-to-speech engines. The API documentation is correct because it only attempts to list the written language code for written instructions (that happen to be read aloud).
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.