27.11.2012 Views

programming with max/msp - Virtual Sound

programming with max/msp - Virtual Sound

programming with max/msp - Virtual Sound

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Interlude B - Additional elements of <strong>programming</strong> <strong>with</strong> Max/MSP<br />

IB.1 INTRODUCTION TO MIDI<br />

MIDI is a protocol for communicating between electronic and/or digital musical<br />

instruments and computers. Using a physical MIDI cable, it is possible to connect<br />

a synthesizer to a computer, enabling the computer to “play” synthesizer, for<br />

example. Using the MIDI protocol, the computer sends notes to the synthesizer<br />

along <strong>with</strong> the intensity <strong>with</strong> which they should be played, their durations, and<br />

other information.<br />

MIDI instruments do not need to exist in physical form: they can also run as “virtual”<br />

instruments, which are computer applications that simulate the behavior of<br />

real instruments and produce sound through audio interfaces. Such digital instruments<br />

can communicate via MIDI, just as real-world instruments do. Programs<br />

like Max/MSP can send MIDI commands directly to a receiving program such as a<br />

virtual instrument. Indeed, Max has many objects that exploit the MIDI protocol,<br />

as we will learn in more detail in Chapter 9, but for the moment, we will stick to<br />

a basic subset that is used to manage MIDI messages.<br />

Open the file IB_01_MIDI_note.<strong>max</strong>pat; Figure IB.1 shows the upper part of<br />

the Patcher Window.<br />

Fig. IB.1 The upper part of the patch contained in IB_01_MIDI_note.<strong>max</strong>pat<br />

We have connected the kslider object (the musical keyboard) to some<br />

number boxes, which then connect to a noteout object. As we have already<br />

learned, clicking on one of the kslider keys will generate the MIDI note value<br />

for the selected key on the left outlet. (We first used this object in Section 1.4.)<br />

Pressing a key also generates a velocity value on the right outlet that represents<br />

an intensity for the note; clicking on the upper part of the key will produce<br />

a higher velocity value, while clicking on the lower part will produce a lower<br />

value. (On physical keyboards, velocity actually reflects the velocity <strong>with</strong> which<br />

the key is pressed, hence the origin of the term.) Values for velocity can vary<br />

between 1 and 127 in MIDI.<br />

Note and velocity values are sent to the left and center inlets of a noteout<br />

object, which then sends the appropriate command to any MIDI instruments<br />

(real or virtual) that are connected to it. 1 In the MIDI protocol, this message is<br />

1 The right inlet of the noteout object is used to set the MIDI channel, which we don’t need at<br />

the moment. The details of this will be forthcoming in Chapter 9.<br />

from “Electronic Music and <strong>Sound</strong> Design” Vol. 1 by Alessandro Cipriani and Maurizio Giri<br />

© ConTempoNet 2010 - All rights reserved<br />

IB<br />

423

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!