Inter lude A - Programming w ith Max/MSP IA
The second and th ird inlets of vs. betw ee n enable you to modify these limits
on the fly. Let's look at an application of this object: build the patch shown in
fig ure IA.36 to try it out. The generator on the left produces MIDI note numbers
betw een 36 and 95, 8 whi le the generator on t he right produces intensity values
in deciBels between -20 and 0. The MIDI note numbers are converted into fr e-
quencies, wh ile the deciBel values are converted into raw amplitude values using
dbtoa. Note that the object vs . between on the right has two arguments: "0 ."
and "0 ." (both using a decimal point). These arguments are present on ly to tell
the object to generate floating point numbers; in t heir absence, or with integer
arguments given, vs. between wou ld generate integer values only for the dB
values, and we wou ld therefore have had lessfide lity in the amplitude dimension.
Q 1;1 l
000.
metro 1000
rS7 1 ~-.:00~_Ji:f
~~~~~le ~ [Link]";' . [Link] 0. Q
b intensity in dB~ ,-1-- --- -----
frequency ~ dbtoa
~c't-
- amplitude ~
·-
""./.
Fig. IA.36 An appl ication of vs. between
There is another interesti ng random number generator that is part of the stan-
dard Max library: drunk . This object accepts two arguments and generates
random nu mbers in the interval between 0 and the fi rst argument minus 1,
exactly as rando m does. Any two values, howeve r, generated in succession are
guaranteed to diverge by no more tha n a value that is defined by the interval
between 0 and the second argument minus 1. To understand this, observe the
patch shown in fig ure IA.37, w hich we invite you to try yourself:
J. - -
drunk 128 5
QI]
Fig. IA.37 The drunk random numbe r generator
8 When vs . between generates int egers, t hese w ill be found between the minimum value and the
maximum value minus 1.
153