Audacity


There are several tools available to use for recording and editing sound effects and music. A very good open source program—it doesn't cost you anything to use and is made available under the GNU General Public License—is Audacity.

This chapter will show you how to use Audacity (see Figure 19.1) to make sounds for use in your game.

click to expand
Figure 19.1: Audacity main window.

Installing Audacity

To install Audacity, do the following:

  1. Browse to your CD in the \Audacity directory.

  2. Locate the audacity-win-1_0_0.exe file and double-click it to run it.

  3. Click the Next button for the Welcome screen.

  4. Follow the various screens, and take the default options for each one, unless you know you have a specific reason to do otherwise.

Using Audacity

You need to ensure that you've got your microphone set up properly—connected to the MIC or microphone input jack on your sound card. Of course, you don't need to obtain your sounds directly from a microphone; you can record from a CD or another audio source. In any event, you need to have that source connected to the correct input and ensure that your audio mixer is set up to record from that source. You should refer to your sound card documentation if you don't know how to do this.

The basic operation of Audacity is quite straightforward for recording, simple editing, playback, and saving your data.

Recording

Let's record some sound:

  1. Launch Audacity by choosing Start, Programs, Audacity, Audacity. You will get the main window, as you saw earlier in Figure 19.1.

  2. Click the Record button, as shown in Figure 19.2.

    click to expand
    Figure 19.2: The Record button.

    The program is now recording from the microphone. You can see the progress of the recording and the waveforms of the sounds in the window as the recording proceeds, as shown in Figure 19.3.

    click to expand
    Figure 19.3: Recording in progress.

  3. Speak into the microphone, or if you don't want to hear your own voice, make a noise, like slapping a book down on the desk or something. You will see the sound you made appear in the waveform. Figure 19.4 shows the waveform created when I tapped a pen on the desk next to the microphone.

    click to expand
    Figure 19.4: Waveform in Audacity.

  4. When you have your sound recorded, click the Stop button, as shown in Figure 19.5.

    click to expand
    Figure 19.5: Stop recording.

  5. Now you can play back your recording, by clicking the Play button, as shown in Figure 19.6.

click to expand
Figure 19.6: Playback.

We'll continue working with Audacity in a moment, but first I want to point out that if you have a waveform but don't hear any sound, make sure that you have the volume turned up high enough in your speakers. Also be sure that it is turned up high enough—and is not muted—in your Windows Volume Control applet (in the Control Panel, and usually on the Windows System Tray on the right side of the taskbar).

Simple Editing

Now if you're like me you probably have a long period of dead air before the sound effect you made and another chunk afterward. That's fine, because it's easy to fix. So, picking up where we left off in the previous section:

  1. Place your cursor to one side of the portion of the waveform you want to eliminate, and drag it across to the other side. This selects an area to be worked on. See Figure 19.7.

    click to expand
    Figure 19.7: Selecting a portion of the waveform.

  2. Choose Edit, Delete. The selected portion will be excised from the waveform.

  3. Repeat the preceding two steps for the unwanted portions of the waveform on the other side of your sound effect. Eventually you will end up with something like Figure 19.8.

click to expand
Figure 19.8: The final waveform of the sound effect.

We're not finished with our procedure yet; there's still some exporting to do. But before we cover that, I want to mention that above the waveform panel is a series of numbers on a scale. This is the elapsed time scale. The example in Figure 19.8 shows that my final waveform is just a little more than three-quarters of a second in duration.

Exporting

Now, once again picking up where we left off, you need to save the sound effect as a file before you can use it:

  1. Choose File, Export as WAV. Name your file and save it somewhere convenient for the moment, such as on your desktop.

  2. Browse to your desktop (or wherever you saved your file) and double-click your newly created file. Whichever program is set up to play sounds in Windows on your computer will be launched and play your sound.

There are other export options available, but we'll stick with the WAV format for its simplicity and wide availability on Windows platforms. For other platforms, Ogg Vorbis is probably the format of choice on Linux, and AIFF for Macintosh.

Audacity Reference

This section contains some useful reference details to help you use Audacity.

The Main Screen

Figure 19.9 shows the Audacity main screen, with the major components labeled. This section will provide some detail on those components.

click to expand
Figure 19.9: The Audacity main screen.

The toolbar is where you will find the tools that you will probably use more than any other tools available with Audacity. Use Figure 19.9 to locate the tools in the toolbar, and Table 19.1 to review their functions.

Table 19.1: Toolbar Tools

Tool

Description

Selection

Selects a portion of the audio track. You can set the position of the track cursor simply by clicking at the right place in the track. Select a range of audio by clicking and dragging over the desired portion. Select multiple tracks by dragging across the tracks. Playback begins at the position of the track cursor and will play to the end of the track. If you have selected a range of audio, only the selected range will be played.

Time Shift

Changes the positioning of tracks relative to one another in time. Select this tool, then click in a track and drag it to the left or right.

Envelope

A handy audio processing tool. Its presence directly in the main window of the program is an innovative move. You get detailed control over how tracks fade in and out, right in the main track window with this tool. When you select the Envelope tool, the amplitude envelope of each track is highlighted in a green line; there are control points at the beginning and end of each track. To move a control point, click it and drag it to its new position. To add a new point, click anywhere in the track where a control point doesn't already exist. To remove a point, drag it outside of the track.

Zoom

Zooms in or out of a specific part of the audio. Clicking anywhere in the audio will zoom you in. Right-click or shift-click to zoom out. You can also zoom into a region by dragging the mouse to highlight the region while you have the Zoom tool selected.

Play

Enables you to listen to the audio file currently loaded or to a recording you have just created. The spacebar can be used as a stop and start toggle. Playback always begins at the current cursor position. If a region of audio is selected, only the selected region will play. To play the entire project, choose Edit, Select All and then click the Play button. All tracks on a given channel will be mixed automatically for playback.

Stop

Halts playback.

Record

Records a new track from your microphone or another input device. You can configure recording options by choosing Edit, Preferences. Recording always happens at the project's sample rate.

Master Gain

Controls the volume of the audio output by Audacity to your hardware. Volume increases as you move the slider from left to right.

The Track Panel contains tools for managing specific tracks and groups of tracks. See Table 19.2 for details.

Table 19.2: Track Panel Tools

Tool

Description

Track Menu

Allows the user to display a track in different formats. This menu also provides the Set Name option that allows the user to create a name for a given track.

Track Delete

Immediately deletes a track, without the option to undo. Use this button carefully.

Solo

Switches the current track to solo mode. You can change a track out of solo mode by clicking it again. When in solo mode, the button for that track turns red. Only tracks that have the Solo button enabled will be played when in solo mode.

Mute

Switches off a track without deleting it. You can unmute a track just by clicking the Mute button again. When muted, a track's Mute button will be green.

Audacity supports three different track types that can be viewed simultaneously when they exist in a single channel. These three track types let you view waveform, MIDI information, and label information for a given audio file. Table 19.3 describes each of the three types.

Table 19.3: Track Types

Tool

Description

Audio

Audio tracks contain digitally sampled sounds. Two stereo channels are represented by two stereo tracks. Each audio track has a sample rate that is the same as the project sample rate.

Note

Note tracks display data loaded from a MIDI file. They cannot be changed or played, only viewed.

Label

Label tracks can be used to mark a document with annotations. Annotations can be saved to a text file.

Note

Common values for audio sample rates are shown in Table 19.4.

Table 19.4: Common Sample Rates

Frequency

Usage

8000 Hertz

Typical telephone

11025 Hertz

Minimum "voice quality"

16000 Hertz

Typical "voice quality"

22050 Hertz

Common digital interactive media

44100 Hertz

CD audio, DAT (digital audiotape)

48000 Hertz

Digital studio quality

96000 Hertz

Digital studio quality (newer)

Menus

The Audacity menus provide access to functions for managing files, editing, adjusting views, managing Audacity projects, and finally, creating special effects. There is also a standard Help menu.

The File Menu

Figure 19.10 shows the File menu, and Table 19.5 contains an itemized description of the menu. Note that menu items that have names ending with three ellipsis points (three dots) will bring up a dialog box where you can fill in some parameters.

click to expand
Figure 19.10: File menu.

Table 19.5: File Menu

Menu Item

Description

New

Creates a new empty project window.

Open

Presents you with a dialog box to choose a file to open. If a project window is open and empty, the new file will appear in that window; otherwise a new project window will open.

Close

Closes the current project window.

Save Project

Saves the current Audacity project file in AUP format. Audacity projects are not usable by other programs. Audio data for an Audacity project is not stored in the AUP file—instead, it is stored in a directory with the same name as the project.

Save Project As

Saves the current Audacity project file, with a different name or directory path.

Export as WAV

Exports the current Audacity project as a standard audio file format, such as WAV or AIFF. Change the format of the exported file in the Preferences dialog box.

Export Selection as WAV

The same as Export as WAV, but only exports the selected portion of the project.

Export as MP3

Exports the current Audacity project as an MP3 file. Exporting MP3 files requires that you install a separate MP3 encoder, not included with Audacity.

Export selection as MP3

The same as Export as MP3, but only exports the selected portion of the project.

Export as OGG

Exports the current Audacity project as an Ogg Vorbis file.

Export selection as OGG

The same as Export as OGG, but only exports the selected portion of the project.

Export Labels

Exports label tracks to a text file.

Preferences

Place where you configure Audacity.

Exit

Closes all project windows and exits Audacity. It will ask if you want to save changes to your project.

The Edit Menu

Figure 19.11 shows the Edit menu, and Table 19.6 contains an itemized description of the menu. Parts of this menu contain the standard Cut, Copy, and Paste functions; the rest are related functions that are specific to Audacity's capabilities.


Figure 19.11: Edit menu.

Table 19.6: Edit Menu

Menu Item

Description

Undo

Undoes the last edits performed. Allows you to undo every operation going back to the last time the document was saved.

Redo

Redoes edits that were just undone. The redo history remains available until you do a fresh edit.

Cut

Removes the selected audio data and moves it to the Clipboard.

Copy

Copies the selected audio data to the Clipboard.

Paste

Inserts the Clipboard contents at the position of the selection cursor in the project, replacing any selected data.

Delete

Removes selected data without copying it to the Clipboard.

Silence

Replaces selected audio data with silence.

Insert Silence

Inserts the prompted amount of silence entered at the current track cursor position in the project. Overwrites selections.

Split

Moves the selected region into its own track or tracks, replacing the affected portion of the original track with silence.

Duplicate

Makes a copy of all or part of a track or set of tracks into new tracks.

Select

All Selects all of the audio in all of the tracks.

The View Menu

The View menu provides functions that you can use to control what you see in the Audacity window and how you see it. Figure 19.12 shows the View menu, and Table 19.7 contains an itemized description of the menu.

click to expand
Figure 19.12: View menu.

Table 19.7: View Menu

Menu Item

Description

Zoom In

Zooms in on a portion of the audio data. Doing this allows you to view more data detail for a smaller time period.

Zoom Normal

Changes the zoom factor to one inch of data for one second of time; this is the default zoom factor.

Zoom Out

Zooms out so you can see a larger time base, at the cost of less detail.

Fit in Window

Adjusts the zoom factor so that the entire project fits exactly in the window.

Plot Spectrum

Plots a spectrum for a selected portion of a single track. First select a portion of audio data from a single track, then select this menu item. A window will open that will display the Power Spectrum of the audio for the selected data. The Power Spectrum computation uses the Fast Fourier Transform (FFT) algorithm to graph the proportional energy level for each frequency.

Float or Unfloat Palette

Allows you to switch between docking the Tool palette at the top of each project window or in a separate floating window.

The Project Menu

Audacity uses the concept of projects that you've encountered elsewhere, such as with UltraEdit earlier in this book. By using projects, you can organize data files as well as configuration and operational parameters in one collection that can be recalled at any time. This really helps when dealing with complex tasks. Figure 19.13 shows the Project menu, and Table 19.8 contains an itemized description of the menu.

click to expand
Figure 19.13: Project menu.

Table 19.8: Project Menu

Menu Item

Description

Import Audio

Imports audio into your project. Use this function to add another track to a project with at least one existing track. You can also mix the imported track with an existing track.

Import Labels

Imports a text file that contains time codes and labels, turning them collectively into a label track.

Import MIDI

Imports a MIDI file into a note track. MIDI files can be viewed but not played, edited, or saved.

Import Raw Data

Allows you to open a file in virtually any uncompressed format. Audacity will examine the file contents to determine their format. You will need to listen to the result in order to decide if the program made the right format choice. You can use the dialog box the function displays to direct the program in its attempts. Sometimes a successful operation has a bit of noise at the beginning, caused by the unrecognized header format. The rest of the data usually plays correctly. You can then edit out the noise.

Edit ID3 Tags

Opens a dialog box allowing you to edit the ID3 tags associated with a project. These are used for MP3 exporting.

Quick Mix

Mixes selected tracks down to one or two tracks. Note that if you try to mix two loud tracks together, you may get clipping that sounds like pops, clicks, and noise. To avoid this, you should first adjust the gain (amplification) of the tracks to a lower level.

Align Tracks Together

Adjusts the time offset of selected multiple tracks to make them start at the same time. The starting time is adjusted to the average of all tracks' original starting times.

Align with Zero

Resets the time offset of elected multiple tracks to zero.

New Audio Track

Creates a new audio track with no data.

New Label Track

Creates a new label track.

Remove Track(s)

Removes the selected track or tracks from the project. You only need to select a portion of a track for it to be removed.

Add Label At Selection

Creates a new label at the current selection.

The Effect Menu

Audacity includes many built-in effects and also lets you use plug-in effects. To apply an effect, simply select part or all of the tracks you want to modify, and select the effect from the menu. Figure 19.14 shows the Effect menu, and Table 19.9 contains an itemized description of the menu.


Figure 19.14: Effect menu.

Table 19.9: Effect Menu

Menu Item

Description

Amplify

Increases or decreases the volume of a track or set of tracks. Audacity computes for you the maximum amount you could amplify the selected audio without being so loud that the signal is clipped.

BassBoost

Amplifies the lower frequencies yet leaves most of the other frequencies untouched. Recommended maximum boost is 12 dB.

Echo

Repeats the audio you have selected again and again, softer each time. There is a fixed time delay between each repeat.

Fade In

A linear fade-in to the selected audio data.

Fade Out

A linear fade-out to the selected audio.

FFT Filter

Applies a Fast Fourier Transform. The FFT Filter dialog is not properly finished, but the function works properly.

Invert

Flips the audio samples upside down.

Noise Removal

Removes constant background noise, such as fans, tape noise, or hums. Does not work well for removing background speech or music.

Phaser

Combines phase-shifted signals with the original signal.

Reverse

Reverses the selected audio temporarily; after the effect the end of the audio will be heard first and the beginning last. Useful for listening to old Beatles music!

Wahwah

Give us a little wah-wah, George! Uses a moving bandpass filter to create the famous wah-wah sound. This function also adjusts the phase of the left and right channels of a stereo recording, to make the effect travel between the speakers.

Freeverb2

Provides sliders to adjust reverb effects. Experiment with the sliders to achieve some interesting reverberating sounds.

Many Menu items can be invoked by the use of the standard Windows accelerator key combinations, such as Ctrl+W to close a window. Table 19.10 lists the shortcut keys.

Table 19.10: Shortcut Keys

Menu Item

Shortcut

File, New

Ctrl+N

File, Open

Ctrl+O

File, Close

Ctrl+W

File, Save Project

Ctrl+S

File, Preferences

Ctrl+P

Edit, Undo

Ctrl+Z

Edit, Redo

Ctrl+R

Edit, Cut

Ctrl+X

Edit, Copy

Ctrl+C

Edit, Paste

Ctrl+V

Edit, Delete

Ctrl+K

Edit, Silence

Ctrl+L

Edit, Split

Ctrl+Y

Edit, Duplicate

Ctrl+D

Edit, Select All

Ctrl+A

View, Zoom In

Ctrl+1

View, Zoom Normal

Ctrl+2

View, Zoom Out

Ctrl+3

View, Fit in Window

Ctrl+F

View, Plot Spectrum

Ctrl+U

Project, Import Audio

Ctrl+I

Project, Add Label at Selection

Ctrl+B

Note

The version of Audacity used here is version 1.0, which is a stable release but does lack a few features, the most notable of which is the ability to resample audio files.

You may be interested in version 1.2, which was released after this chapter was written. It includes many of the features missing from version 1.0. You can download Audacity 1.2 at http://audacity.sourceforge.net/.




3D Game Programming All in One
3D Game Programming All in One (Course Technology PTR Game Development Series)
ISBN: 159200136X
EAN: 2147483647
Year: 2006
Pages: 197

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net