Text to Speech pour lire correctement un nombre en français

Bonjour,

J'ai crée un programme simple avec Arduino qui affiche la valeur de la température de la pièce dans le moniteur série.

A l'aide d'app inventor, je souhaite que cette température soit lue à l'aide de Text to Speech, la valeur de la température étant envoyée vers le téléphone portable via un capteur Bluetooth HC-06.

J'obtiens un résultat, mais à un détail près: supposons que la température affichée sur le moniteur série soit de vingt-six degrés (26), alors text to speech dit "deux" puis "six" et pas "vingt-six".
Je suppose que l'erreur vient du fait que les chiffres sont envoyés successivement par paquets de bytes. D"ailleurs, dans le code "app inventor" j'utilise bien:
"call text to speech".Speak message - "call BluetoohClient1.ReceiveTextNumberofBytes" - " call Bluetoothclient1.BytesAvailable to receive".

Quelqu'un aurait une idée pour que Text to Speech lise correctement en français la valeur de la température qui est envoyée par le Bluetooth ? Merci.

26 on my TTS results in twentysix; 2 6 results in two six. If I remove the space, it enunciates as twenty six. You should be able to use Blocks to remove any spaces

Maybe.

Perhaps you have to set the TTS language/country for France ... see Blocks

Hello,

Thanks for your answer, but I think i can not do that.
The value "26" is not inserted directly in my app invertor code as you show in your image. This value comes from an Arduino and is sent to my mobile by Bluetooth.
I have a thermistance connected to Arduino, that reads temperature and this temperature is correctly seen in the Arduino serial monitor every second: "26", "27", "24"....value can change depending if i touch thermistance or not, but there is no space between the numbers in the serial monitor and there is a changing line for each value, each second.

Then, this value is sent to my mobile....and Text To speech reads "2", "6" instead of "26" and same for the other values.

Do you have another idea ? Thank you.

Can you show us your Arduino code and your AI2 blocks?

Hello,
please find in attached file all codes from Arduino and App.
Bluetooth sensor HC-06 is directly connected to RX and TX from Arduino, so no need to use Softwareserial in Arduino code.

A shot in the dark Olivier . You might try

in your AfterGettingText block.

Hello,
I followed your advice and write this in my code:

Unfortunately, the result is the same (and i paid attention to make a space in the "segment").
When temperature is for example 27.8 degrés celsius, Text to Speech reads "2", "7", "point", "8".

OK. That is not the behavior I see Olivier. When the message is 27.8 the TTS says twentyseven point 8.

Find out what the message is by doing a DoIt on your data Block to see what is appearing there. There might be \n characters being sent you need to remove in addition to spaces.

Another possibility is some delay is needed before sending the Speak message.

In French, do you use decimal points or commas for fractional parts of numbers?
Could that be influencing how they are pronounced?

Hello,
Officially, we use commas in french for decimal number, but in this project, is not a problem if i hear "point" instead of "comma", the most important is the value with 2 numbers that should be correct read.

Bonsoir à tous,

J'ai eu le même problème et il semble que ce soit lors de la lecture des nombres à virgule que le problème se pose. J'ai donc contourné le problème en jouant sur les arrondis et en créant une chaine dans laquelle je prend la partie entière à laquelle j'ajoute "virgule" puis la partie fractionnaire. Il faut en outre prendre garde au fait que 3.02 par exemple se prononcerait 3,2... il faut encore détecter si la partie fractionnaire commence par un 0. Voici un petit exemple avec la lecture des valeurs barométriques :

This works for me:

char end_char = '\n';
String texto;
float temperature;

void setup() { 
Serial.begin(9600);
}

void loop() { 
  if(Serial.available()) {
    texto = Serial.readStringUntil(end_char);
    if (texto == "get_temperature"){
      temperature = random(1,10000) / 100.0;
      Serial.println(temperature);
      }
  }
}