osmandapp / OsmAnd

OsmAnd
https://osmand.net
Other
4.64k stars 1.01k forks source link

If recorded voice is used, some of the elements are trimmed even if the "street names (TTS)" option is enabled. #9368

Open Chumva opened 4 years ago

Prusaker commented 4 years ago

I experimentally determined that elements fromRef и fromStreetName (from array streetName) have type "undefined" (item is declared but not assigned a value). Because of this function follow_street(streetName) cannot correctly identify voice instructions (ON street ot TO street).

sonora commented 3 years ago

We used to have a bug where many TTS voices used commas also for the recorded voices, which trimmed prompts at those places. I had fixed many months ago. Can anyone reproduce at all with the latest js config files?

Prusaker commented 1 year ago

I checked today with latest nightly build the data array passed to the script (for the recored voices) with the ref and street name. Unfortunately type of streetName["fromStreetName"] and streetName["fromRef"] still "undefined".

sonora commented 1 year ago

Can you produce a bug? Recorded voices cannot process street names, so it should be ok?

Prusaker commented 1 year ago

Functions follow_street(streetName) and turn_street(streetName) not working as they should.

When turning onto a street with the same name, the function should not "say" the name of the street I'm turning into. To do this, the function compares the variables streetName["fromStreetName"] and streetName["toStreetName"]. Variable streetName["toStreetName"] is defined. However variable streetName["fromStreetName"] is not defined, because of which the function cannot work correctly.

The same thing happens with variables streetName["fromRef"] and streetName["toRef"]. streetName["toRef"] is defined, but streetName["fromRef"] - not defined.

sonora commented 1 year ago

Can you plesse specify which language and voice (TTS or recorded) you are using, and give a specific example what you hear, and what you expect to hear?

Prusaker commented 1 year ago

I used own recorded language pack (of the type like https://github.com/osmandapp/OsmAnd/issues/15113, this script based on recored language pack ru_0.voice.zip from OsmAnd Local Indexes List).

It would be possible to add to the script a check for numbers or names of roads so that when turning onto a road with the same name, the script does not say "turn onto road xxx" in this case.

To do this, you need to compare the values of the variables streetName["fromStreetName"] and streetName["toStreetName"], or streetName["fromRef"] and streetName["toRef"]. These variables are used in the text of the original script ru_0.voice.zip.

However, some variables (streetName["fromStreetName"] and streetName["fromRef"]) are simply not transferred from the program to the script. This is true only if the option "Use recorded language "is enabled in the OsmAnd. For TTS voices, these variables are correctly passed inside the script.

I'm just asking, if possible, to pass these two variables from the program to the script with recorded voice.

sonora commented 1 year ago

Probably. I'd have to research where that filtering happens and for what purpose. I do not want to fix anything that's not broken. And recorded voices can neither pronounce street names nor should there be a necessity for them to use their values for any kind of logic? That's why I am asking for a bug example and directions how to reproduce. I anyway minimize maintence effort for recorded voices, prioritizing TTS.

Prusaker commented 1 year ago

In my script, the recorded voices can say most of the road numbers (at UA, BY and RU). To reproduce the error, you need to install my script with recorded voices and try to build any route where there is a turn onto a road with the same number. For example, from 53.0633094, 24.8945115 to 53.0596482, 24.9005476. If the variable streetName["fromRef"] were passed to the script, then the phrase "turn onto the P50 road" would not be spoken. However, this does not happen, and the phrase is pronounced. ru1.zip

sonora commented 1 year ago

That's a lot of custom scripting for individual use cases. What's the motivation to not use TTS?

Prusaker commented 1 year ago

TTS does not always correctly pronounce street names and road numbers.

sonora commented 1 year ago

TTS does not always correctly pronounce street names and road numbers.

Maybe you want to try different TTS engines, like google, Samsung, or some third parties'. They seem to vary considerably in the quality of their output.

BTW: At first sight I cannot identify that the passing of certain parameters is suppressed based on the selection of your voice. Are you sure about this? Seems I would have to dig much deeper to find it if this really is the case.

Prusaker commented 1 year ago

I checked with the help of additional commands that analyze the variables passed to the script.

In function "turn_street", I inserted code that determines the data type of one of the variables and pronounces a certain phrase depending on the result:

var rrr = ""; if (typeof streetName["fromRef"] == "undefined") rrr +="1.ogg "; if (typeof streetName["fromRef"] == "object") rrr +="2.ogg "; if (typeof streetName["fromRef"] == "boolean") rrr +="3.ogg "; if (typeof streetName["fromRef"] == "number") rrr +="4.ogg "; if (typeof streetName["fromRef"] == "symbol") rrr +="5.ogg "; if (typeof streetName["fromRef"] == "string") rrr +="6.ogg "; if (typeof streetName["fromRef"] == "bigint") rrr +="7.ogg "; if (typeof streetName["fromRef"] == "function") rrr +="8.ogg "; return rrr;

If you build a route with a turn to any road, then when you voice the turn instruction, you can hear the phrase from the test code.

For streetName["fromRef"] and streetName["fromStreetName"] result is "1" (type - undefined) For streetName["toRef"] and streetName["toStreetName"] result is "6" (type - string)

Almost the same code can be built into fuction "turn_street" in a script that uses TTS voice:

var rrr = ""; if (typeof streetName["fromRef"] == "undefined") rrr +="1 "; if (typeof streetName["fromRef"] == "object") rrr +="2 "; if (typeof streetName["fromRef"] == "boolean") rrr +="3 "; if (typeof streetName["fromRef"] == "number") rrr +="4 "; if (typeof streetName["fromRef"] == "symbol") rrr +="5 "; if (typeof streetName["fromRef"] == "string") rrr +="6 "; if (typeof streetName["fromRef"] == "bigint") rrr +="7 "; if (typeof streetName["fromRef"] == "function") rrr +="8 "; return rrr;

In this case, for all variables streetName["fromRef"], streetName["fromStreetName"], streetName["toRef"] and streetName["toStreetName"] the type value will be 6 (type - string).

Thus, it turns out that for a script with a recorded voice, some of the variables are not transferred into script.

sonora commented 1 year ago

Ok.Would have to dig deeper to find where/why parameters are not passed.

Still the recommendation is to find a TTS engine which gets things right and optimize what we can for that use case, rather than put lots of effort into recorded voices.