Recording Cal Programs - CAKEWALK PRO AUDIO User Manual

Cakewalk
Table of Contents

Advertisement

16-6
Here is a sample program that illustrates how the CAL language works.
This sample program asks the user to enter a value and then adds that
value to the velocity parameter of note events.
(do)
(int amt 0)
(getInt amt "Amount to add?" -127 127)
(forEachEvent
)
)
CAL has a very simple syntax that is similar to LISP. Every statement in
CAL is a call to a function, and the function returns a value:
(<function> <argument(s)>)
Those of you experienced with C or Pascal programming will Þnd this
natural when you think of function calls such as:
(message "Hello, world.")
Here, the function message is passed a string argument. As you might
guess, this CAL program displays text on Pro AudioÕs message line.
This syntax is not quite as natural when you realize that arithmetic
operations are treated as functions. For example, the addition operator is
really a function. To add two numbers, you say:
(+ 1 1)
the result of which is 2. This will be comfortable to LISP hackers, but
others may Þnd it a little unnatural at Þrst.

Recording CAL Programs

Most Pro Audio commands have CAL equivalents. As a result, you can
use the macro record capability of the CAL view to create basic CAL
programs.
(if (== Event.Kind NOTE)
(+= Note.Vel amt)
)

Advertisement

Table of Contents
loading

Table of Contents