Tabulated
functions
In
§ 17.10 we demonstrated continuous changes of pitchbend and volume ranging
over several sound-objects and simple notes. Changes were simple in that their
variations could be described as two straight lines. Therefore the only useful
information required by the Csound instruments were the start and end values of
each parameter.
The
situation is often more complex. Parameters may change following arbitrary
definitions between the on-setting and the off-setting of a Csound event (a
line of the score). BP2 handles this case automatically and builds a function
table tied to the event which it inserts before the score line.
In
"-da.tryCsoun
d",
try for instance:
_ins(1)
_pitchrange(200) _pitchbend(0) _pitchcont C4 _ _pitchbend(20)_ _
_pitchbend(165) _ _ D4 _ _ _ _pitchbend(150)
which
yields the Csound score:
t
0.000 60.000
f101
0.000 256 -7
0.000
85
20.000
85
165.000
171
160.000
i1
0.000 6.000 8.00 90.000 90.000 0.000
0.000
160.000 101.000
; C4
i1
6.000 4.000 8.02 90.000 90.000 0.000
160.000
150.000
0.000 ; D4
s
Here
the variation of pitchbend on 'D4' is simple and requires only the start/end
values (bold on the score). However, the pitchbend variation on 'C4' requires
four values: 0, 20, 165 and 160, which BP2 stores in the 'f101' function table
linked to 'C4'. The table index '101' appears as the last argument in event
'C4'. When it is 0 (the case with 'D4') no function table is attached.
In
"-da.tryCsoundInstrument
s"
a few examples demonstrate BP2's ability to combine calculated parameter values
with predefined ones contained in the Csound score of a sound-object. See for
instance a complex variation of 'blurb' on sound-object 'e' which contains 4
lines of Csound score.
_cont(blurb)
_value(blurb,12) e _value(blurb,110) _ _value(blurb,130) _ _ _value(blurb,80)
_ _ _value(blurb,-20) _ _value(blurb,-10) _ _ _ _value(blurb,40)
t
0.000 60.000
f101
0.000 256 -7 12.000 76 110.000 76 130.000 180 96.750
i2
0.000 3.330 7.04 8191.500 8191.500 64.000 64.000 12.000 96.750 101.000 ; E3
f102
0.000 256 -7 12.000 51 110.000 51 130.000 102 80.000 154 30.000
i2
0.000 5.000 7.00 8191.500 8191.500 64.000 64.000 12.000 30.000 102.000 ; C3
f103
5.000 256 -7
40.000
51 -6.000 51 8.000 205
70.000
; table shifted
i2
5.000 5.000 7.02 8191.500 8191.500 64.000 64.000
40.000
70.000
103.000 ; D3
f104
6.660 256 -7 -13.400 26 -10.000 230 39.917
i2
6.660 3.335 7.07 8191.500 8191.500 64.000 64.000 -13.400 39.917 104.000 ; G3
s
BP2
created function tables attached to each event. But there is more than that.
In the Csound score of 'e', event 'D3' had non-zero initial values on arguments
9 and 10. These values have been added to the ones determined by variations of
the 'blurb' parameter, thus yielding 40 for argument 9 (the start value of
'blurb') and 70 for argument 10 (the end value). The same modification is
reported in table 'f103', and all values in the table changed accordingly.
The
first and last values of a function table always reflect the start and end
values of the parameter it describes variations of. This allows Csound
instruments to operate consistently, either interpolating start and end values,
or looking at the attached function table.