Cubase contains many powerful features for processing MIDI data, such as the Logical Editor and Macros. This month we look at how using them together can create some powerful solutions to potentially tedious problems.
The Logical Editor has been a part of Steinberg's sequencing software products since the days of Pro 24 on the Atari, and its latest incarnation in Cubase SX/SL/SE remains a powerful way to process MIDI data. We've covered an introduction to the Logical Editor in previous editions of SOS, so for a complete refresher, you might want to check out May 2003's Cubase Notes. However, I'm going to start this month's Cubase workshop with a brief overview of the Logical Editor and cover a few points not described in the previous article, in addition to covering some of the same ground for new users. The first example will also be the same, so beginners can read a more in-depth explanation, making this article backwardly compatible if you will(!); after that we'll look at some more complex examples.
The basic principle of using the Logical Editor window is fairly straightforward. As with most off-line MIDI processing operations in Cubase, you can use the Logical Editor to process MIDI Parts in the Project window, and in this case you need to specify the MIDI Parts you want to process by selecting them and choosing MIDI / Logical Editor to open the Logical Editor window. Bear in mind that the Logical Editor option will be disabled in the menu if the MIDI Parts you've selected don't contain any MIDI Events to be processed.
You can also use the Logical Editor to process MIDI data in a MIDI editor window. If you have an open MIDI editor displaying MIDI Events with nothing selected, the Logical Editor will process all MIDI Events in the MIDI Part (or Parts if you're displaying multiple Parts in the editor window and have Edit Active Part Only disabled on the editor's toolbar). If you have Events selected in the MIDI editor, only these Events will be considered by the Logical Editor.
The Logical Editor window contains three main elements: the Function Menu, the Filter Condition List, and the Action List. The Filter Condition List specifies which events should be processed, the Action List specifies how the events should be processed, and the command selected in the Function Menu defines the mode of operation for the Logical Editor and precisely how the Filter Condition and Action Lists should be used. There are seven different commands available from the Function list:
- Delete erases all events specified by the Filter Condition List.
- Transform is the default (and most commonly used function) and modifies the events in the Filter Condition List by the actions defined in the Action List.
- Insert is similar to Transform, but instead of the filtered notes being modified to produce a different Event, the original Events are kept and the transformed Events are created as new, separate Events.
- Insert Exclusive is, again, based on Transform, except that notes that do not meet the conditions specified in the Filter Condition List are deleted. Unlike the standard Insert function, this one creates no new Events.
- Copy is like Insert, but instead of the newly transformed Events being created in same Part on the same track, the new Events are added to a new MIDI Part on a new MIDI track.
- Extract is similar to Copy, except that any Events matching the Condition List are deleted and the transformed versions are created in a new MIDI Part on a new track.
- Select selects any Events that match the Filter Condition List (and if any Events were already selected, deselects any that don't match the condition); the Action List is ignored.
The Filter Condition List is made up of a series of Lines, where each Line represents one expression that is part of the overall condition (if you have multiple Lines). A Line basically consists of a Filter Target, a Condition, and some data that is in one or more of three columns: Parameter 1, Parameter 2 and Bar Range, although these data columns are never used simultaneously. The Filter Target is a general category, such as a type of Event, the first data property, the length, and so on; the Condition is what evaluates the Filter Target against the data, such as Equal, Unequal, All Types, and Greater Than; and, finally, the data column specifies what the Filter Target should identify. For example, if you were looking for all notes, set Filter Target to Type, Condition to Equal, and Parameter 1 to Note.
Each Line in the Filter Condition List can only evaluate one Filter Target against one element of data, so if you wanted to find all notes equal to C3, you couldn't simply add a note pitch in the Parameter 2 column of the Line I just described. To do this would require two expressions — type is equal to note, and pitch is equal to C3 — so you'll need two Lines in the Filter Condition List. Add another line by clicking the Add Line button next to the upper List and then, on the second Line, set the Filter Target to Value 1 (which should automatically change to Pitch in the Line), make sure Condition is set to Equal, and set Parameter 1 to C3.
The Action List is very similar to the Filter Condition List in that it comprises a series of Lines that tell the Logical Editor what to do with the Events identified by the Filter Condition List. Each Line is again split up into several columns: an Action Target, an Operation, and some data (Parameter 1 and Parameter 2). Action Target specifies which part of an Event should be processed, whether it's the type, a property or value (such as pitch); Operation sets what you want to do to the Action Target, such as add, set it equal to something, and so on; and the data specifies what the Operation applies to the Action Target. For example, to transpose found notes up an octave, the Action Target would be Value 1, Operation would be Add, and Parameter 1 would be 12 (semitones).
Additional Lines can be added to (or deleted from) the Action List, but bear in mind that while each Line in the Filter Condition List is an expression of one overall condition, each Line in the Action List operates independently, one after the other, like a recipe. So if you had two Lines that were both 'Value 1 Add 12', this would be the equivalent of one Line that states 'Value 1 Add 24'.
Once you've set the Function of the Logical Editor, specified the Events to operate on with the Filter Condition List, and set up what happens to the identified Events with the Action List (unless you've chosen Select as your Function), you press the Do It button for the Logical Editor to work its magic.
Of interest to Cubase users this month will be Steinberg's announcement of Hypersonic 2, an update to the popular virtual workstation released by Steinberg and Wizoo at the end of 2003 (reviewed SOS February 2004). Although the original point of Hypersonic was to be an economical all-purpose sound source that you could get good results with even if you were using an older computer system, many people wanted the gigabyte sound library to compete with products like IK Multimedia's Sampletank. So Hypersonic 2 comes with a 1.7GB sample library (up from the original 250MB content) with 800 new patches and revised versions of the original 1000 presets supplied with Hypersonic 1.
Hypersonic 2 also includes Hyperphase, a rather good polyphonic arpeggiator that includes 200 phrases, and the ability to import your own as a Standard MIDI File. What's more, the updated user interface makes it possible to edit every parameter in Hypersonic's different sound engines, which you couldn't do in the previous version. One user interface change I didn't like so much was that the semi-circle value displays in the Mix page of version 1 have been replaced with more traditional horizontal rectangular bars, which personally I didn't find so effective — but if that's the only gripe I have, it's probably not a serious criticism of the product!
I recently encountered a curious problem when a composer I was working with needed to use newer versions of some multisampled orchestral instruments, featuring many velocity layers, which were being played back via MIDI from various Cubase Projects. The composer in question is a meticulous programmer and had balanced the velocity layers very precisely so the appropriate samples within the instrument were triggered; but in the newer versions of the instruments the velocity ranges had changed, even though the samples were the same. So the problem was how to rebalance the velocities used for notes that had been programmed with one version of the instrument so they would play back using the same samples in the new versions. And since the Cubase Projects that needed altering were large and numerous, this was definitely a job for the Logical Editor.
One of the instruments in question had six velocity layers and the old version had these velocity layers programmed with the following splits: 0-30, 31-52, 53-74, 75-98, 99-113 and 114-127. And as I explained, the new version had the velocity layers programmed slightly differently, so the new splits were as follows: 0-80, 81-90, 91-100, 101-110, 111-120, and 121-127.
Cubase's Logical Editor is a great way of processing MIDI data, but its Transform feature is only capable of transforming one condition into one result. An example of one condition would be 'find all the velocities between 0 and 30' and an example of one result would be 'scale these velocities to 0 and 80'. If I had multiple conditions for different velocity layers, they'd all have to be processed by the same Action List, so all velocities would end up between 0 and 80, which would be useless. Therefore, each velocity layer transformation has to be dealt with using a separate Logical Editor operation; so what we'll end up learning here is how to combine multiple Logical Editor operations into one command to create more powerful (and convenient) Logical Editor commands.
The first step is to open the Logical Editor window by selecting MIDI / Logical Editor. Start by selecting the Init Preset (click on the Presets pop-up menu and choose 'init') to make sure any previous operations in the Logical Editor are reset, and make sure that the Transform Function is selected. The first Line in the Filter Condition List should read '(Type Is Equal Note)', and next we need to set the range for the incoming velocities by adding two further Lines to the List, clicking the Add Line button twice.
Set the Filter Target for the lower two Lines to 'Value 2' by clicking underneath the column in the appropriate row and choosing 'Value 2' from the pop-up menu. Once you make the selection, you should notice how Cubase will display this entry as Velocity in the Line. Next, set the Condition on the second row to 'Bigger or Equal' and the third row to 'Less or Equal', and enter the velocity boundaries for the first velocity layer (0 and 30) as Parameter 1 on the second and third rows.
Now the Filter Condition List has been set, we need to set up the operation to scale velocities between 0 and 30 to 0 and 80 instead. To do this, on the first Line of the Action List, Action Target should be set to Value 2, Operation to Multiply by and Parameter 1 to 2.67. To get this scaler value (2.67) you divide the range of velocities in the destination (80) by the number of velocities in the source (30), and I rounded the result to two decimal places, which is easily accurate enough for the seven-bit integer values used to describe velocity in the MIDI protocol. And that's it. Store the Preset by clicking Store, entering a name, and clicking OK, and we have a Logical Editor operation that can scale velocities between 0 and 30 to 0 and 80.
Creating an operation to scale the next velocity layer is almost the same: the process of setting up the condition is identical, except Parameter 1 in the lower two rows should now be 31 and 52 to represent the range of the second velocity layer. The most significant change this time is that the Action List is a little more complicated, because we need to first subtract the lowest velocity (31) from the velocity of the note we're processing, so we can scale the velocity correctly, and then add the value of the lowest velocity for the new instrument to this number so that it's put back into the correct range again. Therefore, the Filter Condition List should now consist of three Lines: 'Value 2 Subtract 31', 'Value 2 Multiply by 0.43', and 'Value 2 Add 81'. 0.43 is the scaler because it's the division between the range of velocities in the old second later and the range in the new second layer ((90-81=9)/(52-31=21)=0.43).
So now we have two Logical Editor Presets to deal with the first two velocity layers, and by substituting the numbers from the remaining velocity layers you should be able to build presets for the other transformations, as they're all based on the second layer Filter Condition and Action lists described in the previous paragraph.
Once you've finished, you'll have ended up with six different velocity layers with which to process each MIDI note where you want to rescale the velocities. To execute all these operations simultaneously you can build a Macro (which we covered in January 2003's Cubase Notes), as Logical Editor Presets appear in the Process Logical Preset Key Commands category. The important thing is that the Presets are run in reverse order, so you process the highest velocity layer first — otherwise, each Preset would operate on the results of the previous operation, so a small velocity could end up scaling to 127 if you weren't careful. By running the Presets in reverse order, there's less chance of this happening.
So to build the Macro, open the Key Commands window (File / Key Commands), click Show Macros, click New Macro, type in a name for the Macro and press Enter. Find the Logical Presets you created in the Process Logical Preset category in the Commands list and select the first Command to add to the Macro (the last Preset you created, the one to process the highest velocity layer). Now, click the Add Command button to add that Logical Preset to the Macro, and then repeat this process for the rest of the Logical Presets. When you've finished, you can assign a Key Command to the Macro itself if you want, or just click OK to close the Key Commands window.
If you haven't assigned a Key Command, you can run the Macro by selecting it from the Edit / Macros submenu — just remember to have some MIDI Event selected before you run the Macro, and also to make sure the Logical Editor window itself is closed. Triggering Logical Editor Presets via Key Commands or Macros with the Logical Editor window open will select those Presets for editing in the Logical Editor rather than actually running the process on available MIDI data.
Hopefully this will have helped you to get a better handle on the Logical Editor, and will have made you think about the possibilities of combining Logical Editor Presets with Macros. Join me next month for some action in the exciting world of Boolean operators...