Voice Recordings


  • Today: Voice Recording equipment overview & demonstration at the IMM Cage with Dickie
  • Tim Wisniewski, Chief Data Officer, The City of Philadelphia – Brown Bag Lunch Feb 20, 12:30-1:30 & 3:00-4:00 @ IMM
  • Next Week, Feb 23 – Phone Polls
  • Partner Organization Interviews, setting up for the week of Feb 23 or March 2

Design Notebooks

Let’s take a few minutes to go over some of your Design Notebook entries from last week.

Cage Visit

Let’s head over to the cage to meet with Dickie.

Design Patterns

Christopher Alexander – The Timeless Way of Building

The Gang of Four – Design Patterns

Architectural Patterns

Interactive Voice Response (IVR) Patterns

Phone Menus

  • keypad input
  • voice input


  • crowd-sourced incident reporting
  • oral histories
  • voicemail

Phone Polls

  • keypad input multiple choice
  • voice response


  • web/mobile interface to initiate a call out


  • sms message to initiate a call out

Voice Broadcast

  • call out notification to a group of numbers

Message Broadcast

  • SMS out to a group of numbers

Twilio Voice Recordings

Twilio’s Text-to-Speech engine is cool, but…

  • language limitations (even Alice supports only 26 languages/dialects)
  • sometimes we want greater flexibility with specific voices, i.e. celebrities

Today we’ll be using Twilio’s <Play> and <Record> TwiML verbs.

  1. Download the source code for this week’s examples from the class Github Organization.
  2. Unzip the  repository on your local machine and upload the contents to a new folder in the ‘www’ folder on your TCNJ web account.
  3. Let’s try out the examples one by one.

Basic Voice Playback

Instead of using Twilio’s text-to-speech engine, let’s play back a recorded message.

  1. After you’ve uploaded the basic-voice.xml file to your TCNJ web account, log into Twilio, click into your number detail page, and edit the Voice request url for your number to point to ‘basic-voice-playback.xml’.
  2. Call your Twilio number.
  3. What happened?
<!-- basic-voice-playback.xml -->
<?xml version="1.0" encoding="UTF-8"?>

Twilio <Play> documentation

Gathering Input

Now let’s use the <Play> verb with <Gather>.

  1. Upload matrix.xml and checkpill.php to your TCNJ web account and edit the Voice request url in the Twilio Dashboard for your number to point to your edited file.
  2. Call your Twilio number.
  3. What happened?
 <!-- matrix.xml -->
<?xml version="1.0" encoding="UTF-8"?>
    <Gather action="./check_pill.php" method="get" finishOnKey="*">
        <Say>Press 1 to take the red pill.</Say>
        <Say>Press 2 to take the blue pill.</Say>
 /* checkpill.php */
$pill = $_REQUEST['Digits'];

header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";

if($pill == 1){ // red pill
    echo "<Response>";
    echo "<Play>http://www.mediamesis.net/imm/bluepill.mp3</Play>";
    echo "</Response>";
} else if($pill = 2) { // blue pill
    echo "<Response>";
    echo "<Play>http://www.mediamesis.net/imm/matrix66.mp3</Play>"
    echo "</Response>";
} else { // other
    echo "<Response>";
    echo "<Say>Sorry, I didn't understand your selection. Please try again.</Say>"; 
    echo "<Redirect method=\"POST\">http://yourserver/matrix.xml</Redirect>";
    echo "</Response>";

“Please Leave a Message…”

Now let’s try building a simple answering machine.

  1. Upload voicemail.xml and record.php to your TCNJ web account and edit the Voice request url in the Twilio Dashboard for your number to point to your edited file.
  2. Call your Twilio number.
  3. What happened?
<!-- voicemail.xml -->
<?xml version="1.0" encoding="UTF-8"?>
   <Say>Leave a message after the beep. Press the pound key when you're done recording.</Say>
/* recording.php */
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";

$recording = $_REQUEST['RecordingUrl']; 
$duration = $_REQUEST['RecordingDuration'];
 <Say>Thanks for calling. Your message was <?php echo $duration; ?> seconds long. Here's the message you left.</Say>
 <Play><?php echo $recording; ?></Play>

Twilio <Record> Documentation

Workflow for Creating Voice Menu Recordings

Basic flow

  1. Start with a flow diagram
  2. Prototype it using <Say>
  3. Create a script for the voice talent
  4. Record the messages
  5. Implement using <Play>

What about foreign languages/dialects?


Break into your groups and review the Twilio Audio Recording Best Practices.

Using Audacity or other audio recording software, create a voice menu + leave-a-message app that presents the caller with information about the upcoming HackTCNJ event and prompts them to record a message about what kind of app they’re thinking about creating at the event.

Create menu options for:

  • Date, time and location
  • An overview description of the event
  • A sponsor listing
  • Request the caller leave-a-message about what they’d like to create at the event


Know Your Audience

  • Read pages 52-59 in the Freedom Fone User and  Advocacy Guide
  • Create a new page in your Design Notebook and name it “Know Your Audience” and today’s date. Make a list of all the audience characteristics you feel would be important to your Partner Organization. Research as much as you can about each of the items discussed in the reading, filling in the information based upon what you know or can find out about your Partner Organizations’ communities.

Questions for Your Partner Organization

  • Create a list of questions for your Partner Organization about their services and most pressing communication problems.
  • Create another slide in your Design Notebook, titling it “Interview Questions” and today’s date., and drop in your list of questions from above.
  • Next week, you’ll combine your questions with those from your teammates to create a master list.

*Assignments are due before class begins on Mondays. Be prepared to present your work in class for discussion.

More Info

16 thoughts on “Voice Recordings”

Leave a Reply

Your email address will not be published. Required fields are marked *