That's Simple! extensive program planning, Good coding practices, and thorough testing! Seriously, many of these CAL scripts were thrown together by people with perhaps good musical knowledge, but with no real programming experience.
Kevin, those screwy results you got could well have been due to the following peculiarity with Sonar & CAL:
In Sonar, if you do any editting on a sequence, then Sonar will store those edits in "clips" and use a internal scheme to keep track of the order of the various clips. I had origionally thought clips were solely for use with audio, but Sonar uses clips in midi sequences as well. This internal scheme bears no relation to what you see in the event list view. Everything looks & sounds like its where it should be, but internally, the events are stored in a way only Sonar sees. CAL sees things the way Sonar does, and so will process events seemingly out of sequence. It's only out of sequence by human standards, but its in perfectly logical sequence as far as CAL & Sonar are concerned. The solution is to do a "bounce to clips" on the sequence which will put sonar's internal schema into true sequential order. Of course, after bouncing the track, you need to re-select it again before running a cal script because cal only operates on selected data, and bouncing has the effect of de-selecting the track.
So, a good rule of thumb, if you're getting weird results from a CAL script, is to do a "bounce to clips" on the track and try again.
Some people believe that 12 tone systems is probably going to dump CAL from Sonar in the future. They've already taken the user interface out(CakeWalkProAudio used to have a CAL editor built-in and some debugging tools as well) , and there isn't any real support for it anymore. I hope they don't--that would be like taking jaws scripting language out of Jaws.
----- Original Message ----- From: "Kevin L. Gibbs" <kevjazz@xxxxxxx>
To: <ddots-l@xxxxxxxxxxxxx> Sent: Sunday, December 24, 2006 3:11 PM Subject: [ddots-l] Re: New functionality for Sonar
I tried to use strum once and the three notes I used were then spread among three staves. What prevents that? Kevin -----Original Message----- From: ddots-l-bounce@xxxxxxxxxxxxx [mailto:ddots-l-bounce@xxxxxxxxxxxxx] On Behalf Of Phil Halton Sent: Saturday, December 23, 2006 11:37 AM To: ddots-l Subject: [ddots-l] New functionality for Sonar Hello Listers, As you may or may not know, Sonar has a scripting facility called CAL (Cakewalk Application Language). CAL Scripts can be run from within Sonar and perform specialized tasks on Sonar data in ways that can't be achieved through the menu system commands. Its similar to how JAWS allows for scripts to be written to give additional functionality to JAWS--CakeTalking scripts for example. What follows is a brief description of one such CAL program. If there is any interest in this sort of additional functionality for Sonar, I could probably package it up and distribute it via a file sharing site-in the same way Chris Smart distributed his great tutorial collection. The CAL program I refer to is called "Strum" and I've been using it with good results, although its still technically in beta testing. Notes on use of the "Strum.cal" program this program alters chords in a selected region of a sequence in such a way as to simulate a strum effect--as though strumming a guitar. It recognizes a chord to be any set of two or more notes that reside at the same time line position. The maximum chord size it will handle is 6 notes. If it encounters more than 6 note events at the same time position, it will indicate the MBT position of the chord along with a message that the chord size is exceeded, and then terminate. Preparing the Sequence region: First, select the region you want to modify. Then run the CAL program--it will affect only the data selected. CAL programs are run by selecting Process|Run CAL from the sonar menu system. Then browse to the strum.cal file and press enter. A note of caution--it is important to first perform a "bounce to clips" on the selected region before using this CAL (or any CAL) program. The reasons have to do with the way sonar stores sequence data. Without getting in over my head on this, if you've done any editting on the sequence, then the data will most likely be stored in "clips", and clips will be out of sequential order. You won't notice it, but CAL will, and results will be very screwy. So, just get in the habit of doing a bounce to clips before running CAL programs. Also, you will need to re-select the region after the Strum program runs. This is because Strum actually erases the origional sequence and re-writes it as a new sequence in the same time region. CakeTalking will report that the region is still selected, but it will be unaware of the changes and the region it thinks it sees as selected is actually no longer in existence. So, simply press control enter again to re-select the region. Input Parameters supplied by the User Strum lets you alter three aspects of a chord; the span, or spacing of the notes in the chord, the velocities of the individual notes and the duration of each note in the chord. You can choose to alter any of the three aspects, singularly, or in any combination. That is, you could choose to pass over the selected sequence and set just the durations. Or, you could set the duration and velocities of the chord tones in one pass and another pass for tinkering with the span. However, once you set the span, you can no longer use Strum on the sequence because the chord tones will no longer occupy the same time position and thus, will no longer be chords from the program's point of view. So, setting the span should be the last aspect you change. In order to use Sstrum after setting the span, you must Quantize the sequence to re-align the chord notes to the same time position and span them again. If re-quantizing, you can retain any duration setting you've made by unchecking the "note durations" checkbox in the quantize dialog. Quantizing will have no affect on any velocity settings you've made. Sorting chord tones Before describing the input parameter screens, it should be noted that there is a fourth aspect of chords that can be controlled-- their sort order. If you look at a chord in the event list view, you'll notice that the notes are not necessarily in any specific order- low to high for example. Maybe you entered the notes as best you could on a keyboard, then quantized to align the notes to the grid. Whatever order you entered them - even if you thought they were pressed simultaineously, is the order they're going to stay in. This is of no consequence when chord tones are sounded in unison, but when you "Strum" the chord, those out-of-order notes will result in a peculiar sound--as if the instrument was strung incorrectly. Using Strum automatically sorts chord tones into ascending order. So, even if you choose not to enter values for span, velocity, or duration--seemingly doing nothing to the sequence--you will have by default, sorted the sequence's chord notes Now, there are three input screens that prompt you for parameters for the three aspects mentioned. In addition, if you enter a value in any of these screens, a companion screen appears that lets you set additional fine-tuning parameters. After the program completes execution, a screen appears summarizing the parameters you entered so you can get a better idea of what parameter settings result in what sound quality. The summary lists parameters as follows: SP=span, SC=span curve, V=velocity, VS=Velocity spread, D=duration, DT=duration trim The Input Parameter screens are as follows: 1) Span. This screen asks you for the number of ticks used to seperate each note of the chord. For example, entering 10 here would seperate each note in the chord by ten ticks. Guitar strums sound good at around 30 ticks. 2) Span Curve. This is the companion screen to the span parameter screen and asks for a number between 1 and 7. This "curve factor" is used to seperate each successive note by an additional amount in addition to the base span entered in the previous screen. A value of seven will cause no additional distance between notes and results in a linear spacing of chord tones. A value of six will increase the span of each successive note by an additional 16%. A value of five will increase the span of successive notes by 20%, four for 25%, three for 33%, two for 50%, and finally, one for 100%. Curving the span like this causes the latter notes to be spaced wider than the earlier notes of the chord--kind of like fanning a deck of cards. Experiment a bit with these curve factors--they take some of the mechanical sound out of the strum. 3) Set Velocity. This screen asks whether or not you want to "standardize" the velocities of the individual chord tones. You can enter a value from 0 to 127. A value of 0 will leave the velocities as they are. If you enter any other value, all note velocities in the chord will be set to that value. 4) Velocity Spread. In the Set Velocity screen, if you enter a velocity other than zero(which leaves the origional velocities intact), this screen will appear. It asks for a number of ticks between 0 & 10 that will be used to scale the individual velocities of the notes in the chord. First, each note is set to the base velocity specified in the Set Velocity screen. Then each note is scaled downward from that point. For example, entering 3 will scale down the velocity of the first note by a random number between 0 & 3. Then the next note will be scaled between 3 and 6, the third note between 6 & 9 and so on. entering zero in this screen will skip the scaling process and set all notes to the specified base velocity. 5) Duration. In this screen you can set a duration for the chord tones. A value of 0 will leave note durations unaffected. Values from 1 to 3860 will set the duration of each note in the chord to that number of ticks. The value 3860 is the equivalent of four quarter notes with a project time base of 960PPQ(PartsPerQuarternote). For an example, if you set this field to 1440, it will set all chord tone durations to 1 and a half quarter notes. Keep in mind your project's PPQ setting when setting this input field. Also, a calculator might be useful at first in determining tick to note conversions. 6) Duration Trim. This last input screen lets you set a maximum value for a random trimming of each note's duration. Setting this value to 50, for example, will trim from each note's duration, a random number of ticks in the range of 1 to 50. Although quite subtle, it is subtlety that makes for the "human" feel in computer generated music. As with all the other "companion" screens, this screen only appears when a valid tick value is entered in the duration screen. End of notes ** To leave the list, click on the immediately-following link:- ** [mailto:ddots-l-request@xxxxxxxxxxxxx?subject=unsubscribe] ** If this link doesn't work then send a message to: ** ddots-l-request@xxxxxxxxxxxxx ** and in the Subject line type ** unsubscribe ** For other list commands such as vacation mode, click on the ** immediately-following link:- ** [mailto:ddots-l-request@xxxxxxxxxxxxx?subject=faq] ** or send a message, to ** ddots-l-request@xxxxxxxxxxxxx with the Subject:- faq ** To leave the list, click on the immediately-following link:- ** [mailto:ddots-l-request@xxxxxxxxxxxxx?subject=unsubscribe] ** If this link doesn't work then send a message to: ** ddots-l-request@xxxxxxxxxxxxx ** and in the Subject line type ** unsubscribe ** For other list commands such as vacation mode, click on the ** immediately-following link:- ** [mailto:ddots-l-request@xxxxxxxxxxxxx?subject=faq] ** or send a message, to ** ddots-l-request@xxxxxxxxxxxxx with the Subject:- faq
** To leave the list, click on the immediately-following link:- ** [mailto:ddots-l-request@xxxxxxxxxxxxx?subject=unsubscribe] ** If this link doesn't work then send a message to: ** ddots-l-request@xxxxxxxxxxxxx ** and in the Subject line type ** unsubscribe ** For other list commands such as vacation mode, click on the ** immediately-following link:- ** [mailto:ddots-l-request@xxxxxxxxxxxxx?subject=faq]** or send a message, to ** ddots-l-request@xxxxxxxxxxxxx with the Subject:- faq