Now why is this of importance. Well simply said this can give an audible feedback to any commands you are going to give to your phone in future IOT projects. And I am going to show you how easy it is to make an Android APP with the fabulous MIT App-Inventor. Mind you this is not a total instruction from scratch. I presume you know the basics of working with App-Inventor and otherwise I advise you to look at the tutorials on the web as App Inventor is really easy to work with.
Look at the picture above and most steps below will be easily understandable.
So first start a new project and call it "Say it for me".
Next add some labels that will contain just plain text. I made 3 labels.
First label is the pink one containing the name of the app in a 30 points fontsize, a magenta backgroundcolor and bold black text.
The second label (Label 2) contains the name of my weblog and has a fontsize of 20,
The third and last label (Label 3) gives the instruction to type your text in the field below it.
Then there is a textbox, obviously called Textbox 1, in which you can type any text you like. I set the fontsize at 14. Just make sure you check the multiline option so you can actually fill in multiple lines of text. If you do not check the multiline option all text will scroll on just one line which will make things inconvenient.
Then the last visible thing on the App's page is a large green button (Button 1) with a rounded shape and a bold font size 20.
There is one last very important item but that will be working in the background and therefore has no visible part on the screen and that is the TextToSpeech function which you can find on the left part of the screen in the "media" section. Drag this to your workspace and it will be put at the bottom as a non-visible component.
If you click this component you can choose on the right side in the Properties section which language will be spoken and at what pitch and speechrate. The last two are less important as the first. By choosing a different language as the filled-in Default option your phone will pronounce the words in that language. Be aware that by changing the language the speech of for example your navigation system will alter also to the new setting. So most of you will leave this at the default settings.
To finish things off in a professional way I added a nice looking Icon to the screen You can do that by clicking on the black strip in your workspace. App Inventor shows you on the right side of the screen the settings for your App and you can fill in (amongst others) the App-name, screen orientation, title and the icon you want for your app. You can upload any picture from your computer and most formats (JPG, PNG etc) are accepted.
That's it for the layout.
Lets look at the code in blocks.
Well this is all.
When the button is clicked we call TextToSpeech and let the App pronounce the Text in TextBox1
In Real Life
Usage is very simple. You just put any text you like in the textbox by typing it in or by copying it from a webpage, note or whatever and press the green "Say it for me" button. A nice female voice will pronounce whatever you typed.
Now go and get a flush on some people's faces by having your phone speak all kinds of texts like "Yes master I will obey you in every way you want."
And for a more serious note.
App Inventor really makes it easy to make all kinds of app's for your Android Phone, and we are going to use this speech synthesizes in some upcoming apps. So stay tuned.
All that rests is a link to the App and the source file (ending on .aia) which you can alter as you like with your own App-inventor account.
Speak to me sources
Copy the files to your own computer. The file ending in .aia can be loaded in App-Inventor to alter to your own needs. The file ending in .apk can be transferred to your Android-phone. clicking on it will install it and you are ready to go.
Till next time, and make sure to have some fun