How to Make a Narrated Book Using AVSpeechSynthesizer in iOS 7

Learn how to make Siri read you a bedtime story to you by using one of iOS 7’s newest features: AVSpeechSynthesizer. By .

Leave a rating/review
Save for later
Share
You are currently viewing page 4 of 4 of this article. Click here to view the first page.

Where to Go From Here?

Here is the final Completed Project for this tutorial.

I encourage you to experiment with your narrated book app. If you want a few ideas for how to tweak your app, here are some:

Compete for the Most Natural Sounding WhirlySquirrelly.plist

Hint: Try your hand at fine tuning WhirlySquirrelly.plist and upload your most-natural-sounding version of the plist to the comments/forum. We'll judge the winner and give him or her praise in the comments.

Add the Ability for the User to Select Which Book They Read and Hear

Hint: Add a "Choose Book" button to your UI that displays a UIPopoverController with a list of alternate books. Tapping on a book in this list should reset the book in your RWTPageViewController and present the new book.

Add the Ability to Download New Books from a Webserver

Hint: Store your books as plists on your own webserver or a service like AWS S3 or Heroku. Create a webservice call to list the urls of all available books and another webservice call to fetch a single book. Link this with the book, choosing functionality you added in the previous item above.

Add Word Highlighting the Corresponds with the Speech

Hint: Use the AVSpeechSynthesizerDelegate method speechSynthesizer:didStartSpeechUtterance: to highlight the passed utterance, and speechSynthesizer:didFinishSpeechUtterance: to unhighlight it. You should use the pageTextLabel.attributedText property to set the entire text, using an NSAttributedString to add different foreground color and font properties to the highlighted and unhighlighted sections of the text.

Add the Ability to Display a Title Page Before All Other Pages

Hint: Add another view controller before your RWTPageViewController. You'll have to place both view controllers in a UINavigationController and update your Main.storyboard file to use the new view controllers. Alternately, you could redesign the Page class hierarchy into speakable and non-speakable pages, and modify RWTPageViewController to handle different page types appropriately.