Sunteți pe pagina 1din 47

The SONAR

MIDI-Kit Guide

http://www.MIDI-Kit.nl

Version: 2.8
Author: T. Valkenburgh
January 26, 2006

Ton Valkenburgh

SONAR MIDI-Kit Guide.doc 2/47
Contents
Introduction ............................................................................................................................................. 6
Preface with version 2.8...................................................................................................................... 6
Preface with version 2.7...................................................................................................................... 6
Preface with version 2.6...................................................................................................................... 6
Preface with version 2.3...................................................................................................................... 6
Why SONAR?..................................................................................................................................... 6
Why the RD-700?................................................................................................................................ 7
What you need to know....................................................................................................................... 7
What you will get ................................................................................................................................ 7
Cakewalk Application Language programs .................................................................................... 7
Example files................................................................................................................................... 7
Cakewalk instrument definitions for the RD-700 ........................................................................... 7
Satisfaction...................................................................................................................................... 8
General musical aspects .......................................................................................................................... 9
Introduction ......................................................................................................................................... 9
Time .................................................................................................................................................... 9
Sound synthesis and MIDI .................................................................................................................... 10
Introduction ....................................................................................................................................... 10
Ground tone and harmonics .............................................................................................................. 10
Sampling............................................................................................................................................ 10
Attack ............................................................................................................................................ 11
Decay............................................................................................................................................. 11
Sustain ........................................................................................................................................... 11
Release .......................................................................................................................................... 11
Oscillators.......................................................................................................................................... 11
MIDI messages.................................................................................................................................. 11
Velocity ......................................................................................................................................... 12
Volume.......................................................................................................................................... 12
Expression ..................................................................................................................................... 12
Soft ................................................................................................................................................ 12
Sostenuto ....................................................................................................................................... 12
Vibrato........................................................................................................................................... 12
Modulation Depth.......................................................................................................................... 12
After Touch ................................................................................................................................... 12
Breath ............................................................................................................................................ 13
Filter Resonance............................................................................................................................ 13
Brightness...................................................................................................................................... 13
Attack Time................................................................................................................................... 13
Decay Time ................................................................................................................................... 13
HOLD 1 (Damper) ........................................................................................................................ 13
Release Time ................................................................................................................................. 13
Specific instruments .......................................................................................................................... 13
Bowed instruments........................................................................................................................ 13
Plucked instruments ...................................................................................................................... 14
Wind instruments .......................................................................................................................... 15
Preparation ............................................................................................................................................ 17
Conventions........................................................................................................................................... 18
Background ....................................................................................................................................... 18
Track numbers and channel numbers ................................................................................................ 18
Note velocity ..................................................................................................................................... 19
SNAP to grid ..................................................................................................................................... 19
Ticks per quarter-note ....................................................................................................................... 19
Empty measure.................................................................................................................................. 19

Ton Valkenburgh

Selecting events................................................................................................................................. 19
Creating the basic MIDI-file ................................................................................................................. 20
Prologue ............................................................................................................................................ 20
Step 1: creating a MIDI file............................................................................................................... 20
Step 2: change the note velocity........................................................................................................ 21
Step 3: remove doubles ..................................................................................................................... 21
Step 4: randomize the timing............................................................................................................. 21
Step 5: ad expression......................................................................................................................... 21
Step 6: make the tempo changes ....................................................................................................... 22
Epilogue ............................................................................................................................................ 22
Modifications for specific instruments.................................................................................................. 23
The basics for the acoustic guitar ...................................................................................................... 23
Prologue ........................................................................................................................................ 23
Step 7a: change the timing of the bass and chords........................................................................ 23
Step 8a: give each string a channel................................................................................................ 23
Step 9a: change track properties.................................................................................................... 24
Step 10a: ad fret noise ................................................................................................................... 24
Step 11a: set chorus and reverb..................................................................................................... 24
Step 12a: fine tuning...................................................................................................................... 25
Epilogue ........................................................................................................................................ 25
More for the acoustic guitar .............................................................................................................. 25
Prologue ........................................................................................................................................ 25
Step 7b: change the timing of chords ............................................................................................ 25
Step 8b: give each string a channel ............................................................................................... 25
Step 9b: change track properties ................................................................................................... 26
Step 10b: set the legato slurs ......................................................................................................... 26
Step 11b: ad fret noise................................................................................................................... 26
Step 12b: set chorus and reverb.................................................................................................... 26
Epilogue ........................................................................................................................................ 26
The violin .......................................................................................................................................... 27
Prologue ........................................................................................................................................ 27
Step 7c: set the legato slurs and switch between MONO and POLY............................................ 27
Step 8c: set the staccatos.............................................................................................................. 27
Step 9c: set the glissando............................................................................................................... 27
Step 10c: set the chorus, reverb, resonance and pan .................................................................... 27
Step 11 c: fine tuning..................................................................................................................... 28
Epilogue ........................................................................................................................................ 28
The Flute ........................................................................................................................................... 28
Prologue ........................................................................................................................................ 28
Step 9b: ad the moment to catch breath......................................................................................... 29
Step 10b: Ad the phrasing ............................................................................................................. 29
Step 11b: fine tuning ..................................................................................................................... 29
Epilogue ........................................................................................................................................ 30
Example MIDI-files .............................................................................................................................. 31
Romance.zip...................................................................................................................................... 31
Beautiful dreamer.zip ........................................................................................................................ 31
Gavotte (Haendel).zip ....................................................................................................................... 31
Cakewalk Application Language Programs .......................................................................................... 33
Short descriptions.............................................................................................................................. 33
Arpeggio.cal ...................................................................................................................................... 33
Controller.cal..................................................................................................................................... 33
Emphasis.cal...................................................................................................................................... 34
Expression.cal ................................................................................................................................... 34
Glissando.cal ..................................................................................................................................... 35
GM Mode.cal .................................................................................................................................... 35
SONAR MIDI-Kit Guide.doc 3/47

Ton Valkenburgh

Legato FS.cal..................................................................................................................................... 35
Note channel.cal ................................................................................................................................ 36
Note duration.cal ............................................................................................................................... 36
Note velocity.cal................................................................................................................................ 37
Random time.cal................................................................................................................................ 37
Timebase.cal...................................................................................................................................... 37
Trill.cal .............................................................................................................................................. 37
MIDI-Kit error messages................................................................................................................... 38
MK001: Program error in <program> ........................................................................................ 38
MK002: This program requires CAL version X........................................................................... 38
MK003: This program requires CAL version X or higher............................................................ 38
MK004: No event marked, process termindated........................................................................... 38
MK005: No note marked, process terminated............................................................................... 38
MK006: At least two notes must be marked, process terminated ................................................. 38
MK007: Unsupported meter X/Y.................................................................................................. 38
MK008: No notes marked at different positions, process terminated ........................................... 38
MK009: Notes are not in the same channel, process terminated................................................... 38
MK010: More than one note marked, process terminated ............................................................ 38
MK011: (Only) one note must be marked, process terminated..................................................... 39
CAL error and fyi messages.............................................................................................................. 39
Attempt to change constant ........................................................................................................... 39
CAL Error 001: Syntax error......................................................................................................... 39
CAL Error 002: Divide by zero..................................................................................................... 39
CAL Error 003: Wrong number of arguments function_name ..................................................... 39
CAL Error 004:Unknown procedure procedure_name ................................................................. 39
CAL Error 014: Value out of range............................................................................................... 40
CAL Error 022: User pressed cancel............................................................................................. 40
CAL Error 023: Cannot open include file file_name .................................................................... 40
Cannot load Dynamic Link Library .............................................................................................. 40
Command is disabled on the menu................................................................................................ 40
Evaluation stack overflow............................................................................................................. 40
Expression too complex ................................................................................................................ 40
Expected closing quote.................................................................................................................. 40
Miscellaneous error ....................................................................................................................... 40
Mismatched parentheses................................................................................................................ 40
Missing one or more closing parentheses...................................................................................... 41
Not valid in (forEachEvent) or body expression........................................................................... 41
Out of memory .............................................................................................................................. 41
Proc does not exist in Dynamic Link Library ............................................................................... 41
Program called (error) ................................................................................................................... 41
Program called (exit) ..................................................................................................................... 41
Types do not match ....................................................................................................................... 41
Undef of undefined variable.......................................................................................................... 41
Unknown variable ......................................................................................................................... 41
Valid only in (forEachEvent) or body expression......................................................................... 41
Variable redefined......................................................................................................................... 42
Equipment ............................................................................................................................................. 43
Interconnection.................................................................................................................................. 43
Hardware ........................................................................................................................................... 43
Software ................................................................................................................................................ 45
Index...................................................................................................................................................... 46


Copyright 2004, 2005 T. Valkenburgh
SONAR MIDI-Kit Guide.doc 4/47

Ton Valkenburgh

You are free to use the information of this guide for your personal use.
For commercial applications contact midi-kit@wanadoo.nl.
All products and company names are
TM
or trademarks of their respective owners. Cakewalk Pro
Audio and Cakewalk SONAR are trademarks of Twelve Tone Systems inc., Cubasis Notation is a
trademark of Steinberg Media Technologies, Roland is a trademark of Roland Corporation, and
Yamaha is a trademark of Yamaha Corporation.

SONAR MIDI-Kit Guide.doc 5/47

Ton Valkenburgh

Introduction
This guide provides a methodology for who want to create MIDI sequences, but are until now not
satisfied with the results. The techniques presented in this guide, should help you to create music
that sounds like performed by human beings. Let us not forget that music is all about emotions.
The guide shows a systematic approach with the creation of MIDI sequences that allows you to
improve the quality of the performed music step-by-step. Creating good MIDI music is a matter of
patience and building up experience. It means spending a lot of time to get music that really does
sound like performed by human musicians.
Modern synthesizers have good sounds and allow also controlling many functions of the
synthesizer. We will show you how to use these facilities and to improve your resulting music.
To make life easy I will focus on two products: Cakewalk SONAR 3 as sequencer , and the
Roland RD-700 as synthesizer.
However, if you do not have a RD-700 you still can use the presented concepts. For the supplied
Cakewalk Application Language programs, the specific MIDI-functions, which are used for each
program, are listed. So you can decide whether you synthesizer will work with that specific CAL
program.
Preface with version 2.8
I have added the CAL error messages, because you may get them when running the MIDI-Kit.
Preface with version 2.7
I have added a piece of sound synthesis and MIDI.
Preface with version 2.6
I have added some textual changes, and updated the information of the SONAR programs.
Preface with version 2.3
I have adapted the guide for Cakewalk SONAR. I have added the information of the WEB-site
about instrument characteristics to the guide. In addition, the characteristics of the violin are added.
I created made more CAL programs, corrected CAL programs, and the guide reflects the usage of
the new programs.
Why SONAR?
1. I started years ago with Cakewalk and Twelve Tone Systems has proven to me also for the
later versions like SONAR - the capability to work well with many MIDI and audio
interfaces;
2. I am quite satisfied with the functions as sequencer of SONAR. One of the important
features of SONAR is the Cakewalk Application Language, which can reduce the manual
editing. We will use special created CAL programs for making life easier. The Cakewalk
Application Language, however, has its limitations, and that means we cannot create all
applications with it, which we really need;
3. SONAR has also many synthesizer plug-in features. We will not focus on those, but take
advantage of these features where appropriate.
SONAR MIDI-Kit Guide.doc 6/47

Ton Valkenburgh

Why the RD-700?
1. I needed a piano and the RD-700 is a quality digital piano;
2. I needed a synthesizer and again the RD-700 provides a synthesizer. This synthesizer is of
good quality and allows you controlling the sound, also in live performances.
What you need to know
To be able to use this guide you must have basic knowledge of the Personal Computer, MIDI and
MIDI-editing with SONAR. I assume that you are able to install the needed programs and
configure your PC and the interconnection between the PC and synthesizer.
In this guide, I will heavily use music score editing. Therefore, it will help if you are familiar with
reading music scores. The assumption is that you have used SONAR or Cakewalk before, because
this guide is not a replacement of the Cakewalk/SONAR manual.
Experience with playing a music instrument will probably give you a better feeling for music
performance aspects.
What you will get
Together with this guide, you will get example MIDI-files, and a set of tools and utilities, which
help to make your MIDI life easier.
You can down load the examples, the programs, and the tools and utilities from the WEB-site.
Cakewalk Application Language programs
I provide a set of CAL programs, that will be used in this guide. These programs increase your
productivity, and give easy access to RD-700 features. The provided programs perform mostly a
musical function. The programs take advantage of a library of CAL include programs. Cakewalk
allows calling CAL programs within a CAL program and therefore it is easy to combine functions
if you like to do that. If you want to make your own programs you can use this library too. The
include programs are described in the Cakewalk Application Language Programming Guide,
which can be found on the web-site.
Example files
I will use SONAR example cwp/MIDI-files
1
to show what can be achieved with the method of this
guide. There are always at least two related example files. The first one shows the basic input, and
second one shows the result of the applied methodology. With the provided MP3pro file you can
judge the end result.
Cakewalk instrument definitions for the RD-700
The RD-700 has two different modes of operation as synthesizer:
The RD-700 mode: in this mode of operation, you can select all the RD-700 sounds and
even select the 100 standard set-ups or your own defined set-up;
The general-MIDI mode: in this mode of operation, the RD-700 acts as a general-MIDI 2
device. This allows you to perform general-MIDI files.

1
SONAR cannot store MIDI sequences in wrk format. Therefore, I provide cwp-format and MIDI-format
sequences.
SONAR MIDI-Kit Guide.doc 7/47

Ton Valkenburgh

I have therefore created two sets of instrument definitions: a general-MIDI set and an RD-700 set.
In addition to that we also provide an RD-700 Set-up definition which allows you to select via the
control channel
2
one of the 100 set-ups of the RD-700.
Satisfaction
For the rest you need a lot of time and patience. However, it will give you also a lot of fun and
satisfaction if the results are more than you may have expected.

2
The default (manufacturer setting) control channel of the RD-700 is channel 16.
SONAR MIDI-Kit Guide.doc 8/47

Ton Valkenburgh

General musical aspects
Introduction
Music is build up with of a number of elements. I do not want to address all elements, because
many good books are written about music elements. I will focus on those elements, which can
make the difference between bad and good computer music.
Music is not a frozen statue or picture. It is an object changing during the time it exists. By
structuring this movement during this period, you will get the cadence, the meter, and the rhythm
of music.
Music is also tone. However, also music without tone exists. Some primitive cultures have music
that contains only beat and noise. In our western music culture, tone is a key element of music.
A sequence of tones with a different timbre or pitch is called melos. If we bound such a melos to a
specific cadence, meter and/or rhythm we get a melody.
Harmony is the combination of two or more tones with a different pitch. It is an important element,
but music can exist without harmony.
Color or timbre of a tone can change the perception of a piece of music. This element got more and
more emphasis.
Space has become an interesting element that has been explored by composers. In classical music,
some composers have used it, but in electronic music, it is sometime essential. The reasonable
priced surround sound equipment's ensure that many listeners can also perceive the use of space by
a composer.
Time
An important aspect in music is the tempo. Tempo is the ration between measurable, objective
time, and the time - we perceive - the subjective time. Constant ratios are perceived as machine-
like. House music has very often a constant tempo. However, in human performed music the tempo
always changes. Often as indicated by tempo indicators, like: andante, allegro, etc. A human
performer, however, also makes small changes in tempo, which are not indicated in the score.
Adding these changes in your MIDI-files make them more realistic, and lively. There are some
general rules, which you can apply to make these tempo changes. However, you must realize that
there are always exceptions on rules.
An increase in tempo gives more tension in the melody. In addition, if there is an increase
in the tension of the melody - e.g. the melody line is going upwards, then mostly also the
tempo will increase;
A decrease in tempo releases the tension in the melody. In addition, if there is a decrease
in the tension of the melody - e.g. the melody line is going downwards, then mostly also
the tempo will decrease;
A small rest is very often inserted after the end of a phrase bow. You can realize this by
decreasing the tempo at the end of the phrase bow, and use the previous tempo in the new
phrase bow.
As I already told you, there are exceptions to the rules. E.g. an upwards going melody with an
decrease in tempo gives an increase in tension. Mahler is one of the composers who use this.
If you are making tempo changes it is important to listen carefully to the result, and check whether
if sounds naturally.
SONAR MIDI-Kit Guide.doc 9/47

Ton Valkenburgh

Sound synthesis and MIDI
Introduction
Creating the right sound for an instrument with MIDI is not always easy. Most synthesizers handle
instruments like piano's or organs. Therefore, you must change the set up of your synthesizer for a
specific instrument to come close to the real sound of that instrument. Knowledge about sound
synthesis, music instruments, and experience with playing it yourself of course will help a lot.
However, most of us are not all able to play all instruments. Therefore, I will first explain a little
about sound synthesis, and how to influence the timbre. Further, I will give guidelines about the
characteristics of some music instruments, and how to handle their specifics in MIDI.
A MIDI sequence is not just a sequence of notes, but contains also control over the transformation
of the timbre of the sound. Twiddling the timbre helps to create a realistic performing MIDI
sequence. Notes are not always played by a musician in the same way. Using MIDI controllers is
the first step in the transformation. It is, however, a time consuming task. Not all synthesizers have
the same features and possibilities. Therefore, I will limit myself for the explanation of the concept
to the General MIDI 2 specification.
Ground tone and harmonics
All natural sounds can be seen as build up out of one or more sine ground tones and the related
harmonics. The loudness and the phase shift of tones determines the timbre of the sound. The
graphical form can look like a sine, saw tooth or square. E.g. a softly played flute produces almost
a sine tone. A loud played trumpet shows us something like a saw tooth. Some instruments, like a
piano, use multiple sources(strings) for producing the sound. The frequency of the different strings
are not exactly the same, and interfere with each other. The result is a more lively sound.
The stronger we pluck or blow an instrument, the more harmonics it will produce
Sampling
Currently, most commercial synthesizers used digital stored samples of real sounds. Tones of an
instrument will be recorded, digitalized, and stored in wave tables. From these pieces the wanted
sound is created. The best sound quality will be reached with a lot of samples recorded at different
signal levels and pitches. Below I show a sine tone, and how it changes over time.



SONAR MIDI-Kit Guide.doc 10/47

Ton Valkenburgh

We can split up this signal in four periods: Attack, Decay, Sustain, and Release. Attack and Decay
are part of the initial phase of the sound. Sustain and Release are the periods after the initial phase.
In the initial phase the timbre changes fast. After the initial phase the timbre is more stable. The
different values of the periods are characteristic for an instrument.
Attack
This is the start period during which the sound is build up. The period starts after a MIDI Note
On has been received. The duration is dependent on the instrument and the pitch. For plucked
instruments this period is relative short. For bowed and wind instruments it is longer. Mostly, out
of nowhere the sound is reaching its full loudness.
Decay
Mostly, during the second period the loudness of the signal is decreasing a little. The sound will
reach its normal timbre.
Sustain
During the sustain period the loudness is more or less stable. It can be almost stable (organs),
decrease slowly (piano), and / or change (wind and bow instruments).
Release
This period starts when a MIDI Note Off has been received. Now, the sound is dying out.
Duration is very dependent on the type of instrument, but also depends on pitch and playing style.
For some instruments it is possible that the sound has been dyed out before the MIDI Note Off
has been received.
Oscillators
In the analog world, synthesizers are build with oscillators. Nowadays, these synthesizers are very
often re-build with a computer program. A well known example of an analog synthesizer is the
Moog synthesizer. An example of this concept as computer program is Dreamstation from Audio
Simulation. Another approach is physical modeling. An example of this is the Csound project. With
its over 450 signal processing modules, it allows you to build your own instrument. Csound is often
applied in music education, because it give a good insight to the students in the concepts of sound.
For electronic instruments, the usage of oscillators is still a common practice. Most of the above
mentioned aspects for sampling will be valid for creating sound with oscillators too. However, with
oscillators you will have more grades of freedom.
MIDI messages
The timbre of a sound can be changed by MIDI messages. I will explain a number of messages,
and how they influence the timbre. Some functions have a message for coarse and fine control.
Most synthesizers, however, support only the coarse control, because this is sufficient in most
cases.
First, I will describe the functions which change the loudness. These functions are: Velocity,
Volume, Expression, Soft and Sostenuto. Some of them change the timbre too.
Next, I will deal with the functions: Vibrato, Modulation Depth, After Touch, Breath, Filter
Resonance and Brightness. These have influence on the timbre.
At last, I will explain the functions which modify the timbre and volume during a time frame:
Attack Time, Decay Time, Sustain and Release Time.
SONAR MIDI-Kit Guide.doc 11/47

Ton Valkenburgh

Velocity
At the begin of a note, also the pitch and the Velocity will be send. The timbre is dependent on the
Velocity. The sound will contain more harmonics if the Velocity is higher. In some synthesizers
also the Attack Time will be shorter.
Volume
With Volume you control the loudness of the MIDI channel. There are two MIDI controllers: 7 and
39. In general only the coarse control (7) is available and not the fine control (39). Volume does
not influence the timbre. The control is logarithmic, just like the volume control of your audio
equipment
3
. With both Volume and Expression at the value of 127 the loudness is 0 dB. Volume
will be used in general for loudness control of a channel.
Expression
Expression modifies also the loudness of a channel. However, not only the loudness changes, but
also the timbre. The MIDI-controllers for Expression are for coarse 11 and for fine 43. In general
you will only see number 11. Expression is just like Volume a logarithmic control. Expression will
be used for dynamics in a sequence (diminuendo and crescendo).
Soft
The message Soft (MIDI controller 67) has the same function as the left pedal of a piano. The
timbre will be softer; less strings will be hit of the piano. It is a switch function. All values above
64 indicate On.
Sostenuto
This MIDI controller (66) is a damper function like HOLD 1. Sostenuto, however, applies only to
the notes which are On at the moment Sostenuto is received. This is the equivalent of the third
piano pedal. It is a switch function. All values above 64 indicate On.
Vibrato
For Vibrato, there are a number of MIDI controllers: Vibrato Rate (76), Vibrato Depth (77) and
Vibrato Delay (78). These controllers are used for the Vibrato parameters of a channel. The value
indicates a relative change. No change is indicated by 40 hexadecimal.
Modulation Depth
This MIDI controller (coarse:1 and fine: 33) is used for the modulation depth of a channel. Mostly
this is the frequency delta for the Vibrato. For many synthesizers, the final effect can be controlled
by 'System Exclusive messages.
After Touch
After Touch - also called Pressure - can be applied to a note only or to a channel, respectively Key
After Touch and Channel After Touch. After Touch changes the timbre of a note or fall notes in a
channel. Higher values will result in a more bright timbre. Dependent on the implementation of the
manufacturer this parameter also influences: Vibrato, Brightness and / or loudness. For After
Touch, Universal Real Time System Exclusive messages are used.

3
Loudness (dB) = 40 log (V/127
2
), in which V = Volume * Expression.
SONAR MIDI-Kit Guide.doc 12/47

Ton Valkenburgh

Breath
This is the equivalent of After Touch, but it is specific for wind instruments. MIDI controllers are 2
(coarse) and 34 (fine).
Filter Resonance
This MIDI controller (71) controls the harmonics of a channel. The value indicates a relative
change.
Brightness
The MIDI-controller 74 controls the high cut-off filter of a channel. Changes are relative. The real
cut-off frequency is controlled by a System Exclusive message.
Attack Time
The Attack Time controller for a channel is 73. It is a relative change. The influence of this
parameter is immense. Changes in Attack Time had a dramatic influence on the characteristic of
the sound. Increasing the Attack time of a plucked instrument changes it into a completely different
instrument.
Decay Time
The Decay Time for a channel is controlled by MIDI controller 75. The change is relative.
HOLD 1 (Damper)
Hold 1 (damper) is used for the sustain period. The number of the MIDI controller is 64.&nbsp; It
is a switch. A value of 64 and higher means On. It is the equivalent of the right pedal of a piano.
The right piano pedal, however, is continuous.
Release Time
The Release Time for a channel is controlled by MIDI controller 72. The change is relative.
Specific instruments
Bowed instruments
Violin
The violin has four strings: g, d, a and e. In Cakewalk, this is G4, D5, A5 and E6. Shortening
the strings by placing the left hand finger on the fingerboard, gives the other notes. Normally in
higher positions, you can play one octave higher than the base note of the string. The highest
positions on the fingerboard can only be reached on the e-string. The highest note is g (G8).
With flageolet notes you can create even d (D9).
Playing the violin, mostly one note at the time is played. However, double notes are possible. For
most MIDI performances the violin can be seen a monophonic instrument.
Playing techniques
For the violin, there are many playing techniques. The normal technique is with the hair of the
bow (col crine). The opposite is, playing with the wood (col legno). Another very well known style
is the plucking of the strings (pizzicato), with either the left or right hand.
Very important for playing the violin is the handling of the bow. Your draws can be up and down.
Up-draws is mostly used for the lighter beats, because the down-draws gives a heavier sound.
SONAR MIDI-Kit Guide.doc 13/47

Ton Valkenburgh

Changing the direction of the draws with each note is called dtach. This is an important draw
technique in the baroque period.
Playing more notes within one draw is called legato. In the score, these notes are identified with a
slur.
Tremolos are created by fast changes in the draw direction, many times per note.
It is very difficult to simulate the different playing techniques by changing the parameters of a
voice. Therefore, the best way to recreate the special playing techniques with MIDI is to use
different samples for each playing technique. The samples are very often identified with
(abbreviations of) the techniques mentioned above.
We will show how you can simulate some different playing techniques by changing the parameters
of the voice.
Attack time
The attack time of the violin sound is longer than e.g. of a piano. A violin player compensates that
by starting a little bit earlier than the piano player. When you create a MIDI sequence you need to
compensate for the difference of the attack time of the used instruments. Note that the attack time is
dependent on the note velocity.
Plucked instruments
The Spanish guitar
The Spanish guitar has six strings: E, A, d, g, b, and e'. In Cakewalk, this is E3, A3, D4, G4, B4,
and E5. The notation in the score is one octave higher than the real sound. By putting the fingers of
the left hand between the frets, you can produce the other notes. Each fret means one semitone.
Normally for the classical guitar, the highest tone of a string is one octave higher than the base tone
of that string. Playing higher notes, is more difficult, but on the e' string three semitones higher is
possible. Electric guitars and country guitars allow higher positions. Sometimes the strings are
tuned differently. E.g., all strings one semitone lower: Nirvana, or e.g. de-tuning the lowest string
to D. For playing lute music the third string is often de-tuned to fis.
Playing the guitar, a guitarist will normally not stop one note before playing the other note.
However, if the notes are played on the same string each previous note is stopped automatically.
Therefore, the guitar can best be seen as six monophonic instruments. One monophonic instrument
for each string will give the best MIDI results. Another approach is - fewer channels consuming -
using one channel for each voice.
There are three approaches for creating the sustained notes:
Instead of using notes with the right length, you use whole notes or even one and a halve
notes. This can be used with any synthesizer. However, your score is very difficult to read;
The seconds approach can be used for synthesizers that support MIDI controller 72
(release time). You can select a release time in such a way that there is no difference in
long and short duration notes;
The third approach is using MIDI-controller 64 (hold 1 or sustain).
Which approach is the best, is determined by your synthesizer.
Playing techniques
I will explain certain playing techniques for right-handed people. It is easy to translate it for the left
hand.
Normally you will put your left hand finger just behind the fret. However, you can also create a
different timbre by putting the finger of the left hand on the fret. This is called touff.
SONAR MIDI-Kit Guide.doc 14/47

Ton Valkenburgh

In slow melodies very often a vibrato is used. There are three types of vibrato playing styles.
Moving the string up and down while ensuring that the string will not be released from the fret
creates the sagittal vibrato. The change in the pitch is less than in the other vibrato styles. The
stronger Longitudinal vibrato is done by moving the finger between the two frets in the same
direction as the string. The strongest effect is realized with moving the finger transversal on the
string - the transversal vibrato.
Another effect is the glissando that is moving the finger across the frets - upwards or downwards -
with one stroke to the string with the right hand.
The portamento differs from the glissando, because during the move of the finger across the frets,
also the notes are played with the right hand.
Playing legato on a guitar differs a lot from playing on the piano in legato style. For a higher note
on the same string, the legato is played by placing the finger fast - the hammer effect - behind the
fret without playing the string with the right hand. For a lower note on the same string, the legato
effect is realized by releasing the finger fast from the string, while another finger is already in place
on the next position. Trills e.g. are realized with this legato style. If the note is on a different
string - lower of higher, the effect is realized by playing the note on the other string softer than
normal. You can imagine that this sound differs from the above-mentioned method. Some MIDI
instruments, e.g. the Roland RD-700, have a build in legato effect for the guitar that provides the
sound like above described.
A different touch of the strings will give a different timbre. There are a couple of techniques for
plucking the strings. The normal plucking technique is called punteado. The thumb is used for the
three lower strings and respectively the pointer finger, middle finger, and the ring finger for the
three highest strings. Punteado is used with melodies, broken chords, and arpeggios.
The technique used with the fingernails like in flamenco music is called rasgueado.
Pizzicato is played by muting the strings with the right hand on the bridge.
When the notes are damped just after being plucked with the plucking fingers, you will get the
staccato sound.
The timbre of a tone is very dependent where you pluck the strings. Plucking close to the bridge is
called sul ponticiello. This produces a shaper sound. An extreme form is called mtallique.
Plucking halve way of the string is called sul tasto. It gives a soft sound. Hitting - not plucking - the
bridge or the strings near the bridge with the fingertips or the thumb is called golpeando.
Very special are flageolet tones. You force e.g. the string to resonance one octave higher by placing
your left finger gentle on the string above the twelfth fret. There are two flageolet techniques
(natural and artificial), but discussing these is out of the scope of this overview.
The best way to recreate these playing techniques with MIDI is to use different samples for each
playing technique. The samples are very often identified with (abbreviations of) the techniques
mentioned above.
Wind instruments
The Flute
Concert flute
The concert flute - tone scale C - has a chromatic reach form (b) c through d. In Cakewalk, this
is (B4) C5 through D8. The highest octave is possible, but not very often used. Notation in the
score is the same as the sound.
Trills are not possible between b - c (B4 - C5), b - cis (B4 - C#5), c - des (C5 - Db5), cis - dis
(C#5 - D#5).
SONAR MIDI-Kit Guide.doc 15/47

Ton Valkenburgh

Tremolos b - dis (B4 - D#5) end c' - es (C5 - Eb5) are difficult. Cis-e (C#5 - E5) is only possible
if played softly. In addition, in higher ranges there are some difficult to play trills and tremolos.
The flute is a monophonic instrument, and therefore you should set the MIDI channel to
monophonic. This will give more realistic trills and tremolos.
Piccolo
The piccolo is like the concert flute, however, it sounds one octave higher. The lowest notes (b) -
c- cis (B3 - C4 - C#4) are not possible. Therefore, the piccolo starts at d (D4). The highest
notes: a (A8), bes (Bb8), b (B8), c (C9) are difficult to play, only in ff.
Notation in the score is one octave lower than the sound.
Bass flute
The bass flute is like the concert flute, however, it sounds one quart lower. The tone scale is G. The
notation is in C. In addition, a bass flute in F exists. The bass flute sounds a quint below the
notation.
Attack time
The attack time of the flute sound is longer than e.g. of a piano. A flute player compensates that by
starting a little bit earlier than the piano player. When you create a MIDI sequence you need to
compensate for the difference of the attack time of the used instruments. Note that the attack time is
dependent on the note velocity.
SONAR MIDI-Kit Guide.doc 16/47

Ton Valkenburgh

Preparation
To be able to use the CAL programs you must download SONAR MIDI-kit.zip from the WEB-
site: http://www.MIDI-Kit.nl, extract the files with e.g. WinZip, and store them in the directory
where you keep your Cakewalk Application Programs.
If you are using the Roland RD-700 as synthesizer I recommend also to download the Roland RD-
700-kit.zip from the WEB-site: http://www.MIDI-Kit.nl, extract the RD-700.ins file and SYS
files, and store them in the directory where you keep your Cakewalk sample files, respectively your
SYS files. Start Cakewalk, go to instrument definitions, and import the RD-700 instrument
definitions.
You are now ready to create your first MIDI-file with this methodology.
SONAR MIDI-Kit Guide.doc 17/47

Ton Valkenburgh

Conventions
Background
Cakewalk SONAR behaves very often different from what is expected. The background is that
during the development of Cakewalk more freedom has been built in for the user. This means that
to ensure you get what you expected, we have to define a couple of rules. To be able to use the
Cakewalk Application Language programs you have to stick to the rules. Some of these
conventions are due to restrictions in the CAL programs. Others are just for making live easier, and
to make memorization simple.
In a way, these conventions give limitations. The restrictions are as less as possible, and in the end
will make your MIDI-live much simpler.
Track numbers and channel numbers
Most of the MIDI-events are related to a channel. Either they define the characteristics of the
channel, e.g. the sound, or they control the live behavior of the channel.
Others control e.g. the synthesizer.
The following help file information of Cakewalk
4
shows how confusing things may look.
In MIDI-files and in Cakewalk files there is no relation between the track number and channel
number. Cakewalk is very often confusing because even a relation ship between the channel as
seen in Cakewalk and as sent to the synthesizer is not always clear to the user.
MIDI transmits information on 16 channels, numbered 1 through 16. Every MIDI event is
assigned to a particular channel. Some MIDI equipment can accept MIDI information on only a
single channel. This channel may be pre-assigned, or you may be able to change it. Other MIDI
equipment, including many electronic keyboards and synthesizers, can accept information on
several different MIDI channels at once. Usually, these devices use a different instrument sound
for each channel.
On playback, the channel number is used to direct the MIDI information to a particular piece of
equipment. A single track can contain events on many different MIDI channels. The Chn
parameter in the Track view redirects all events in the track to the specified channel, ignoring
the actual channel number stored with each event. If this parameter is left blank, all events in
the tracks are sent to their original channels.
This parameter does not affect the channel information that is stored with each MIDI event.
When the track is displayed in other views, like the Piano Roll or Event List view, you will see
the original channel that is stored in the file. You can edit the actual channel values in those
views.
Twelve Tone Systems

This means if you want to use different channels in a track you must set a channel number for the
track. SONAR gives by default channel number one to events in a track. This is independent on the
track number.
I recommend to use in general one channel number in a track
5
.
When you edit a score, the channel of the last entered note is the default for the next entered note.

4
From Cakewalk Pro Audio 8.04.
5
Later I will show how the use of different channel numbers for the same instrument can help to make the sound
more realistic.
SONAR MIDI-Kit Guide.doc 18/47

Ton Valkenburgh

Note velocity
When entering notes in Cakewalk you have to determine the note velocity. Many Music score
editors use as default 64. However, I will use in all MIDI-files the MIDI-controller 11 expression.
The default for expression we will use is 100 (mf). Together with a default for Note velocity of
100, you will get about the same result as with a note velocity of 64 without the use of the MIDI-
controller 11 expression.
Therefore, I recommend using 100 as the default note velocity.
SNAP to grid
Some of the tools in the MIDI-Kit are very sensitive to the position of the notes in the measure.
Therefore, I recommend snapping the notes to a grid. Later you can change the position of the
notes to create a more lively performance.
Ticks per quarter-note
In the pull down menu options/projects you can set the Ticks per quarter-note. The constant
TIMEBASE, which can be used by CAL, will change accordingly. However, in some (sub)
versions of SONAR TIMEBASE will always be 960 Ticks per quarter-note. Some CAL
programs are sensitive to this bug; therefore, I recommend setting the Ticks per quarter-note
always on 960.
In the MIDI-Kit you can find a program Timebase.cal to check whether you version has this
bug.
Empty measure
I recommend keeping one empty measure at the beginning of the sequence. This is very convenient
for avoiding glitches when starting an audio recording of your MIDI-sequence.
Selecting events
You can select events and make changes on the selected events with the provided programs. You
must, however, realize that if you mark note events in the staff view by dragging an area, that the
other events within that area are not selected. If you want to select the other events too, you must
make your selection in the events list, or use the select filter (by time) after the selection of the
notes. This important, because some of the programs will remove selected events before inserting
the new values of the events. If the events are not selected, they will not be deleted, and you may
get conflicting event values.
SONAR MIDI-Kit Guide.doc 19/47

Ton Valkenburgh

Creating the basic MIDI-file
Prologue
I will use the RD-700 in RD-700 mode unless otherwise stated. In the RD-700 mode of operation,
you can use almost all RD-700 features including the GM-voices.
The sequence of the steps in the methodology is important. Some tools will not work properly if
you follow another sequence. The first thing is to create the MIDI-sequence, which is the base for
adding the specifics for the used instruments.
I recommend you to save after each step the work you have done in a different named file. That
allows you always to go back one or more steps if you create a mess.
You will find the first examples on the WEB-site in Romance.zip. In this first example file we
have included all steps in cwp and MIDI-1 format.
Step 1: creating a MIDI file
There are different ways of creating MIDI-files in SONAR:
You can record it with Cakewalk by playing on the RD-700;
You can input it in Cakewalk by using the mouse;
You can import a MIDI-file you have created with another application, e.g. a notation
application.
I always use the mouse to create a MIDI-file. I do it either in Cubasis Notation or directly in
Cakewalk. I use Cubasis Notation when I also need music scores.
As example we start with a nice piece of music from an anonymous composer: Romance for
guitar. For guitarist it is a well know piece, which looks easier to play than it is in reality. To create
a realistic guitar sound is hard work. However, it is good to start with the guitar, because the
instrument is well known, and that makes it easier to show the effect of the methodology.
Romance initial.mid is an example MIDI-file I have created for this part of our exercise. I have
set all note velocities to 100
6
.
Open this file and set your MIDI definitions for the track with the score.
Select port: Roland RD-700, bank select method: normal, bank: 11206-Roland RD-700
GTR/Bass, and patch: Nylon Gtr 1.
Set the layout. Select octave-treble; the guitar sounds one octave lower than the notation.
Set the tempo. Select 100 beats per second for Romance.
When you play this initial MIDI-file, it sounds like computer music, and that is not what you really
want. In addition, some notes may sound weird. That is, because due to the creation of the score
there are double notes in the sequence. We will remove them later.
For you own benefit, you can now add performance aspects to the file. Later we will apply the
MIDI-controllers. In the music score, I have indicated in the sequence some generic performance
aspects like: dynamics (ff, mf, mp, pp).
In the staff view of Cakewalk in Romance intitial.mid you can add these notation expressions too.
In addition, in lyric notation I have indicated where the tempo should be decreased.

6
With you can set all notes in a track to the same desired velocity. Note velocity.cal
SONAR MIDI-Kit Guide.doc 20/47

Ton Valkenburgh

Note that in Cakewalk these are only notation expressions, which do not influence the sound. I use
the notation expressions as reference for setting the MIDI-controller expressions later.
Save your work as Romance 1.cwp. This is the starting point for the methodology.
Step 2: change the note velocity
Start with Romance 1.cwp and save it as Romance 2.cwp.
This step requires normally a lot of manual work. However, I have created a program that will do
most of the work for you. This program Emphasis.cal sets the note velocity based on the
meter and the position in the measure. In addition, a small amount of random value is added to the
velocity. Select the track and run the program. I recommend as a first try to use the default input
values.
You have now finalized the second step. Listen to the result. It is probably still not what you really
want, but you will improve it later.
Save your work in Romance 2.cwp.
Step 3: remove doubles
Start with Romance 2.cwp and save it as Romance 3.cwp.
I created the original file by first editing a score. To be able to create a neat score the leading voice
notes and the first notes on each count of the triplets are duplicated. First, we have to remove this
duplication by deleting the one of the first notes of the triplets.
With SONAR a cal program UNDUPE.CAL is shipped that can do the work. The program asks
for a time window in ticks. A too small time window may leave duplicates. Use the Event list for
checking the removal of all duplications. However, after removing the duplicates the reading of the
staff view may become more difficult. This is depending on either the short or the long double note
has been removed.
Save your work as Romance 3.cwp.
Step 4: randomize the timing
Start with Romance 3.cwp and save it as Romance 4.cwp.
In music performance, notes are not played exactly in time. Therefore, we will randomize the
timing.
Select the track and run the CAL program Random time.cal
7
. Use a small number between 30
and 50, if you have the Ticks per quarter-note on 960. Too much randomizing makes it less
natural.
Save your work as Romance 4.cwp.
Step 5: ad expression
Start with Romance 4.cwp and save it as Romance 5.cwp.
We will now use the notation expressions as reminder where to insert controller 11 (expression)
messages. These MIDI-controller expressions will bring velocity changes in the performance. We
will use the CAL program Expression.cal for inserting expressions. For mf fill in 100 as value,
for mp fill in 90, and for p fill in 80. For the diminuendo, you fill in the start value e.g. 100, and an
end value e.g. 90. All according to the expressions related to the diminuendo. For the beat value,
you fill in one, and then the program inserts an expression at every beat.

7
This program is delivered with Cakewalk.
SONAR MIDI-Kit Guide.doc 21/47

Ton Valkenburgh

Save your work as Romance 5.cwp.
Step 6: make the tempo changes
Start with Romance 5.cwp and save it as Romance basic.cwp.
You will now create the MIDI-controller tempo changes
8
for which we have put information in the
score. You can use the Insert Series of Tempos of do it step by step. On each measure count, you
set a new tempo. End the end of the piece you must make relative big tempo decreases to get the
right close of the piece. Listen and check whether you feel it sounds right.
Now comes the more difficult part of tempo changes. A musician makes very small changes in
tempo during a performance. You will only notice the lack of these tempo changes. These changes
differentiates between computer music and human performance. Keep in mind what has been
stated in Time. Small changes of one per quarter note are mostly enough.
Play Romance, listen carefully, and make the changes where you think they must be.
When you are satisfied: save your work as Romance basic.cwp.
Epilogue
You have created the basic MIDI-file. The above-mentioned steps are the base steps for all
instruments. Due to tool restrictions the sequence of the steps are important. The program
Emphasis.cal must always be used before you randomize the timing of the notes.
In the next chapter, we will go through the modifications for specific music instruments. If you
have build up more experience you will probably combine steps of this chapter with steps in the
next chapter.

8
I am working on a program for doing most of the work. However, CAL is lacking the feature for making tempo
changes. Therefore, I am working on an alternative approach.
SONAR MIDI-Kit Guide.doc 22/47

Ton Valkenburgh

Modifications for specific instruments
The basics for the acoustic guitar
Prologue
The acoustic guitar has some specific characteristics. The player does not always control the length
of the note. Mostly the length is determined by the natural dying out of the vibration of the string.
However, if the notes are played on one string the lengths of a note is determined by the next note
in sequence.
The most realistic sound for acoustic plucked instruments is to use a channel for each string, and
set the mode of each channel on monophonic. The consequence of this is, that you must know on
which string the note is played. In most cases, this means that you must have experience in playing
the specific instrument. In addition, the notes must have a longer duration than you will normally
see in the staff. We will use the MIDI-controller 72 (Release time) to get the normal dying-out.
In The Spanish guitar other approaches are mentioned too. The advantage of using the release
time is that you have full control over the dying-out time.
For those of you who do not have experience in playing the instrument, using a different channel
for each voice is a good alternative. However, depending on structure of the music the result may
be less realistic.
Step 7a: change the timing of the bass and chords
Start with Romance basic.cwp and save it as Romance 7.cwp.
Due to randomizing of the timing some notes will be played too early compared to the other
notes. The bass voice should always come a little bit earlier than the leading voice. Make the
adjustments manually and ensure the bass notes will be played about 25 to 70 ticks
9
earlier than
the note of the leading voice. You can make these changes in the staff or event list view. For the
time being, leave the chords as they are.
The notes of the chords must also from low to higher come a little later. Each following note
should come about
1
/
64
note duration later. This gives the right arpeggio. Use the program
Arpeggio.cal for creating the arpeggios. Make sure you only mark the notes of the chord. Use a
shift value of
1
/
64
note, and the default (10 %) for the shift variation. For the closing chord, I
recommend a shift value of
1
/
32
note.
The staff view will become a little bit messy, but that is normal by making the performance more
natural.
When playing you should hear the bass just a little earlier than the leading voice. The chords
should sound like a fast arpeggio, with exception of the last one.
However, it is still not, what you want to hear, but it should sound better.
Save your work as Romance 7.cwp.
Step 8a: give each string a channel
As example, use Romance 7.cwp as input, and save it as Romance 8.cwp.
Because I know the guitar very well, I will use six channels - one for each string. Start with the
highest E-string, and give it channel 1.

9
This is the value if you have selected 960 Ticks per quarter-note.
SONAR MIDI-Kit Guide.doc 23/47

Ton Valkenburgh

With CAL program Note channel.cal, we set each note channel to its related string. Use the score
for determining the fingering. You mark all notes for a specific channel, and change the channel
value.
If you are not familiar with playing the guitar you can set a channel to each voice. That means you
will have four channels in this example. You can divide the chords across the four channels.
Save the result as Romance 8.cwp.
Step 9a: change track properties
Start with Romance 8.cwp basic as input, and save it as Romance 9.cwp.
First, you copy in the event list for each channel the expression MIDI-controllers for channel 1 in
the whole sequence, and adapt the channel numbers from 2 to 6.
Second, you insert at the beginning of the sequence for each channel the controller MONO
(controller number 126) with the value 0.
Third, you insert after the MONO controllers for each channel the release time controller
(controller number 72) with value 87.
10

Fourth, you insert panoramic MIDI-controllers (controller number10) with a value of 64.
Fifth, you insert at the beginning of the sequence for each channel the bank (11206) and patch
(130). Ensure that in the sequence the bank and patch are set before the other controllers.
Now, you go to the track view and set channel, bank, and patch to none in the track properties.
If you still have double notes in your sequence, you will hear it immediately. If you hear them,
remove them manually.
Save the result as Romance 9.cwp.
Step 10a: ad fret noise
Start with Romance 9.cwp as input, and save it as Romance 10.cwp.
It is almost impossible to play the guitar without some fret noise. Therefore, you have to add some
fret noise where you can expect it.
Add a track 2, and select Bank: Roland GM 2 tones-0, Patch: Gt fretNoise. Select for the
channel number 7. You now need to determine where fret noise is appropriate. Where the barring
moves from the fifth position to the seventh position is a good place to add fret noise. In addition,
where the same finger position changes on the same string is a good place too. However, note that
the three high nylon strings do not produce fret noise. Do not over do it. I have only added in four
places fret noise.
Save the result as Romance 10.cwp.
Step 11a: set chorus and reverb
Start with Romance 10.cwp and save it as Romance 11.cwp.
To get a more natural sound we will add some reverb (MIDI-controller 91) and chorus (MIDI-
controller 93). An amount between 30 and 50 for reverb and 50 for chorus should be enough. Add
the same amount for all 6 channels, and do not forget to give channel 7 in track 2 also the same
amount of reverb.
Save your work as Romance 11.cwp.

10
The choice in release time is very dependent on the used synthesizer.
SONAR MIDI-Kit Guide.doc 24/47

Ton Valkenburgh

Step 12a: fine tuning
Start with Romance 11.cwp basic as input, and save it as Romance.cwp.
Now listen carefully and if needed - fine-tune the balance between the leading voice, the triplets
and the bass. Do it by changing the expressions for the relevant strings. Also, listen if you hear
glitches. Glitches can be the result of a wrong channel number of the next note or double notes.
Correct them if you hear them.
The result should be a nice performance of the music piece.
Save the result as Romance.cwp.
Epilogue
As you have discovered, you have to do a lot of editing, listening, and correcting to get a realistic
performance.
As mentioned above it is easier to give each voice its own channel. In this approach, you must also
use each channel in mono mode. Because there are three notes in the chords, I have used four
channels. I have used channel 4 for the bass line. To let you hear the difference between the two
approaches you can listen to Romance (4 channels).cwp. Due to the nature of this piece of music,
you will hardly notice the difference.
I have given two methods for the plucked strings instruments. I recommend for solo guitar the first
approach - with six channels. The second approach - with a channel for each voice - is very suitable
for a guitar in a small combo. With more instruments, the sound is less critical for each specific
instrument.
More for the acoustic guitar
Prologue
I will now show more playing techniques for the guitar. I will use a very well known song
Beautiful dreamer. You can find the examples in Beautiful dreamer.zip. We will first change
the guitar part of this arrangement for violin and guitar. For track 1 select channel 1, port: Roland
RD-700, bank select method: normal, bank: 11204-Roland RD-700 Strings, and patch:
ChamberSect.. For track 2 select channel 2, port: Roland RD-700, bank select method:
normal, bank: 11206-Roland RD-700 GTR/Bass, and patch: Nylon Gtr 1.
Go now through step 1, 2, 4, 5, and 6 to create a basic MIDI sequence for the guitar track. You
save the last file as Beautiful dreamer basic.cwp.
Step 7b: change the timing of chords
Start with Beautiful dreamer basic.cwp as input, and save it as Beautiful dreamer 7b.cwp.
Use the Arpeggio.cal program to make the arpeggios. In the intro, intermezzos and finale you can
shift a note length of
1
/
64
. In the accompaniment part of the guitar I recommend a shift of
1
/
128
note
length.
Save the result as Beautiful dreamer 7b.cwp.
Step 8b: give each string a channel
Start with Beautiful dreamer 7b.cwp basic as input, and save it as Beautiful dreamer 8b.cwp.
Allocate channel 2 to the notes on the highest string and 7 to the notes on the lowest string.
Save the result as Beautiful dreamer 8b.cwp.
SONAR MIDI-Kit Guide.doc 25/47

Ton Valkenburgh

Step 9b: change track properties
Start with Beautiful dreamer 8b.cwp basic as input, and save it as Beautiful dreamer 9b.cwp.
First, you copy in the event list for each channel the expression MIDI-controllers for channel 2 in
the whole sequence, and adapt the channel numbers from 3 to 7.
Second, you insert at the beginning of the sequence for each channel the controller MONO
(controller number 126) with the value 0.
Third, you insert after the MONO controllers for each channel the release time controller
(controller number 72) with value 87.
Fourth, you insert panoramic MIDI-controllers (controller number10) with a value of 32.
Fifth, you insert at the beginning of the sequence for each channel the bank (11206) and patch
(130). Ensure that in the sequence the bank and patch are set before the other controllers.
Now, you go to the track view and set channel, bank, and patch to none in the track properties.
Save the result as Beautiful dreamer 9b.cwp.
Step 10b: set the legato slurs
Start with Beautiful dreamer 9b.cwp basic as input, and save it as Beautiful dreamer 10b.cwp.
Mark the notes on one legato slur and run Legato FS.cal . This will give the hammering effect,
like legatos are played on the guitar. The RD-700 uses the Legato Foot Switch. If your synthesizer
also supports the feature I recommend to insert these controllers. Ensure that the marked notes are
in the same channel. You will get an error message if they are not in the same channel.
Save the result as Beautiful dreamer 10b.cwp.
Step 11b: ad fret noise
Start with Beautiful dreamer 10b.cwp basic as input, and save it as Beautiful dreamer 11b.cwp.
Add a track 3, and select Bank: Roland GM 2 tones-0, Patch: Gt fretNoise. Select for the
channel number 8. You now need to determine where fret noise is appropriate. Where the finger
position changes on the same string you very often hear fret noise. However, note that the three
high nylon strings do not produce fret noise. Do not over do it.
Save the result as Beautiful dreamer 11b.cwp.
Step 12b: set chorus and reverb
Start with Beautiful dreamer 11b.cwp as input, and save it as Beautiful dreamer 12b.cwp.
To get a more natural sound we will add some reverb (MIDI-controller 91) and chorus (MIDI-
controller 93). An amount of about 30 for reverb and 50 for chorus should be enough. Add the
same amount for all 6 channels, and do not forget to give channel 8 in track 3 also the same amount
of reverb. Make the pan setting for track 3 the same as for the track 2.
Save the result as Beautiful dreamer 12b.cwp.
Epilogue
The guitar part is now ready. Fine-tuning will be done after finishing the violin part of this
sequence.
SONAR MIDI-Kit Guide.doc 26/47

Ton Valkenburgh

The violin
Prologue
The violin will mostly be used as a monophonic instrument. However, in MONO mode some
synthesizers like the RD-700 produces a very clear cut off of the notes. Therefore, I do not use
the MONO mode for legato with the RD-700. For legato slurs (phrasing bows) I will use the RD-
700 in POLY mode.
Again, I will use the song Beautiful dreamer. You can find the examples in Beautiful
dreamer.zip. We will now modify the violin part of this arrangement for violin and guitar.
We will start with Beautiful dreamer 12b.cwp, and go through the basic steps 2, 4 and 5. Store the
result in Beautiful dreamer 5c.cwp.
Step 7c: set the legato slurs and switch between MONO and POLY
Start with Beautiful dreamer 5c.cwp basic as input, and save it as Beautiful dreamer 7c.cwp.
We must ensure that the notes under the legato slur has exactly the length of the time difference
between tow sequential notes. Mark the notes indicated by a slur, and run the program Legato
FS.cal FS.. Use as percentage 100%, and set the Foot Switch value at 0 (OFF). Mark the first
note after the slur and insert here with the program Controller.cal the controller MONO (126)
with value 0. Mark the note of the next slur and insert with the program Controller.cal the
controller POLY (127) with the value 0. Now you mark all the notes under the slur and repeat the
previous steps. You do this for the whole violin track. If you have sequential slurs, you handle
them separately, because the last note under a slur will be shortened by the program to 90% of its
original duration. However, you do not need to insert a POLY controller before each slur.
You may have a glitch if the previous note duration exceeds the start of the next note and an
MONO or POLY controller has been inserted. Shortening the first note will solve the problem.
Save the result as Beautiful dreamer 7c.cwp.
Step 8c: set the staccatos
Start with Beautiful dreamer 7c.cwp basic as input, and save it as Beautiful dreamer 8c.cwp.
Now we set the staccatos in measure 42 through 44. Mark the notes with staccato indication and
run program Note duration.cal . Fill in as duration 50 %, and as velocity 115 %.
Save the result as Beautiful dreamer 8c.cwp.
Step 9c: set the glissando
Start with Beautiful dreamer 8c.cwp basic as input, and save it as Beautiful dreamer 9c.cwp.
Mark the d-note for the glissando, and run the program Glissando.cal. Fill in for the grace note
value: 83, and for the glissando duration 60. Listen to the result, and if needed correct the glissando
duration
11
in the event list.
Save the result as Beautiful dreamer 9c.cwp.
Step 10c: set the chorus, reverb, resonance and pan
Start with Beautiful dreamer 9c.cwp basic as input, and save it as Beautiful dreamer 10c.cwp.
Insert at the beginning of track reverb (controller 91) with a value of 30, and a chorus (controller
93) of 70. Set the pan value on 96. Insert a resonance (controller 71) with a value of 70.

11
The glissando duration is very dependent on the synthesizer.
SONAR MIDI-Kit Guide.doc 27/47

Ton Valkenburgh

Save the result as Beautiful dreamer 10c.cwp.
Step 11 c: fine tuning
Start with Beautiful dreamer 10c.cwp basic as input, and save it as Beautiful dreamer.cwp.
Now listen carefully to the result and make changes where you are not happy with the result. Bring
some changes in the tempo where appropriate. Think about the tempo changes, reverb settings, pan
settings, expressions etc. E.g. set the resonance on 64 in the accompanying part of the violin.
The attack time of the violin like all bowed instruments - slower than the attack time of a guitar.
Normally a violin player compensates for that by starting slightly earlier. Therefore, we will shift
the violin part slightly by sliding it with -50 ticks to create the same result. Ensure making of all
events. Use the event list for marking what needs to be shifted.
The result should be a nice sounding performance.
Save the result as Beautiful dreamer.cwp.
Epilogue
Even with the tools you still have to do a lot of editing, listening, and correcting to get a realistic
performance.
Note that with another synthesizer you may have to use different values for the parameters.
The violin has many playing techniques. These techniques are difficult to simulate with just one
kind of sample, like we have just done. Software synthesizers give a lot of flexibility with regard to
using different samples for one instrument, and therefore give you better possibilities to simulate an
instrument like the violin.
However, with software synthesizers the above used methodology can be very useful too.
The Flute
Prologue
As example, we use a Gavotte for flute and guitar from Hndel (Gavotte (Haendel).zip). We
show you how to handle the specific characteristics of the flute. In the music score, you can see the
phrasing for the flute. Out of this score, we created the MIDI file: Gavotte (Haendel) initial.wrk.
In this file, we have already indicated the expressions, and with apostrophes where the player
catches breathe.
You need to go through the steps of Creating the basic MIDI-file first and save the result as
Gavotte (Haendel) basic.cwp. You can safe work by already taking into account the phrasing
slurs. In step 3, you let the velocity of the notes connected with a phrasing slur decrease a little.
You go first through the steps for the flute and secondly for the guitar. In step 3 for the guitar you
balance the note velocity of high and low voice. In addition, you balance the sound between flute
and guitar. You can here also use the volume
12
control.
Skip step 4. In step 5, you randomize the timing of the flute with about 50 ticks. For the guitar
part, you randomize with the value of 70.
In step 6, you insert the MIDI-controllers for expression on both channels.
In step 7, you change the tempo where you think it is appropriate. Where a part is ended, you can
decrease the tempo.

12
The volume control does not influence the timbre of the sound like: velocity and expression.
SONAR MIDI-Kit Guide.doc 28/47

Ton Valkenburgh

In step 8, you set reverb on 30 for both channels. You also determine the stereo position for the
flute and the guitar.
Save your work as Gavotte (Haendel) basic.cwp.
Step 9b: ad the moment to catch breath
Start with Gavotte (Haendel) basic.wrk and save it as Gavotte (Haendel) 9.cwp).
Until now, we did not give the flute player any moment to catch his breath.
We will now change the duration of the note to 85 % of the original duration at the places, we
indicate for catching breath. You can use the CAL program Note duration.cal to perform this on
marked notes. You can mark a couple of notes by holding the shift key during marking.
Listen carefully and make it sound naturally.
Save your work as Gavotte (Haendel) 9.cwp.
Step 10b: Ad the phrasing
Start with Gavotte (Haendel) 9.wrk and save it as Gavotte (Haendel) 10.cwp).
A flute is a monophonic instrument, and we will use some features of the Roland RD-700, which
only work if the channel is monophonic. Therefore, insert in the beginning of the sequence for the
flute the MIDI-controller MONO.
Create the trills
With tr, we have indicated where trills (shake) must be played. We will now create them. You can
use the CAL program Trill.cal. We mark the note, chose for modulation +2, and process it.
Notice that Cakewalk will show in the staff the note duration of the modulation twice as long as the
modulation note really is. Therefore, do not get confused by what you see in the staff.
Staccato
You cut the staccato notes about into halve of the length. However, you must also increase the
velocity to about 115 % to get about the same loudness impression. Again, the Note duration.cal
program helps to do this quickly. Mark all staccato notes by marking them one by one while
holding the shift key.
Differentiate between normal and legato style
For the flute part all notes with exception of the breath moments and the staccato notes have a
legato style. A note starts the same moment that the previous note stops. This is not the normal
playing style for the flute.
First, process the notes, which are connected with a legato bow. Use the Legato FS.cal CAL
program for this. This program ensures a small overlap of the notes, put the synthesizer in
LEGATO mode, and creates a legato effect for the marked notes. Mark the notes connected with
one legato bow, and process them. Now shorten the other notes to about 90 % to get some
difference between portato and legato. You must hear a slight difference between legato en normal
play, but make the difference not too big.
Save your work as Gavotte (Haendel) 10.cwp.
Step 11b: fine tuning
Start with Gavotte (Haendel) 10.wrk and save it as Gavotte (Haendel).cwp).
Now listen carefully to the result and make changes where you are not happy with the result. Bring
some changes in the tempo where appropriate.
The focus in this exercise was on the flute, and less on the guitar.
SONAR MIDI-Kit Guide.doc 29/47

Ton Valkenburgh

For the guitar, we recommend the process as described in The basics for the acoustic guitar.
Probably the sound of the guitar is now to loud, and you have to adjust this by either the
expressions or the volume. Do not forget to insert panoramic controllers.
The attack time of the recorder is like all wind instruments - slower than the attack time of a
guitar. Normally a flute player compensates for that by starting slightly earlier. Therefore, we will
delay the guitar part slightly by sliding it with +50 ticks to create the same result.
Now bring some expression in the music. Give some accents for the first beat in the measure for
the recorder, and make the guitar livelier by using the expression MIDI-controllers in certain parts.
Save your work as Gavotte (Haendel).cwp.
Epilogue
Also with the flute you have many playing techniques. So you also run into the limitations of using
one kind of a sample.
We have not shown the possibility to add all kind of playing noises like with the guitar. You can
experiment with it yourself.

SONAR MIDI-Kit Guide.doc 30/47

Ton Valkenburgh

Example MIDI-files
The example files consist of a score (in pdf format), an initial file (in MIDI format 1)
13
, and result
files (in cwp format, and MIDI format 1).
Romance.zip
An anonymous piece for guitar. A haunting melody, which helps to show you some aspects of
creating MIDI-files.
Romance.pdf The music score
Romance initial.mid The initial file created with Musicator
Romance basic.cwp
Romance basic.mid
The result of the steps for creating a basic
MIDI-file.
Romance.cwp
Romance.mid
The result of adding the characteristics of the
guitar by using a channel for each string
Romance (4 channels).cwp
Romance (4 channels).mid
The result of adding the characteristics of the
guitar by using a channel for each voice.
I have included the examples of all steps too.

Beautiful dreamer.zip
An anonymous song, arranged for violin and guitar.
Beautiful dreamer.pdf The music score
Beautiful dreamer initial.mid The initial file created with Cubase Notation.
Beautiful dreamer basic.cwp
Beautiful dreamer basic.mid
The result of the steps for creating a basic
MIDI-file.
Beautiful dreamer.cwp
Beautiful dreamer.mid
The result of adding the characteristics of the
violin and guitar.


Gavotte (Haendel).zip
A piece from Georg Friedrich Hndel for recorder and guitar. Here we show the difference of the
recorder, and guitar sound aspects.
Gavotte (Haendel).pdf The music score
Gavotte (Haendel) initial.mid The initial file created with Cubasis Notation
Gavotte (Haendel) basic.cwp
Gavotte (Heandel) basic.mid
The result of the steps to create a basic MIDI-
file.

13
The MIDI files are not General MIDI files; the banks and patches are those of the Roland RD-700.
SONAR MIDI-Kit Guide.doc 31/47

Ton Valkenburgh

Gavotte (Haendel).cwp
Govotte (Haendel).mid
The result after adding the specifics of the
instruments.

SONAR MIDI-Kit Guide.doc 32/47

Ton Valkenburgh

Cakewalk Application Language Programs
Short descriptions
Arpeggio.cal
Purpose Creates arpeggio out of a marked chord.
Usage First, you select the notes of the chord, and then:
Run Arpeggio, and
Enter shift length in note value (
1
/
8
,
1
/
12
,
1
/
16
,
1
/
24
,
1
/
32
,
1
/
48
,
1
/
64
,
1
/
128
).
Enter shift variation in % (0 50).
Remarks The program shortens the notes with the same value as they are shifted. The shift
value is a little randomized.
MIDI-
functions
None.

Controller.cal
Purpose Inserts MIDI-Controllers in the marked area of one track.
Usage Option 1: Mark the note(s) and/or events in the staff or event list panel where the
controller(s) must be inserted:
Run Controller, and
Enter the Controller number (0 .. 127);
Enter the choice for single insert or multiple inserts (0..1);
Enter the value of the controller (0.. 127);
For multiple inserts enter the end value of the controller;
For multiple inserts enter the beat value (1 ..64).
Option 2: Mark the range where you want to insert the controllers:
Run Controller,
Enter the Controller number (1..127),
Enter the requested start value (0..127),
Enter the requested end value (0..127),
and beat value (1..64).
The beat value indicates how the controllers will be inserted. The program
calculates the insert time by dividing the beat with the entered value.
Remarks The program will use marked existing controllers in the sequence for prompting
default values. The existing controller will be deleted, and replaced by the new
values.
The program can handle multiple channels in one track.
SONAR MIDI-Kit Guide.doc 33/47

Ton Valkenburgh

Controller.cal
MIDI-
functions
Dependent on the used controller.

Emphasis.cal
Purpose Modifies the velocity of the notes based on the meter, and the position in the
measure. A random delta is added to make it more realistic.
Usage First, you select the track or notes you want to emphasize.
Run Emphasis, and enter:
Reference velocity (the velocity on which the new velocities are based),
values between 1 and 127;
Strength of emphasis, values between 1 and 20;
Random delta (the maximum percentage of the random value), values
between 0 and 15.
Remarks Based on a table the program will generate a note velocity, which fits within the
meter, and position in the measure. Therefore, the program is very sensitive to the
position of the notes.
Supported meters:
2
/
2
,
3
/
4
,
4
/
4
,
6
/
8
and
9
/
8
.
Multiple meters in a sequence are supported.
MIDI-
functions
None.

Expression.cal
Purpose Inserts MIDI-Controller expressions in the marked area of one track.
Usage Option 1: Mark the note(s) in the staff or list panel where the expression must be
inserted:
Run Expression, and
Enter the choice for single insert or multiple inserts (0..1);
Enter the expression value;
For multiple inserts enter the end value;
For multiple inserts enter the beat value (1 .. 64).
Option 2: Mark the range where you want to insert the crescendo or diminuendo:
Run Expression,
Enter the requested start value (0..127),
Enter the end value (0..127),
Enter the beat value (1..64).
The beat value indicates how the expressions will be inserted. The program
SONAR MIDI-Kit Guide.doc 34/47

Ton Valkenburgh

Expression.cal
calculates the insert time by dividing the beat with the entered value.
Remarks The program will use marked existing expressions in the sequence for prompting
default values. The existing expressions will be deleted, and replaced by the new
values.
The program can handle multiple channels in one track.
If an diminuendo of crescendo is created, the emphasis program will be called to
let the user correct the dynamics in the note velocity.
MIDI-
functions
Controller number 11: Expression

Glissando.cal
Purpose Creates a glissando on a selected note.
Usage First, you select the note, and then:
Run Glissando, and
Enter grace note value
14
(start of the glissando);
Next you enter the glissando duration.
Remark The choice of the glissando duration is very dependent on the synthesizer.
MIDI-
functions
Controller number 5 (Portamento time) and controller number 84 (Portamento
control).

GM Mode.cal
Purpose Switches the GM mode of the synthesizer.
Usage Run the program:
Enter the GM Mode: GM1=1, GM2=2, GM off=0.
Remark
MIDI-
functions
System exclusive message

Legato FS.cal
15

Purpose Changes the length of the notes to close gaps between sequential notes and
optional inserts MIDI-Controller Legato Foot Switch ON at the beginning of the
marked area, and Legato Foot Switch OFF at the end of the market area.

14
The prompted default value is the value of the selected note.
15
In earlier versions of the MIDI-Kit, I used the filename Legato.cal. I discovered that SONAR already has a
sample CAL program LEGATO.CAL, and therefore I changed the name of the MIDI-Kit program into Legato
FS.cal, because this program allows the optional use of the legato foot switch controller.
SONAR MIDI-Kit Guide.doc 35/47

Ton Valkenburgh

Legato FS.cal
15

Usage Mark the range of which notes must performed as legato;
Enter the requested percentage for the notes (100..150)
16

Select usage of Legato Foot Switch or not.
Remarks Depending on the synthesizer: the channel must be set in MONO mode if the
Legato Foot Switch is used.
The MIDI-controller 68 (Legato Foot switch) has no influence on GM voices of
the Roland RD-700.
MIDI-
functions
Optional: Controller number 68: Legato Foot switch.

Note channel.cal
Purpose To set all marked notes to a specific channel value.
Usage Mark the notes;
run Note channel;
input the desired channel (1..16).
Remark None
MIDI-
functions
None.

Note duration.cal
Purpose Changes note duration based on user input;
Changes note velocity based on user input.
Usage Mark the notes;
run Note duration;
input the desired percentage of the duration (25..125)
and velocity (0..150).
Remarks Use for:
Staccatissimo: a duration of 25 %, and a velocity of 125 %;
Staccato: a duration of 50 %, and a velocity of 115 %;
Portato: a duration of 75 %, and a velocity of 100 %;
Legatissimo: a duration of 125 %, and a velocity of 100 %.
MIDI-
functions
None.

16
With 100% the gap between two sequential notes is exactly filled. Higher percentages will create some
overlap.
SONAR MIDI-Kit Guide.doc 36/47

Ton Valkenburgh


Note velocity.cal
Purpose To set marked notes to the same velocity.
Usage Mark the notes;
run Note velocity;
input the desired velocity (0..127).
Remark None
MIDI-
functions
None.

Random time.cal
Purpose Randomize the timing of the notes of a selected track.
Usage Select the track;
run Random time;
input the desired time range in ticks.
Remarks This program is part of the Cakewalk CAL programs delivered by Cakewalk.
Carefully to be used, if you overdo it the result may be awful.
MIDI-
functions
None.

Timebase.cal
Purpose Displays the TIMEBASE in number of ticks per quarter note.
Usage Run the program.
Remark None.
MIDI-
functions
None.

Trill.cal
Purpose Creates a trill (shake) on the indicated note.
Usage Mark one to be trilled note:
Run Trill;
Enter the desired modulation in semitones (-2 ..+2);
Enter the desired modulation note length (16, 32, 64).
SONAR MIDI-Kit Guide.doc 37/47

Ton Valkenburgh

Trill.cal
Remarks The channel must be in MONO mode.
Cakewalk will show in the staff the note duration of the modulation longer than
the real length of the modulation note. The event list shows the right value.
MIDI-
functions
Controller number 68: Legato Foot switch.

MIDI-Kit error messages
MK001: Program error in <program>
This message indicates that an internal error occurred in the mentioned CAL program- Please
report this to the support mail-id: midi-kit@wanadoo.nl.
MK002: This program requires CAL version X
The CAL program will only run under CAL version X.
MK003: This program requires CAL version X or higher
The CAL program requires at least CAL version X.
MK004: No event marked, process termindated
The CAL program could not process any event, because no event has been selected.
MK005: No note marked, process terminated
The CAL program could not process any note, because no note has been selected.
MK006: At least two notes must be marked, process terminated
The CAL program could not process any note, because at least two notes must be selected.
MK007: Unsupported meter X/Y
The CAL program does not support sequences with the meter
X
/
Y
.
MK008: No notes marked at different positions, process terminated
The CAL program could not proceed, because no notes have been detected with a different position
in the time sequence.
MK009: Notes are not in the same channel, process terminated
The CAL program detected marked notes, which are not in the same channel.
MK010: More than one note marked, process terminated
The CAL program detected more than one selected note, and therefore could not proceed.
SONAR MIDI-Kit Guide.doc 38/47

Ton Valkenburgh

MK011: (Only) one note must be marked, process terminated
The CAL program detected that more than one note has been selected.
CAL error and fyi messages
Before CAL even starts to run a program, it goes through and makes sure the code is correct
enough to convert into machine instructions. If there are errors that prevent the program from being
interpreted, CAL stops there and issues a message. Until now, nothing has been done to the
sequence. On the other hand, if the code can be at least interpreted, then CAL starts running it. If
there is an error at a certain point in the program, CAL may very well have already done something
to your sequence and so an Undo will be necessary to return the status quo before you attempt to
fix and run the program again. To be safe, if a CAL program doesnt perform exactly as expected,
perform as many Undo operations as necessary to erase all actions taken by CAL.
Another approach is to save your sequence, and then run the CAL program. If there is an error use
the Escape key and reload your sequence without saving the damaged one.
This list may not be complete, may contain errors that dont belong to CAL and may not reflect the
full range of error messages available to later versions of Cakewalk. However, with no
documentation (as is true with a great deal of CAL) and my own experience torturing CAL, this is
what I have come up with.
Attempt to change constant
Naturally, you cannot re-assign the value of a constant like NOTE or a read-only variable
TIMEBASE, and attempting to do so leads to this error. As a rule, constants in CAL are in all caps
to make them easy to distinguish from variables.
CAL Error 001: Syntax error
CAL understands your words, but not the way you have them arranged. Perhaps you have confused
a keyword with a variable or arranged the components of a statement incorrectly.
CAL Error 002: Divide by zero
Needless to say, if you ask CAL to divide by zero, it wont be happy. Rather than give your
processor a coronary trying, CAL traps such equations and issues this error message.
CAL Error 003: Wrong number of arguments function_name
17

Unless you genuinely left out an argument in a statement, this error is usually caused by not having
the closing parenthesis of a nested section of code in the proper spot. You likely have the
parenthesis somewhere; otherwise you would receive a Missing one or more closing parentheses
error. Maybe you just put it in the wrong place and so now some if function has a then, an else and
a stray extra part, or a mathematical statement is being asked to operate on three arguments instead
of two.
CAL Error 004:Unknown procedure procedure_name
Several things can cause this. You may have mistyped a keyword. Perhaps you have two statement
elements running together without a space between them like (+this that) instead of (+ this that).
Misarranged parentheses or sets of parentheses without a space between them will also cause this
error. Basically, CAL cannot understand some word in your code.

17
If the error is within a menu function you will not get the funcion_name.
SONAR MIDI-Kit Guide.doc 39/47

Ton Valkenburgh

CAL Error 014: Value out of range
This error message lets you know that you have attempted to generate a value that exceeds the
range of the variable. Keep in mind that even though an integer can hold a certain value, the
variables relating to your sequence may not. E.g. a Note.Key must be between 0 and 127.
CAL Error 022: User pressed cancel
This is not an error either, but confirms that CAL has intercepted the user pressing the Escape
key or clicking a Cancel box from a dialog box and is therefore shutting down.
CAL Error 023: Cannot open include file file_name
CAL cannot find the file you have asked to be included in a program. This is likely because of a
mistyped file name or because the file in question is in a directory other than the one where CAL is
looking. CAL will look in the directory where the currently running program is stored if no path is
specified. If a full path is given, CAL will look there instead.
Cannot load Dynamic Link Library
You have asked CAL to use a service from a DLL file, but CAL cannot find the file. The causes
are the same as listed above.
Command is disabled on the menu
Here, you have asked CAL to perform a Menu function that is currently greyed out in the menus
drop-down list such as attempting to do an EditPaste with nothing in the clipboard.
Evaluation stack overflow
There is a limit on not only how complex a line of code can be, but also on how many nest levels
you can build in one function. If you keep nesting if after if after do after do, sooner or later you
will get this error. Having too many variables declared, will also generate this response.
Expression too complex
It is one thing to try to be efficient by putting as much code into one function as possible. It is
something else entirely to build expressions that are so compound that CAL cannot run them. Do
not try to do everything in one line of code. Use the nest maker do if you need to do much in one
argument or having a large number of functions at the same level.
Expected closing quote
This is plane enough. If you use quotes to enclose a string or a message, then forgetting one or
more of them will cause this error.
Miscellaneous error
Ive never seen this, but I guess if you stump CAL completely, you may receive it.
Mismatched parentheses
Assuming you have the correct number of opening and closing parentheses, you may not have
arranged them properly. This error message tells you to re-examine your code for out-of-place
parentheses.
SONAR MIDI-Kit Guide.doc 40/47

Ton Valkenburgh

Missing one or more closing parentheses
This is the message you are likely to see most often. CAL counts the number of left brackets and
right brackets in your program, and if the numbers do not match, you get this error. Not getting this
error does not guarantee that your parentheses are on the right places, just that the counts match.
You can also get this error by not having 2 line feeds following the last closing parenthesis at the
end of your program.
Not valid in (forEachEvent) or body expression
This is the opposite of the above error. There are some things that you just cant do while CAL is
scanning a sequence. An example is attempting to run Edit menu functions during a loop.
Out of memory
I have never seen this error, and I have written some big programs. I guess a point can be reached
where you overflow the space CAL has to work with or insert so many new notes that your
sequence is too big to stay in memory. Go buy some more ram. Its just too cheap these days to be
caught with not enough memory to get a job done.
Proc does not exist in Dynamic Link Library
CAL found the DLL file all right, but you have supplied arguments that do not point to a valid
service within that file.
Program called (error)
If you set up a function to call the error function in the event of some condition, CAL will display
this message and then abort.
Program called (exit)
This message is not an error, but confirms that CAL has executed an exit function and is aborting.
Types do not match
If you try to use variables for functions unsuited for their type class, CAL will let you know. If you
attempt to place a negative number in a word variable or try to perform time functions on an
integer variable, you are likely to see this error.
Undef of undefined variable
If you attempt to execute the undef function to erase a variable from memory and there is no
such variable to begin with, you will see this error.
Unknown variable
Apparently you either attempted to use a variable name that hasnt been declared or you mistyped
the name of one that has.
Valid only in (forEachEvent) or body expression
The operation you are trying to perform can only be done within a forEachEvent loop. These are
things like the delete function.
SONAR MIDI-Kit Guide.doc 41/47

Ton Valkenburgh

Variable redefined
You have attempted to declare a variable that has already been declared. One way to get this error
is if you include a program that declares a variable with the same name as one declared in the
parent program. To keep this from happening, make it a habit to use different capitalization for
variables you declare in programs you intend to include in other programs.
SONAR MIDI-Kit Guide.doc 42/47

Ton Valkenburgh

Equipment
Interconnection
Personal
amplifier
Pre-amplifier
PC
Cassette recorder
Audio
USB
Audio
Audio Audio
Speakers
Stage Piano
Microphone
MIDI Audio
Guitar amplifier
Audio
Audio
USB
USB/MIDI
Audio
Hardware

Equipment Type Manufacturer Purpose
PC Scaleo 600 Fujitsu
Siemens
Storage and manipulation of the
recordings, production of CDs
Personal
amplifier
AP-U70 Yamaha AD / DA conversion, recording
inlet / outlet, main amplifier
Pre-amplifier QUAD 33 Quad Pre-amplifier
Microphone F-VX30 Sony Microphone
Cassette
recorder
AD-F300 AIWA Cassette recorder
USB/MIDI RoMI/O ESI USB-MIDI conversion
SONAR MIDI-Kit Guide.doc 43/47

Ton Valkenburgh

Equipment Type Manufacturer Purpose
Stage piano RD-700 Roland Digital piano and sound module
Guitar Mod 106 Raimundo Acoustic guitar
Guitar Epiphone SG Gibson Electric guitar
Guitar
amplifier
AVT100 Marshall Amplification of the electric guitar
Speakers Philips RH 544 Monitoring
Headphone HD 590
Prestige
Sennheiser Headphone
SONAR MIDI-Kit Guide.doc 44/47

Ton Valkenburgh

Software
Software Manufacturer Purpose
Windows XP
Home edition
Microsoft Operating system
Cakewalk
Sonar 3
Twelve Tone
systems
MIDI-sequencer and audio recording; editing
Cubasis
Notation
Steinberg AG Music score editing
Cool Edit Pro
version 2.00
Syntrillium Audio recording and editing; MP3 generation;
conversion to 16-bit for CD production
Musicator GS Musicator A/S Maintaining old music scores
Nero 7
Premium
Nero Cd/DVD production
Studio 10 plus
TE
Pinnacle Video creation
Yrec-24 Yamaha 24-bits recording with low CPU usage


SONAR MIDI-Kit Guide.doc 45/47

Ton Valkenburgh

Index
Cakewalk functions
TIMEBASE...............................................37
Error Messages
Attempt to change constant .......................39
Cannot load Dynamic Link Library ..........40
Cannot open include file............................40
Command is disabled on the menu............40
Divide by zero ...........................................39
Evaluation stack overflow.........................40
Expected closing quote..............................40
Expression too complex ............................40
Miscellaneous error ...................................40
Mismatched parentheses............................40
Missing one or more closing parentheses..41
Not valid in (forEachEvent) or body
expression..............................................41
Out of memory ..........................................41
Proc does not exist in Dynamic Link Library
...............................................................41
Program called (error) ...............................41
Program called (exit) .................................41
Syntax error ...............................................39
Types do not match ...................................41
Undef of undefined variable......................41
Unknown procedure ..................................39
Unknown variable .....................................41
User pressed cancel ...................................40
Valid only in (forEachEvent) or body
expression..............................................41
Value out of range .....................................40
Variable redefined.....................................42
Wrong number of arguments.....................39
MIDI functions
After touch.................................................11
After Touch ...............................................12
Attack ........................................................11
Attack Time.........................................11; 13
Breath ..................................................11; 13
Brightness............................................11; 13
Channel................................................24; 36
Controller ............................................27; 33
Damper ......................................................13
Decay.........................................................11
Decay Time .........................................11; 13
Duration.....................................................36
Expression .................. 11; 12; 19; 21; 28; 34
Filter Resonance..................................11; 13
GM Mode ..................................................35
HOLD 1.....................................................13
Legato........................................................35
Modulation Depth................................11; 12
Note duration.............................................27
Portamento................................................ 35
Portamento control.................................... 35
Release...................................................... 11
Release Time ...................................... 11; 13
Reverb....................................................... 24
Soft...................................................... 11; 12
Sostenuto............................................. 11; 12
Sustain....................................................... 11
Tempo....................................................... 22
Velocity................................... 11; 12; 19; 37
Vibrato ................................................ 11; 12
Vibrato Delay............................................ 12
Vibrato Depth ........................................... 12
Vibrato Rate.............................................. 12
Volume ............................................... 11; 12
Music terms
Arpeggio ....................................... 23; 25; 33
Attack time.......................................... 14; 16
Col crine.................................................... 13
Col legno................................................... 13
Crescendo ................................................. 12
Dtach ..................................................... 14
Diminuendo ........................................ 12; 21
touff ...................................................... 14
ff............................................................ 20
Flageolet ................................................... 15
Glissando ............................................ 15; 35
Golpeando................................................. 15
Legatissimo............................................... 36
Legato ............................... 14; 15; 26; 27; 29
Longitudinal vibrato ................................. 15
Melos .......................................................... 9
Mtallique................................................. 15
mf.................................................. 19; 20; 21
mp ....................................................... 20; 21
p............................................................ 21
Pizzicato.............................................. 13; 15
Portamento................................................ 15
Portato................................................. 29; 36
pp .............................................................. 20
Punteado ................................................... 15
Rasgueado................................................. 15
Sagittal vibrato.......................................... 15
Shake................................................... 29; 37
Staccatissimo ............................................ 36
Staccato............................................... 29; 36
Sul ponticiello........................................... 15
Sul tasto .................................................... 15
Tempo......................................................... 9
Transversal vibrato. .................................. 15
Tremolo............................................... 14; 16
Trill ......................................... 15; 16; 29; 37
SONAR MIDI-Kit Guide.doc 46/47

Ton Valkenburgh

Vibrato.......................................................15

SONAR MIDI-Kit Guide.doc 47/47