Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Sound

Sound helps us break away from the typical rigid desktop interface because it offers more flexibility in terms of direction and it’s less physically encumbering. On the input side, you can analyze an incoming sound signal in different ways for different purposes. To start with, you might want to know how loud a sound is. You could use a microphone to sense a person stomping his feet on the floor or to find the regular pattern of drum beat on the track of a CD. You might also want to know the pitch of a sound. For example, you might want to make a musical instrument that accompanies a singer respond to her pitch, or a lighting dimmer that changes the level of the lighting based on the pitch of your whistle. Because even the simplest sounds are made up of many pitches, however, detecting the pitch of a sound involves filtering out the various pitches and analyzing the relative amplitude of each one. This is harder than detecting the amplitude and takes more processing power. We will show you how to look for both volume and frequency on microcontroller and multimedia machines. You’ll have more success finding pitch on a multimedia machine, but measuring pitch and volume are possible to a limited extent even on a microcontroller.

On the output side, we’ll show you some techniques for generating sounds on the fly and for playing back prerecorded sounds. Generally, the quality of prerecorded sounds is better than the on the fly sounds, but the possibilities they offer for interaction are more limited. You have already used the freqout command in Chapter 6. If you varied the duration of the freqout command, you saw that you could allow for a quicker response from the microcontroller but it never sounded that good. On the other hand, using prerecorded audio, you’ll get high-fidelity audio at the expense of quick response time. We’ll also talk about MIDI and text-to-speech synthesizers, which offer a middle road: they generate sounds on the fly using small snippets of high-quality prerecorded sound, or they synthesize more complex sounds on the fly using more processing power than a microcontroller has.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint