Featured Post

Tuesday, June 21, 2011

Sonar X1 -- Using CAL

Sonar X1 is fantastic software. It's fast. The user interface is a pleasure to work with. I cannot say enough good things about it.

My relationship with Cakewalk goes back to Cakewalk 1.0. MIDI was relatively new then, and the "King of the Hill" was Sequencer Plus by Voyetra. For some reason I was attracted to Cakewalk. I guess I made a good choice given the growth of the product over all these years.

What's been funny to me over those many years and iterations of Cakewalk and Sonar is that a little part of my time comes with each copy. Back in the early 90's (late 80's?), Greg Hendershott had a Cakewalk Application Language (CAL) contest. I was intrigued with the idea of extending what Cakewalk could do. So I wrote several CAL scripts  (C-MPLMIT.CAL, C-NTROLR.CAL and HIVEL.CAL) to do some things I needed to do. I sent them in, and a few weeks later I got a check from Greg -- for 2d or 3d place :-). If you go to the drive where you installed Sonar, look in \Cakewalk Content\SONAR xxxx\CAL Scripts, and you'll see these and other CAL scripts.

CAL can be very helpful when there's no built-in command to do what you need. If you're trying to do something that's not native to Sonar, check out the CAL scripts that ship with Sonar and the ones on the internet.

But, as always, use caution in making any edits. Make doubly sure you have the correct data selected. CAL can take many, many steps which may not appear in your History and possibly cannot be undone. If you want to select all the data on a single track, always click the track number to highlight it.

And, best of all, start each project with a filename like "Name of the Project-W01" -- which means Working 01. When you intend to make a major edit or delete tracks/data, don't depend on Undo. Save the project as "Name of the Project-W02." Then, in a disaster you won't have to figure out where in undo history you need to revert to. You just close W02, reopen W01 and save it over W02 to continue on. When you complete your project, you can save the final under "Name of the Project" and you can delete the Working copies if you wish. "Better safe than sorry!"

To find out what a CAL script does, open the CAL file in Notepad, Wordpad or other such editor. There should be an explanation of what the script does (at the top of the file). You can find the Sonar CAL routines in the folder/directory noted above, or you can open a Sonar project containing at least one MIDI track.

If you open a Sonar project, you have to select at least some MIDI data to get to the CAL scripts (otherwise Run CAL is grayed out). Then, use Ctrl-F1 or (menu Process/Run CAL) for a list of available scripts. To see inside the script, right click it and select "Open with" to choose Notepad/whatever editor.

The other day, I opened a project file I'd saved weeks ago. That project contained one track with lots of instrument parts, each on it's own MIDI channel. I wanted to split the instruments out. I could have saved the project as a Type 0 MIDI file and dragged that file back into the project where Sonar would automatically split the MIDI channels to different tracks. Or, I remembered a CAL script. Looking for it, the name was "Split Channel to Tracks.cal." I selected the single track by clicking on the track number and ran the script. It did just what I wanted ...."

Except it put blank tracks for channels without MIDI data. Easy enough to delete. But I thought, maybe I can come up with an edit where it won't create blank tracks. Also, the CAL moved the data to the new tracks (by cut/paste, and I wanted to archive the original track. What if I gave the user a choice in that, too?

So I edited "Split Channel to Tracks.cal." I couldn't locate my early Cakewalk CAL docs, but thanks to Ton Valkenburgh's excellent Sonar MIDI-Kit site and his hard work on a CAL Programming Guide, my memory was refreshed (and I learned some things I didn't know before).

You can download my edited CAL script -- "Split Channel to Tracks-Choices.cal"

Try some CAL scripting yourself next time you find a need and can't find an existing script :-)

No comments:

Post a Comment