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.

IB1<br />

424<br />

Practice<br />

defined to be the “note-on” command. When you click close to the top of a<br />

kslider key, generating a high enough velocity value (let’s say above 90), you<br />

should hear the sound of a piano. This sound is not coming from Max/MSP, but<br />

instead, it is generated by a virtual instrument that is part of the operating system<br />

of your computer, which, by default, plays MIDI notes using the sound of a<br />

piano. If you try playing more notes, you will realize that noteout plays a sound<br />

for every new note that it receives, <strong>with</strong>out interrupting or stopping the notes<br />

previously played. There is a slight problem: using noteout we told the virtual<br />

instrument when to begin playing a note, but we didn’t tell it when to stop!<br />

To interrupt a note and solve this problem, we will need to send another MIDI<br />

command: a matching MIDI note <strong>with</strong> a velocity equal to 0, which is called the<br />

“note-off” command. (A kind of “remove finger from key” command.)<br />

One way to properly “extinguish” a MIDI note generated by kslider is to<br />

change the way that the object manages MIDI notes. In edit mode, call up<br />

the Inspector for the upper kslider, select the Value tab, and change the<br />

Display Mode parameter value from “Monophonic” to “Polyphonic”. Then<br />

return to performance mode. The first time that you click on a kslider key,<br />

the note will sound at the velocity chosen, and the second time that you click<br />

on the same key, the note will be triggered again, but this time <strong>with</strong> a velocity<br />

of 0, which will make the sound stop: try this. Besides adding the handy notestopping<br />

feature, this also now enables you to activate more than one note at<br />

the same time: the performance capability has become polyphonic.<br />

Now turn your attention to the lower half of the patch in IB_01_MIDI_note.<br />

<strong>max</strong>pat.<br />

Fig. IB.2 The lower part of the patch in IB_01_MIDI_note.<strong>max</strong>pat<br />

We have connected the kslider object (in monophonic mode) to the<br />

makenote object, which generates a MIDI note-on/note-off command pair.<br />

Every time this object receives a note-on, it generates a note-off after a<br />

configurable length of time has elapsed. The object has three inlets, one for<br />

MIDI note number, one for velocity, and one for the duration in milliseconds<br />

(which is, of course, the amount of time to pass before the note-off command<br />

is sent). It has two outlets, one for MIDI note number and the other for velocity.<br />

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

© ConTempoNet 2010 - All rights reserved<br />

Paragraph IB.1 - Introduction to MIDI

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

Saved successfully!

Ooh no, something went wrong!