Lesson 31: How to Get Your Smartphone (iOS) to Talk


Written by Robin Ha

Works on iOS
You can find this lesson and more in the Arduino IDE (File -> Examples -> Andee). If you are unable to find them, you will need to install the Andee Library for Arduino IDE.

Apple's Text-to-Speech (TTS) is just like Android's TTS. You can make your iOS Device to speak to you via Annikken Andee. However that's not all for the iOS TTS. You can now also make adjustment with the TTS pitch, Utterance rate and even the accent the of the speaker!

Bitching Betty now comes in more variety. =D


Important Notice

If you do not hear anything from your phone, you will need to disable silent mode or check your phone's system volume settings.

Top of the Code

#include <SPI.h>
#include <Andee.h>

AndeeHelper displaybox;
AndeeHelper button;
AndeeHelper speechObject; // You need to create a speech object for the phone to talk


void setup()
  Andee.begin();  // Setup communication between Annikken Andee and Arduino
  Andee.clear();  // Clear the screen of any previous displays
  setInitialData(); // Define object types and their appearance


The valid range for setUtteranceSpeed and setPitch is 0.5 to 2.0. The accents available are: US, GREAT_BRITON, AUSTRALIA, IRELAND, SOUTH_AFRICA

void setInitialData()
  displaybox.setTitle("Text to Speech");
  displaybox.setData("Be sure to unmute your phone to hear your phone talk!");  
  button.setId(1); // Don't forget to assign a unique ID number
  button.setType(BUTTON_IN); // Defines object as a button
  button.setTitle("Say something!");
  speechObject.setType(TTS); // Defines object as a Text-to-Speech object
  speechObject.setUtteranceSpeed(0.65); // Set the speaking speed of the TTS
  speechObject.setPitch(1.1); // Set the pitch of the TTS voice
  speechObject.setAccent(US); // Set the Accent of the TTS voice


void loop()
  if( button.isPressed() )
    // Use updateData() to get the phone to talk!
    speechObject.updateData("Confucius say: Man run in front of car get tired,"); 
    speechObject.updateData("man run behind car get exhausted."); 
    // You will need to break your sentence into multiple lines if your lines are too long.
    // Each speech object can only handle up to 40 characters of text at a time.
    // Punctuation will also affect the way your phone vocalises the text.
  // Do not update the speechObject!
  delay(500); // Always leave a short delay for Bluetooth communication
comments powered by Disqus