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 A - Programming <strong>with</strong> Max/MSP IA<br />

See Figure IA.10 for examples:<br />

Fig. IA.10 Operators that contain the exclamation point<br />

In the first case, the value being input (1.5) is subtracted from the argument<br />

(10), and the result is 8.5 (10 - 1.5). In the second case, the argument (1) is<br />

divided by the value being input, which results in 0.25, since 1/4 = 0.25.<br />

The operands are reversed <strong>with</strong> respect to the normal order for subtraction and<br />

division. Build this patch and compare these operations <strong>with</strong> their analogs that<br />

lack an exclamation point. We already encountered the !- operator in action in<br />

Section 1.6, in the patch 01_17_pan.<strong>max</strong>pat.<br />

All of these operators also exist in MSP versions that generates a signal (+~,<br />

-~, *~, /~), which we have already used a few times in the previous chapter.<br />

MSP operators require a signal to be present on one of the two inlets (usually<br />

the left), and can receive either a signal or numeric values on their other inlet.<br />

(They can also use a single value provided as an argument.) For more information<br />

about operators and objects, remember that will bring up help<br />

patches when in edit mode.<br />

THE INT AND FLOAT OBJECTS<br />

Two objects exist that allow you to store values and recall these values later<br />

using a bang. They are int (for the storage of integers) and float (for floating<br />

point numbers).<br />

In Figure IA.11, we see that these objects possess two inlets; if a value is sent to<br />

the “hot” left inlet, the value is both stored and also immediately transmitted<br />

on the outlet, while if a value is sent to the “cold” right inlet, it is stored but<br />

not transmitted. To retrieve the stored value at any time from either of these<br />

objects, a bang can be sent to their left inlet, which will cause the value to be<br />

transmitted. In both cases, incoming values are copied into the object’s memory<br />

(and can therefore be recalled <strong>with</strong> a bang whenever we’d like) until new values<br />

take their place.<br />

Fig. IA.11 The int and float objects<br />

(...)<br />

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

© ConTempoNet 2010 - All rights reserved<br />

137

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

Saved successfully!

Ooh no, something went wrong!