Skip to Content
App Inventor 2, 2nd Edition
book

App Inventor 2, 2nd Edition

by David Wolber, Hal Abelson, Ellen Spertus, Liz Looney
October 2014
Beginner to intermediate
360 pages
9h 3m
English
O'Reilly Media, Inc.
Content preview from App Inventor 2, 2nd Edition

Chapter 9. Xylophone

Figure 9-0.
Xylophone

It’s hard to believe that using technology to record and play back music only dates back to 1878, when Edison patented the phonograph. We’ve come so far since thenwith music synthesizers, CDs, sampling and remixing, phones that play music, and even long-distance jamming over the Internet. In this chapter, you’ll take part in this tradition by building a Xylophone app that records and plays music.

What You’ll Build

The Xylophone app UI
Figure 9-1. The Xylophone app user interface

With the app shown in Figure 9-1 (originally created by Liz Looney of the App Inventor team), you can:

  • Play eight different notes by touching colored buttons on the screen.
  • Press a Play button to replay the notes you played earlier.
  • Press a Reset button to make the app clear any notes you played earlier so that you can enter a new song.

What You’ll Learn

This tutorial covers the following concepts:

  • Using a single Sound component to play different audio files.
  • Using the Clock component to measure and enforce delays between actions.
  • Deciding when to create a procedure.
  • Creating a procedure that calls itself.
  • Advanced use of lists, including adding items, accessing them, and clearing the list.

Getting Started

Connect to the App Inventor website and start a new project. Name it “Xylophone”, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

App Inventor

App Inventor

David Wolber, Hal Abelson, Ellen Spertus, Liz Looney
App Inventor 2 Essentials

App Inventor 2 Essentials

Felicia Kamriani, Krishnendu Roy
Hello App Inventor!

Hello App Inventor!

Carl Simmons, Paula Beer

Publisher Resources

ISBN: 9781491907214Errata Page