Digital Sound & Music: Concepts, Applications, & Science, Chapter 2, last updated 6/25/2013

28

Figure 2.29 Adding sound waves in Pure Data

2.3.3 Modeling Sound in MATLAB

It's easy to model and manipulate sound waves in MATLAB, a mathematical modeling program.

If you learn just a few of MATLAB‟s built-in functions, you can create sine waves that represent

sounds of different frequencies, add them, plot the graphs, and listen to the resulting sounds.

Working with sound in MATLAB helps you to understand the mathematics involved in digital

audio processing. In this section, we'll introduce you to the basic functions that you can use for

your work in digital sound. This will get you started with MATLAB, and you can explore

further on your own. If you aren't able to use MATLAB, which is a commercial product, you

can try substituting the freeware program Octave. We introduce you briefly to Octave in Section

2.3.5. In future chapters, we‟ll limit our examples to MATLAB because it is widely used and

has an extensive Signal Processing Toolbox that is extremely useful in sound processing. We

suggest Octave as a free alternative that can accomplish some, but not all, of the examples in

remaining chapters.

Before we begin working with MATLAB, let‟s review the basic sine functions used to

represent sound. In the equation ) Asin(2fx y , frequency f is assumed to be measured in

Hertz. An equivalent form of the sine function, and one that is often used, is expressed in terms

of angular frequency, , measured in units of radians/s rather than Hertz. Since there are