Return to Tutorial Home Page


Multimedia Tutorial
Unit 3 — Audio

 

1. Understanding Audio Formats Waveform vs. MIDI
You should already know this from Intro to CAT, but here goes anyway...

A) MIDI
It stands for: Musical Instrument Digital Interface. You all created MIDI files when you took Intro to Music Technology (CAT 107). MIDI files are not really audio! They are not sound! Instead, they are a set of text instructions telling a synthesizer what to do, a sequence of commands specifying what sounds should be played and how they should be played. . A MIDI file conveys the following information to a synthesizer:
• pitch of a note (frequency)
• duration (quarter note, half note, etc.)
• velocity (how hard key is hit > volume)
• which instrument should play it (128 choices)

Because a MIDI file can only describe musical notes, it cannot replicate the human voice. Because it merely describes notes, MIDI files are very small.

Advantages to MIDI:
• It allows musicians to use sequencer software such as Performer to easily and endlessly manipulate their compositions on the computer and hear their results as they go. MIDI is what made electronic music what it is today.
• Because MIDI file sizes are so small, they save a lot of disk space and can be ideal for any application (games, CD-ROM, etc.) where space is at a premium.
• MIDI files can be converted to QuickTime format and played in any application that makes use of QuickTime (such as Director) without needing a hardware synthesizer.
• Musician control of MIDI can be extended so that the end user of a musical CD-ROM could even exercise control over the composition
• There are thousands of them available for download on the Internet. Click here for a good directory of MIDI links. There are also dozens of MIDI files on your class CD-ROM in the UNIT03—AUDIO / MIDI folder.

Disadvantages to MIDI:
• When MIDI plays through a dedicated hardware synthesizer, as it does in the music technology lab, you control what you get and it sounds great. When an end user plays it on their computer, it is usually being synthesized through a software simulation of a synthesizer. The quality is poorer and there is less control of the sound you will get. Music majors wanting to present their own music should record their MIDI files to disc as .aiff waveform files for use on CD-ROM.

• As previously stated, MIDI describes the characteristics of specific notes, nothing else. It cannot represent the human voice singing or speaking.

 

B) Waveform
When we speak or sing or play an instrument, we create sound. That sound is actually air molecules vibrating. These vibrations reach our ear drums as sound waves, like the tide coming into the shore, and are interpreted by our brain as a particular sound. When we record sound, the result is a waveform: an analog representation of a sound in the form of a wave. The taller the waves (also known as the "amplitude"), the greater the volume . The closer together the waves, the higher the pitch (= the "frequency").

Waveform resolution varies, just as with graphic resolution. The higher the resolution, the better the quality. Resolution depends on the sampling rate (how many times per second is the sound wave "photographed"?) and the sampling depth (how detailed a "snapshot" are we getting of the sound wave?).

Sampling Rate: A digitizer captures sound in evenly spaced intervals, and this interval is known as the sampling rate. The more often it samples the sound, the better the quality. The most common rates are 11 kHz, 22 kHz, and 44 kHz. Yes, that means it is sampling it 44,000 times a second! For CD-quality audio, the music is sampled at 44 kHz, whereas 11 kHz is usually fine for spoken voice. DAT (digital audio tape) is even better: 48 kHz. Anything better than that would probably not matter: we humans wouldn't be able to hear the difference.

Sampling Resolution: This refers to the depth of information the computer stores with each sample, and is similar in concept to the dots-per-inch resolution we talk about with computer graphics. Most common audio depth is 8-bit and 16-bit. CD-quality audio uses 16-bit sound. The title of the application Sound Edit 16 refers to its 16-bit capacity.

Because of all the information required to sample a song at CD-quality, waveform files are large. One minute of CD-quality audio will take about 10 megs of disk space. This is why short audio loops are used in games and web sites where file size is a critical issue. One minute of MIDI in QuickTime format is less than 100K. [1,000K = 1 meg, so we're talking a MIDI file being 1% the size of an audio waveform file!]

File Formats: AIFF is the standard waveform audio format for the Mac, but Director 6.5 also imports wav sounds (the standard for Windows) and Macintosh System 7 sounds. Director 7 imports AIFF and WAV sounds (both compressed and uncompressed), AU, Shockwave Audio (see below), MP3, and Macintosh system sounds. SoundEdit 16 is a good program for converting sounds from one file format to another.

Recording Sound: If you want to record sound (e.g., a voiceover), I recommend you do so in SoundEdit 16. That way you can tweak it right there until it's just right, then bring it into Director. If you're in a rush, however, you can record right into Director on the Macintosh. With a microphone attached, choose Insert > Media Element > Sound. The Sound command opens the Macintosh sound recording dialog box. There is no equivalent function for Windows.

 

2. Editing Audio Waveform Files
This can be accomplished very easily in SoundEdit 16, a program you learned in Intro to CAT. Though we do not cover SoundEdit in this class, I would be glad to help you outside of class. In the meantime, I have included my old Sound Edit Tutorial as part of this web site. It includes info on how to set cue points that can be called upon in Director.

3. AIFF Audio within the Director Score
1. Save your waveform audio in aiff format. Click on FILE / IMPORT [or Command-R] to import the sound. It will come in as a new cast member.
2. If the sound is short and you want it to loop, select the sound in the cast and then click on the "I" icon (= information) at the top of the cast (or type Command-I). In the Cast Member Properties window that appears, click in the Loop check box.
3. Drag the sound cast member into the score. It will only agree to go into one of the two sound channels (at the top of the score, part of the Effects channels).
4. If your movie pauses at, say, frame 10, any music playing will stop. To avoid this, place a "go the frame" script in the script channel for that frame. Audio can play continuously in a single frame so long as it has a "go the frame" script.
5. You can play sound cast members regardless of the settings in the Score by using the puppetSound command. Huh? Here are two examples. In both cases, the sound channels will be empty:

4. Using Cue Points within Director
Synchronization Can Be Confusing!
It can be tricky synching animation and sound in Director because Director's FPS rate is more of a request than a guarantee. You can set the frame rate to 15fps and assume 150 frames will synch perfectly with 10 seconds of audio, but if the computer can't go that fast you have problems. Director and QuickTime handle this problem differently:
• Director plays the sound at the right speed and plays the visuals as fast as it can (but not faster than you ask it to). It plays all of the
visuals, so if the computer is slow, the sound will finish before the visuals.
• QuickTime keeps visuals and sound in synch by dropping intermittent visual frames as necessary so that visuals and sound stay synched and finish at the same time. If it can't play 15 fps. it may only play 10 of those 15 frames, but frame 15 will be displayed at precisely the right time.
Cue Points:
One way to time simple animation elements and interactivity with the sound
track is to use SoundEdit 16 to set cue points within an audio file that can then be called upon by the Director score. To learn how to set the cue points, refer to the appendix to the SoundEdit tutorial. Then import the file into Director and bring it into one of the score's two sound channels and do the following:
1. Determine which frame you want your visual effect to begin in. For our example, let's say we have a great visual effect starting in frame 20 that we want to coordinate with a specific point in a song where we have already set up a cue point named "bird animation." To set this up, we will double-click in the Tempo channel of the preceding frame, that is, frame 19.

2. We will now tell Director to keep its playback head still looping in frame 19 (still playing the music, of course) until we reach our "bird animation" cue point. Do so by clicking on the "Wait for Cue Point" radio button and then choosing the desired cue point from the list to the right.
3. Repeat this process for additional cue points.

5. Built-In Sound Behaviors
Director ships with the following behaviors for sound files:
• Sound Beep
Plays the system beep sound when the specified event occurs.
• Sound Play Member
Plays the designated sound cast member when the specified event occurs.
• Sound Play File
Plays the designated external sound file ( AIFF or WAVE format ) when the specified event occurs. An external file is one not imported into the cast; this technique is sometimes used for longer sound files.
• Pause Sound
Pauses a sound based on a frame or sprite event
• Stop Sound
Stops a sound based on a frame or sprite event
• Channel Volume Slider
Turns sprite into a sliding "thumb" for sound volume control
• Channel Pan Slider
Turns sprite into a sliding "thumb" for sound panning control

6. Some Lingo Sound Properties
• Puppet Sounds
If you want the same sound to play throughout an entire movie, no matter what frame they are on, no matter if they are going "forwards" or "backwards" in the score, then make life simple for yourself and use the puppetSound command as follows. First, create a movie script (= a script that will apply to the entire movie) by pressing COMMAND-SHIFT-U all at once. To have the sound background.aiff play when the movie starts and keep playing unless told otherwise, you would write the following:

on startMovie
puppetSound "background.aiff"
end


To turn off a puppet sound before it's finished playing, you don't use its name. Instead, simply use the command: puppetSound 0

• Also use puppetSound to attach a sound to a button or some other event. For example:

on mouseUp
puppetSound "thwack"
end

• Sound Busy
If you wanted to wait for a sound to finish before going to another frame, you could use the soundBusy property, which is Lingo's way of telling you whether or not the sound is still playing. For example, let's say we have the sound "fanfare" playing in sound channel 1 in frame 25 with a "go the frame" script. It's so dramatic, and we don't want to introduce our stunning self-portrait (in the section with the "self-portrait" marker) until the fanfare is over. We could use the following if.. then script:

on exit frame
if soundBusy(1) then
go the frame
else
go "self-portrait"
end if
end

Translated into plain English, this tells the computer that if sound channel 1 is still busy, then keep looping on that frame, but if the sound is finished, then go to the "self-portrait" marker in the score. Warning: I've had problems with this one. Make sure that you allow enough time for the sound to start playing before using soundBusy to check the sound channel.

• The Volume of Sound (whichChannel)
This sets the volume for a specific sound channel, with a range of 0 (mute) to 255 (loudest). Just substitute the channel number for "whichChannel." This statement sets the volume of sound channel 2 to 110, which is a medium setting:

set the volume of sound 2 to 110

• The soundLevel
This measures the system volume as set in the computer's Control Panel. The range is from 0 to 7. In other words, you can actually control the user's whole computer from within Director! This statement sets the sound level to 5:

set the soundLevel to 5


• Sound FadeIn whichChannel, ticks
This command fades in a sound in the specified sound channel over a period of ticks. (There are 60 ticks to a second.) Just substitute the channel number for "whichChannel," follow it with a comma, and then the number of ticks. For example, 5 seconds would be 300 ticks or could be written 5 * 60 (five times sixty). This statement fades in the sound in channel 1 over 5 seconds:

sound fadeIn 1, 5 * 60


• Sound FadeOut
Works the same as Sound FadeIn. This statement fades out the sound in channel 1 over 3seconds:

sound fadeout 1, 180

 

7. Converting an Audio File to Quick Time
To add time code to an audio file, you will need to convert it to QuickTime. Then you will be able to pause and resume it anywhere in the middle,slow it down, speed it up, create buttons that take you to a specific point in the movie, etc. See Unit 7 Tutorial—Controlling Video & Sound with Lingo., to see what's possible. The conversion procedure
1. Open QuickTime MoviePlayer. (QuickTime Pro 5 version)
2. Open the audio file you want to convert.
3. Click on Convert.
4. Save it as a self-contained movie.
5. When importing, make sure the SHOW box is set to QuickTime, not to sound, or you will not see your file!
6. As a QuickTime file, your new cast member will go into one of the regular numbered sprite channels, not into one of the sound channels.

 

8. Shockwave Audio (SWA)
This is a compressed format designed to make possible faster downloads from the web. SWA files are much smaller but are more processor-intensive. The computer can't just play it back, it also has to decompress it on the fly. SWA files can be imported into the cast, but this would make for slower downloads: the SWA castmember would have to be downloaded before it could play. Instead, the usual procedure is to link to an external SWA file that can be streamed directly to the end user.
To convert your Director audio assets to Shockwave, from the pull-down menus click on FILE / PUBLISH SETTINGS and then the COMPRESSION tab. Make sure the Shockwave Audio Compression Enabled box is checked.

 

9. Using MIDI Files within Director
1. MIDI must first be converted to QuickTime before it can be imported into Director. You will need the Pro version of QuickTime 4 for this. Simply open MoviePlayer, choose IMPORT from the FILE pull-down menu, navigate to your file, and then click on CONVERT. The file will be saved with "movie" added to the end of its filename as the default. (You can change it if you want.)
NOTE: There are different flavors of MIDI. "General MIDI" is the most universal and the only one that QuickTime reads. If you can't convert the file, chances are it's not General MIDI.
ANOTHER NOTE: Just for the record, you can now easily convert a MIDI file to a waveform audio file from within the QuickTime 5 Pro MoviePlayer. Just choose EXPORT and MUSIC TO AIFF. It will be saved as a waveform file in QuickTime format. The advantage to this is that you will know exactly what the file will sound like on other systems AND you can play around with it in SoundEdit. The disadvantage is that it will be 100 to several hundred times larger in terms of file size.
2. When you import the MIDI movie file, it comes in as a QuickTime movie. [When importing, make sure the SHOW box is set to QuickTime, not to sound, or you will not see your file!] It is still a MIDI file, but within a QuickTime shell, which means it now has QT time code added to it. When you move it from the cast to the score, it will only go into a regular sprite channel. It cannot go into a sound channel because it is still MIDI, not a waveform.
3. As with aiff audio, you should use "go the frame" scripts to keep it playing even though you might be in the same Director frame.
4. Because it is in QuickTime format, you can control it using the same Lingo commands you use for QuickTime video and QuickTime waveform audio. See Unit 7 Tutorial—Controlling Video & Sound with Lingo.


10. Creating Audio CDs
...by which we mean the kind you buy in the store. The disks are the same as for CD-ROM, but the data is structured differently, using a format called "red book." To play on a CD player, all tracks must be .AIFF files, 16 bit, and 48,100 sampling rate. Your standard CD playe will not play MP3s. Use iTunes to capture audio files as .aiff, but first be sure to change the iTunes Importing Preferences to the aiff encoder. (If you leave it set on the .mp3 default setting, you won't be able to burn a standard CD.)

You can make your own "red book" audio CD, suitable for playing on any CD-player, using tracks from other CDs or any other music format. This is assuming you want to make your own arrangement material. If you simply need to dupe an audio CD, you can do that easily with Toast Titanium.

To create your own mix, the process is basically as follows:
Make a playlist in iTunes, be sure all the tracks are checked off. At the bottom of the window it tells you how many minutes of music you have. If you have a 74-minute blank CD, obviously don’t exceed that length. From the FILE pull-down menu, click on BURN PLAYLIST TO DISC.
NOTE: I have sometimes had the BURN DISC button not work for me but the FILE menu command does. Hmmm…

To dupe an audio CD, do the following. This assumes that you only have one CD drive and that you have enough space on your hard drive to temporarily store the contents of the CD you want to copy.
1. Open Toast and insert the CD.
NOTE: Toast can be set to automatically open whenever you insert a CD.
2. Click the Copy tab.
3. Click the red Record button. Toast displays a progress bar as it copies your disc.
4. Toast will temporarily copy the disc’s contents to your hard drive. This will take at least several minutes, depending on your computer’s speed.
5. When it’s done with this step, it will eject the master diskette and ask you to insert a blank disc.
6. It will record onto the blank disc and erase the temporary file.

11. Creating an Enhanced Audio CD
With Audio CDs, you can only write one session, as CD players will only recognize the first session. You would only write a second session if you wanted to create an "Enhanced CD," with non-audio data. In that case, the second session would contain the multimedia data that could be read on a computer but not on a CD player.
So instead of clicking on WRITE CD in the final step above, click on WRITE SESSION. That will record the audio. The closer you come to 74 minutes of audio, the less room you have for multimedia material, and vice-versa. To create the multimedia portion (which MUST be recorded second!), follow Unit 10 Tutorial—How to Make a CD-ROM, but be sure to again choose WRITE SESSION.


12. Creating MP3 Files

See the MP3 section on our Multimedia site and check out some of the dozens of MP3 sites that it links to on the web.

MP3 stands for MPEG-Layer 3, a format that compresses audio to one eleventh of its original size without noticeable loss of quality. It is now very popular on the web because the small file size translates into fast downloads, thus creating a new avenue for music distribution, not all of it legal.

You can compress your audio, including CD-AUDIO, into MP3 files and then burn them onto a CD, but you will NOT be able to play them back on a regular CD deck because they lack any built-in MP3 player. You can, however, stick that CD in a computer and play back about 12 hours of music from one CD using QuickTime 5 or one of the many MP3 players that you can download for free from the web. Soon CD players will be featuring MP3 playback and the standard red book format might even become obsolete.

To create MP3 files from music CDs and other audio sources:
1. Be sure the iTunes Importing Preferences are set to the mp3 encoder. (Quality setting should be "high" or "highest.")
2. Import the tracks into iTunes


Return to Tutorial Home Page