How make MOVI SAY the CONTENTS of a string variable?

I've used Serial.println(...) to print the CONTENTS of a named string variable, and used recognizer.say(F("....")); to print specific words, but what I can't find anywhere is how to SAY the CONTENTS of a named string variable. Any help would be wonderful! Thanks. Gary

The Talkie library can be used to say specific words from a limited vocabulary, on some Arduinos. You will need in addition an audio amplifier and speaker.

Converting arbitrary text to good quality speech requires a fairly powerful PC.

Thanks, however I need more than Talkie; I need to speak what's currently in my string variable. It's surely something that is possible using my MOVI shield.

What might that be?

Have you checked the gizmo's docs or user manual to see whether it is capable of text to speech?

Edit: I did your homework for you, and looked up the MOVI board from Audeme. The user manual can be downloaded here: https://www.audeme.com/uploads/4/3/9/9/43997575/movi_11usermanual111.pdf

It doesn't say much about text to speech synthesis, probably for a good reason: the voice synthesizer is phoneme based, taken directly from the linux eSpeak library.

For an example of what eSpeak sounds like, wander over to the eSpeak website to find and play the example linked below in your browser.

Here, eSpeak reads and speaks the introductory phrases from Edgar Allen Poe's The Raven.

Thank you for your reply. MOVI is Arduino’s wonderful arbitrary-speech synthesizer. I’m just trying to get words into it via a different method than shown in their example. What I want to do should be very reasonable, but isn’t mentioned in their sparse manual.

Thanks jremington,
My MOVI shield actually does a fabulous job of speaking arbitrary text, just as long as I type the text into the command: recognizer.say(F(put what I want to say here));
I can't believe there isn't some way to get the contents of my string variable into something Arduino can understand.
Thanks again,

Do you mean a String object? That is completely different than a text string (C-string, zero terminated character array). Most forum members do not recommend using Strings on Arduino, as they cause program crashes due to poor memory management.

Post the code, and in the meantime, try something like this.

char phrase[]="This is what I want to say";
recognizer.say(phrase);

The library has overloads of say() for the F() macro (const __FlashStringHelper*) and for String, but not for a string (char array).

Either convert the string to String, or modify the library.

How utterly thoughtless is THAT? I just checked the library v1.13, and sure enough...

Brilliant! I need to work your idea into my code smoothly, however merely adding your two lines of code far down in my code worked! I'm new to this, and if you would consider adding your method to my code (copied below) I'd be unendingly grateful! Huge thanks, Gary
(the code will be put in a box that speaks imaginary words)

#include <MOVIShield.h>
// Open Tools: "serial monitor" AFTER DOWNLOADING!!
// Won't download to UNO while SERIAL MONITOR is ON!!

long randNumber;
String word1;
String word2;
String consonants="bcdfhjklmnprstv"; //fifteen
String randomLetter;
String vowels="aeiou";

MOVI recognizer(true); // Get a MOVI object, true enables serial monitor interface

void setup() {
Serial.begin(9600);
Serial.println("Martian");
randomSeed(analogRead(0));
}

void loop() {
String word1;
randNumber=random(0,15);
randomLetter=consonants.charAt(randNumber);
word1 = word1 + randomLetter;

randNumber=random(0,5);
randomLetter=vowels.charAt(randNumber);
word1 = word1 + randomLetter;

randNumber=random(0,15);
randomLetter=consonants.charAt(randNumber);
word1 = word1 + randomLetter;

randNumber=random(0,15);
randomLetter=consonants.charAt(randNumber);
word1 = word1 + randomLetter;

Serial.println(word1);

recognizer.setVoiceGender(FEMALE_VOICE);
recognizer.say(F("Hello, this is the female voice"));
recognizer.say(F("word1"));

delay(5000);
}

Since word1 is a String variable, try recognizer.say(word1);

Great tip once again, which worked. I'd tried almost that and failed, adding "F" for female voice. It's an inconsistency that the "F" for female works for recognizer.say(F("word1")); but not for recognizer.say(F(word1));

F() is a compiler macro that tells the compiler to "put this string constant into program memory", so it doesn't work with variables.

The "F()" macro has nothing to do with "female voice" :slight_smile:

The male/female voice is set by the setVoiceGender() function, with two options, FEMALE_VOICE or MALE_VOICE.

Thanks David,

MOVI also says that one can set the gender in the “say” instruction by using just one letter. Since that seems to only work sometimes I’m going to explore your advice.

Best,

Gary

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.