MSP Getting Started Tutorials and Topics Reference Table of Contents Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5 PowerPC signal processing in Max; How To Use This Manual; Reading the manual online; Other Resources for MSP Users; Digital Audio: How Digital Audio Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8 Sound; Simple harmonic motion; Complex tones; Harmonic tones; Inharmonic tones and noise; Amplitude envelope; Amplitude and loudness; Digital representation of sound; Sam- pling and quantizing a sound wave; Limitations of digital audio; Sampling rate and Nyquist rate; Precision of quantization; Memory and storage; Clipping; Advantages of digital audio; Synthesizing digital audio; Manipulating digital signals; How MSP Works: Max Patches and the MSP Signal Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Introduction; Audio rate and control rate; The link between Max and MSP; Limitations of MSP; Advantages of MSP; Audio I/O: Audio input and output with MSP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28 The DSP Status Window; About Logical Input and Output Channels; Using the Sound Man- ager with MSP; Output Settings; Sound Out Level; Sampling rate (Sound Output quality); Sound Output Destination; Input Settings; The Sound Input source; Play Sound Through Output Device; Using ASIO Drivers with MSP; Controlling ASIO Drivers with Messages to the dsp Object; Using DirectConnect with MSP; Using ReWire with MSP; Inter-application Synchronization and MIDI in ReWire; Using VST with MSP; Parameters; Inter-application Synchronization and MIDI in VST; Working in Non-Real Time with MSP; Tutorial 1: Fundamentals: Test tone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .47 Tutorial 2: Fundamentals: Adjustable oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .52 Tutorial 3: Fundamentals: Wavetable oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57 Tutorial 4: Fundamentals: Routing signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63 Tutorial 5: Fundamentals: Turning signals on and off . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71 Tutorial 6: Fundamentals: Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .79 Tutorial 7: Synthesis: Additive synthesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .84 Tutorial 8: Synthesis: Tremolo and ring modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .88 Tutorial 9: Synthesis: Amplitude modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .92 Tutorial 10: Synthesis: Vibrato and FM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .96 Tutorial 11: Synthesis: Frequency modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .98 Tutorial 12: Synthesis: Waveshaping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .102 Tutorial 13: Sampling: Recording and playback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106 Tutorial 14: Sampling: Playback with loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111 Tutorial 15: Sampling: Variable-length wavetable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .114 2 Table of Contents Tutorial 16: Sampling: Record and play audio files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .119 Tutorial 17: Sampling: Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .123 Tutorial 18: MIDI control: Mapping MIDI to MSP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .127 Tutorial 19: MIDI control: Synthesizer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .132 Tutorial 20: MIDI control: Sampler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .139 Tutorial 21: MIDI control: Using the poly~ object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .145 Tutorial 22: MIDI control: Panning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .152 Tutorial 23: Analysis: Viewing signal data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .159 Tutorial 24: Analysis: Oscilloscope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165 Tutorial 25: Analysis: Using the FFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .168 Tutorial 26: Frequency Domain Signal Processing with pfft~ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .174 Tutorial 27: Processing: Delay lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .185 Tutorial 28: Processing: Delay lines with feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .188 Tutorial 29: Processing: Chorus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .192 Tutorial 30: Processing: Flange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .195 Tutorial 31: Processing: Comb filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .199 MSP Reference Pages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205-520 Manual Conventions; The dsp Object: Controlling and Automating MSP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .521 3 Copyright and Trademark Notices This manual is copyright © 2000/2001 Cycling ’74. MSP is copyright © 1997-2001 Cycling ’74—All rights reserved. Portions of MSP are based on Pd by Miller Puckette, © 1997 The Regents of the University of California. MSP and Pd are based on ideas in FTS, an advanced DSP platform © IRCAM. Max is copyright © 1990-2001 Cycling ’74/IRCAM, l’Institut de Récherche et Coordination Acoustique/Musique. VST is a trademark of Steinberg Soft- und Hardware GmbH. ReWire is a trademark of Propellerhead Software AS. Credits Original MSP Documentation: Chris Dobrian MSP 2.0 Getting Started: David Zicarelli, Gregory Taylor MSP 2.0 Tutorials and Topics: David Zicarelli, Jeremy Bernstein, R. Luke DuBois, Gregory Taylor, MSP 2.0 Reference: David Zicarelli, Gregory Taylor, Adam Schabtach, Joshua Kit Clayton, jhno, Richard Dudas, R. Luke DuBois MSP 2.0 Manual page example patches: R. Luke DuBois, Darwin Grosse, Ben Nevile, Joshua Kit Clayton, David Zicarelli Cover Design: Lilli Wessling Hart Graphic Design: Gregory Taylor 4 Introduction PowerPC signal processing in Max MSP gives you over 170 Max objects with which to build your own synthesizers, samplers, and effects processors as software instruments that perform audio signal processing in your PowerPC. A filter and delay effect processor in MSP As you know, Max enables you to design your own programs for controlling MIDI synthesizers, samplers, and effects processors. MIDI control with Max With the addition of the MSP objects, you can also create your own digital audio device designs— your own computer music instruments—and incorporate them directly into your Max programs. 5 Introduction Overview and Documentation You can specify exactly how you want your instruments to respond to MIDI control, and you can implement the entire system in a Max patch. MIDI control of a parameter of an audio process MSP objects are connected together by patch cords in the same way as Max objects. These con- nected MSP objects form a signal network which describes a scheme for the production and mod- ification of digital audio signals. (This signal network is roughly comparable to the instrument definition familiar to users of Music N sound synthesis languages such as Csound.) The audio sig- nals are played through the audio output jack of the Power PC (using the Sound Manager in the Mac OS) or through an installed sound card such as the Digidesign Audiomedia III. Signal network for an FM instrument How To Use This Manual The MSP Documentation contains the following sections: Digital Audio explains how computers represent sound. Reading this chapter may be helpful if MSP is your first exposure to digital manipulation of audio. If you already have experience in this area, you can probably skip this chapter. How MSP Works provides an overview of the ideas behind MSP and how the software is integrated into the Max environment. Almost everyone will want to read this brief chapter. 6 Introduction Overview and Documentation Audio Input and Output describes MSP’s support for the Macintosh Sound Manager and audio interface cards. It explains how to use the DSP Status window to monitor and tweak MSP’s perfor- mance. The MSP Tutorials are over 30 step-by-step lessons in the basics of using MSP to create digital audio applications. Each chapter is accompanied by a patch found in the MSP Tutorial folder. If you’re just getting set up with MSP, you should at least check out the first tutorial, which covers set- ting up MSP to make sound come out of your computer. The MSP Object Reference section describes the workings of each of the MSP objects. It’s orga- nized in alphabetical order. Reading the manual online The table of contents of the MSP documentation is bookmarked, so you can view the bookmarks and jump to any topic listed by clicking on its names. To view the bookmarks, click on the icon that looks like this: Click on the triangle next to each section to expand it. Instead of using the Index at the end of the manual, it might be easier to use Acrobat Reader’s Find command. Choose Find from the Tools menu, then type in a word you’re looking for. Find will highlight the first instance of the word, and Find Again takes you to subsequent instances. We’d like to take this opportunity to discourage you from printing out the manual unless you find it absolutely necessary. Other Resources for MSP Users The help files found in the max- help folder provide interactive examples of the use of each MSP object. The Max/MSP Examples folder contains a number of interesting and amusing demonstrations of what can be done with MSP. The Cycling ’74 web site provides the latest updates to our software as well as an extensive list of frequently asked questions and other support information. Cycling ’74 runs an on-line Max/MSP discussion where you can ask questions about program- ming, exchange ideas, and find out about new objects and examples other users are sharing. For information on joining the discussion, as well as a guide to third-party Max/MSP resources, visit http://www.cycling74.com/community/ Finally, if you’re having trouble with the operation of MSP, send e-mail to [email protected], and we’ll try to help you. We’d like to encourage you to submit questions of a more conceptual nature (“how do I...?”) to the Max/MSP mailing list, so that the entire com- munity can provide input and benefit from the discussion. 7 Digital Audio How Digital Audio Works A thorough explanation of how digital audio works is well beyond the scope of this manual. What follows is a very brief explanation that will give you the minimum understanding necessary to use MSP successfully. For a more complete explanation of how digital audio works, we recommend The Computer Music Tutorial by Curtis Roads, published in 1996 by the MIT Press. It also includes an extensive bibliog- raphy on the subject. Sound Simple harmonic motion The sounds we hear are fluctuations in air pressure—tiny variations from normal atmospheric pressure—caused by vibrating objects. (Well, technically it could be water pressure if you’re listen- ing underwater, but please keep your computer out of the swimming pool.) As an object moves, it displaces air molecules next to it, which in turn displace air molecules next to them, and so on, resulting in a momentary “high pressure front” that travels away from the moving object (toward your ears). So, if we cause an object to vibrate—we strike a tuning fork, for example—and then measure the air pressure at some nearby point with a microphone, the micro- phone will detect a slight rise in air pressure as the “high pressure front” moves by. Since the tine of the tuning fork is fairly rigid and is fixed at one end, there is a restoring force pulling it back to its normal position, and because this restoring force gives it momentum it overshoots its normal position, moves to the opposite extreme position, and continues vibrating back and forth in this manner until it eventually loses momentum and comes to rest in its normal position. As a result, our microphone detects a rise in pressure, followed by a drop in pressure, followed by a rise in pressure, and so on, corresponding to the back and forth vibrations of the tine of the tuning fork. 8 Digital Audio How Digital Audio Works If we were to draw a graph of the change in air pressure detected by the microphone over time, we would see a sinusoidal shape (a sine wave) rising and falling, corresponding to the back and forth vibrations of the tuning fork. Sinusoidal change in air pressure caused by a simple vibration back and forth This continuous rise and fall in pressure creates a wave of sound. The amount of change in air pressure, with respect to normal atmospheric pressure, is called the wave’s amplitude (literally, its “bigness”). We most commonly use the term “amplitude” to refer to the peak amplitude, the great- est change in pressure achieved by the wave. This type of simple back and forth motion (seen also in the swing of a pendulum) is called simple harmonic motion. It’s considered the simplest form of vibration because the object completes one full back-and-forth cycle at a constant rate. Even though its velocity changes when it slows down to change direction and then gains speed in the other direction—as shown by the curve of the sine wave—its average velocity from one cycle to the next is the same. Each complete vibratory cycle therefore occurs in an equal interval of time (in a given period of time), so the wave is said to be periodic. The number of cycles that occur in one second is referred to as the frequency of the vibra- tion. For example, if the tine of the tuning fork goes back and forth 440 times per second, its fre- quency is 440 cycles per second, and its period is 1/ second per cycle. 440 In order for us to hear such fluctuations of pressure: • The fluctuations must be substantial enough to affect our tympanic membrane (eardrum), yet not so substantial as to hurt us. In practice, the intensity of the changes in air pressure must be greater than about 10-9 times atmospheric pressure, but not greater than about 10-3 times atmospheric pressure. You’ll never actually need that information, but there it is. It means that the softest sound we can hear has about one millionth the intensity of the loudest sound we can bear. That’s quite a wide range of possibilities. • The fluctuations must repeat at a regular rate fast enough for us to perceive them as a sound (rather than as individual events), yet not so fast that it exceeds our ability to hear it. Text- books usually present this range of audible frequencies as 20 to 20,000 cycles per second (cps, also known as hertz, abbreviated Hz). Your own mileage may vary. If you are approaching middle age or have listened to too much loud music, you may top out at about 17,000 Hz or even lower. 9 Digital Audio How Digital Audio Works Complex tones An object that vibrates in simple harmonic motion is said to have a resonant mode of vibration— a frequency at which it will naturally tend to vibrate when set in motion. However, most real- world objects have several resonant modes of vibration, and thus vibrate at many frequencies at once. Any sound that contains more than a single frequency (that is, any sound that is not a simple sine wave) is called a complex tone. Let’s take a stretched guitar string as an example. A guitar string has a uniform mass across its entire length, has a known length since it is fixed at both ends (at the “nut” and at the “bridge”), and has a given tension depending on how tightly it is tuned with the tuning peg. Because the string is fixed at both ends, it must always be stationary at those points, so it naturally vibrates most widely at its center. A plucked string vibrating in its fundamental resonant mode The frequency at which it vibrates depends on its mass, its tension, and its length. These traits stay fairly constant over the course of a note, so it has one fundamental frequency at which it vibrates. However, other modes of vibration are still possible. Some other resonant modes of a stretched string The possible modes of vibration are constrained by the fact that the string must remain stationary at each end. This limits its modes of resonance to integer divisions of its length. This mode of resonance would be impossible because the string is fixed at each end 10
Description: