1.6.1 Practical Exercises

Figure 1.58 - Icon for a practical exercise

Figure 1.58 - Icon for a practical exercise

Throughout the book you'll see icons in the margins indicating learning supplements that are available for that section. If you're reading the book online, you can click on these links and go directly to the learning supplement on our website. If you're reading a printed version of the book, the learning supplements can be found by visiting our website and looking in the applicable section. The icon shown in Figure 1.58 indicates there is a supplement available in the form of a practical exercise. This could be a project you complete using the high-level sound production software described in earlier sections, a worksheet with practice math problems, or a hands-on exercise using tools in the world around you. This brings us to our first practical exercise.  As shown in the margin next to this paragraph, we have a learning supplement that walks you through setting up your digital audio workstation. Use this exercise to help you get all your new equipment and software up and running.

1.6.2 Flash and Video Tutorials

Figure 1.59 Icon for a Flash Tutorial

Figure 1.59 Icon for a Flash Tutorial

Figure 1.60 Icon for a video tutorial

Figure 1.60 Icon for a video tutorial

The icon shown in Figure 1.59 indicates that supplements are available that require the Flash player web browser plug-in. The Flash tutorials are dynamic and interactive, helping to clarify concepts like longitudinal waves, musical notation, the playing of scales on a keyboard, EQ, and so forth. Questions at the ends of the Flash tutorials check your learning. To play the tutorials, you need the Flash player plug-in to your web browser, which is standard and likely already installed. At most, you’ll need to do an occasional upgrade of your Flash player, which on most computers is handled with automatic reminders of new versions and easy download and installation. The icon shown in Figure 1.60 indicates that supplements are available in the form of videos. The video tutorials show a live action video demonstration of a concept.

In addition to the software you need for actual audio recording and editing as described in the previous sections, you also may want some software for experimentation. The application programs listed below allow you to manipulate sound at descending levels of abstraction so that you can understand the operations in more depth. You can decide which of these software environments are useful to you as you learn more about digital audio.

1.6.3 Max and Pure Data (PD)

Figure 1.61 Icon for Max demo or programming exercise

Figure 1.61 Icon for Max demo or programming exercise

The icon shown in Figure 1.61 indicates there are supplements available that use the Max software. Max (formerly called Max/MSP/Jitter) is a real-time graphical programming environment for music, audio, and other media developed by Cycling ‘74. The core program, Max, provides the user interface, MIDI objects, timing for event-driven programming, and inter-object communications. This functionality is extended with the MSP and Jitter modules. MSP supports real-time audio synthesis and digital signal processing. Jitter adds the ability to work with video. Max programs, called patchers, can be easily distributed and run by anyone who downloads the free Max runtime program. The runtime allows you to open the patchers and interact with them. If you want to be able to make your own patchers or make changes to existing ones, you need to purchase the full version. Max can also compile patchers into executable applications. In this book, Max demos are finished patchers that demonstrate a concept. Max programming exercises are projects that ask you to create or modify your own patcher from a given set of requirements. We provide example solutions for Max programming exercises in the solutions section of our website.

Max is powerful enough to be useful in real-world theatre, performance, music, and even video gaming productions, allowing sound designers to create sound systems and functionality not available in off-the-shelf software. On the Cycling ’74 web page, you can find a list of interesting and creative applications.

Our Max demos require the Max runtime system and are optimized for Max version 6, which can be downloaded free at the Cycling ’74 website. Purchasing the full program is recommended for those who want to experiment with the demos more deeply or who want to complete the programming exercises. Figure 1.62 shows a series of Max patcher windows.

Figure 1.62 Max graphical programming environment

Figure 1.62 Max graphical programming environment

If you can’t afford Max, you might consider a free alternative, Pure Data, created by one of the originators of Max. Pure Data is open source software similar to Max in functionality and interface. For the Max programming exercises that involve audio programming, you might be able to use Pure Data and save yourself some money. However, PureData's documentation is not nearly as comprehensive as the documentation for Max.

1.6.4 MATLAB and Octave

Figure 1.63 Icon for a MATLAB exercise

Figure 1.63 Icon for a MATLAB exercise

The icon shown in Figure 1.63 indicates there is a MATLAB exercise available for that section of the book. MATLAB (Figure 1.64) is a commercial mathematical modeling tool that allows you to experiment with digital sound at a low level of abstraction. MATLAB, which stands for “matrix lab,” is adept at manipulating matrices and arrays of data. Essentially, matrices are tables of information, and arrays are lists. Digital audio data related to a sound or piece of music is nothing more than an array of audio samples. The audio samples are generated in one of two basic ways in MATLAB. Sound can be recorded in an audio processing program like Adobe Audition, saved as an uncompressed PCM or a WAV file, and then input into MATLAB.   Alternatively, it can be generated directly in MATLAB through the execution of sine functions. A sine function is given a frequency and amplitude related to the pitch and loudness of the desired sound. Executing a sine function at evenly spaced points produces numbers that constitute the audio data. Sine functions also can be added to each other to create complex sounds, the sound data can be plotted on a graph, and the sounds can be played in MATLAB. Operations on sine functions lay bare the mathematics of audio processing to give you a deeper understanding of filters, special effects, quantization error, dithering, and the like. Although such operations are embedded at a high level of abstraction in tools like Logic and Audition, MATLAB allows you to create them “by hand” so that you really understand how they work.

MATLAB also has extra toolkits that provide higher-level functions. For example, the signal processing toolkit gives you access to functions such as specialized waveform generators, transforms, frequency responses, impulse responses, FIR filters, IIR filters, and zero-pole diagram manipulations. The associated graphs help you to visualize how sound is changed when mathematical operations alter the properties of sound, amplitude, and phase.

Figure 1.64  MATLAB mathematical modeling environment

Figure 1.64 MATLAB mathematical modeling environment

GNU Octave is an open source alternative to MATLAB that runs under the Linux, Unix, Mac OS X, or Windows operating systems. Like MATLAB, its specialty is array operations. Octave has most of the basic functionality of MATLAB, including the ability to read in or generate audio data, plot the data, perform basic array-based operations like adding or multiplying sine functions, and handle complex numbers. Octave doesn’t have the extensive signal processing toolbox that MATLAB offers. However, third-party extensions to Octave are freely downloadable on the web, and at least one third-party signal processing toolkit has been developed with filtering, windowing, and display functions.

1.6.5 C++ and Java Programming Exercises

Figure 1.65 Icon for programming exercises

Figure 1.65 Icon for programming exercises

Aside:  Because the audio processing implemented in these exercises is done at a fairly low level of abstraction, the solutions we provide for the C++ programming exercises are written primarily in C, without emphasis on the object-oriented features of C++.  For convenience, we use a few C++ constructs like dynamic memory allocation with new and variable declarations anywhere in the program.

This book is intended to be useful not only to musicians, digital sound designers, and sound engineers, but also to computer scientists specializing in digital sound. Thus we include examples of sound processing done at a low level of abstraction, through C++ programs (Figure 1.65). The C++ programs that we use as examples are done on the Linux operating system. Linux is a good platform for audio programming because it is open-source, allowing you to have direct access to the sound card and operating system. Windows, in contrast, is much more of a black box. Thus, low-level sound programming is harder to do in this environment.

If you have access to a computer running under Linux, you probably already have a C++ compiler installed. If not, you can download and install a GNU compiler. You can also try our examples under Unix, a relative of Linux. Your computer and operating system dictate what header files need to be included in your programs, so you may need to check the documentation on this.

Some Java programming exercises are also included with this book. Java allows you to handle sound at a higher level of abstraction with packages such as java.sound.sampled and java.sound.midi. You'll need a Java compiler and run-time to work with these programs.