Sie sind auf Seite 1von 8

SX Tips and tricks guide

Creating track control scripts.

Special thanks to Chams for hosting the series of articles. Please visit; http://thisplace.ca THE Place for Independent Artists

Overview.
The TrackContol Midi plugin provides a graphical means of editing Midi data, and a way of automating that Midi data in a project. Although this was covered slightly in the Midi Plugins PDF , this document aims to show how to go about starting a script. For the purpose of brevity, I shall assume that you are able to insert Midi plugins and have a reasonable understanding of Midi data, and what you want to achieve with it. In some ways this tool can replace the Mixermaps used in VST as it provided the same sort of functionality, a graphical interface to send Midi messages. One other thing to point out, I am not a programmer by any stretch of the imagination. The configurations I do are based on trial and error, a lot of copy and paste, and understanding only a few concepts. After that grim determination is the only thing I have going for me as a programmer.

The TrackControl interface.

Starting premise. To design a set of tools for the TrackContol plugin, the first goal is to decide what you wish to achieve. This is often sparked by a need to control a specific synth or plugin, and as such the controls can be specific to that device. In this case the requirement was very specific, and was useful in that respect. For most people, the need to control a devices parameters may be there, but finding out what Midi data is required is difficult. For most Midi gear there is a Midi Implementation guide near the end of the manuals, that gives a Chart which gives a visual clue as to what the unit will send or accept, and usually there is a section on specific controller and sysex messages, and how they are interpreted. I would usually look at the table, to get a feel for what the unit supports, and then delve into the details to see how the unit expects the data to be formatted. Again in this case the requirement was well specified, so I did not need to download a manual for the synth in question. Preparation work. Once the controllers/sysex messages are known, the next job is to 'design' the look of the interface, i.e what controls should be in what order, sort out names for the internal programming and for the display for each control. To save re-inventing the wheel, look at the current scripts, see what they look like, and what they are able to achieve, then use whatever controls are suitable for your requirements. The active scripts are held in the \Documents And Settings\<XP Username>\Application Data\Steinberg\Cubase SX2\Scripts\TrackMixer directory. In the Inactive folder there are unused scripts, one of which is particularly useful, scripttemplate.txt . This gives details of the generic programming for the TrackContol plugin, and explains the various fields, and options. Between this and the active scripts, it is useful to see what the terms mean, and how they are implemented in a real script, before coding anything. I used the XG scripts to see how various Sysex messages were sent, and especially used the XG global as script.txt file, to see how to create tables and what syntax works. With care a little copy and paste can create the scripts quite quickly, so I am not adverse to that. As a general rule a variable field (the value set by the control itself) replaces a value in the Midi string. It changes the value at the position defined by VALUEPOSITION in the control section of the script.

The requirement. This excersize was built around a specific requirement to control some function of the Virus synth. Below is the requirement , as I got the request.

OK, here goes. I would like to create a button in the MIDI Track Control that when pressed sends the following SysEx message to the Virus C. F0 00 20 33 01 00 72 00 7A 00 F7 I would like to create button that sends a message that sets the NRPN MSB to 03 and the NRPN LSB to 0D. I would like to create a knob and slider that adjusts CC#6 data entry.

As that was 'only' three controls, it seemed easy enough to take on. But (possibly because of my skill level at programming) I did come across some catches that caused me to have to re-evaluate, as I went through the excersize. The first thing was to get the feel for how the scripts were put together, so I referred to the scripttemplate.txt file. Using that I set out the basics of a script; STARTSCRIPT: DEVICENAME:"Virus" DEVICESHORTNAME:VirUS UNIQID: x44011958 LIBID: x43000010 EFFECTVALUE:NRPN LONGNAME:NRPN MINVALUE: 00 MAXVALUE: 127 VALUEPOSITION: 6 DEFAULTVALUE: 0 DISABLEDVALUE: -1 VALUEFLAGS: NO_RESET_ON_OFF,IS_MULTI_MESSAGE VALUECLASS: CBYTE RESETVALUE: 0 MIDISTRING: b0,63,03,62,0D,06,00,f7,ff VALUECONVERSION:0 CONTROLLTYPE: FADER_TYPE MAPARRAY:VIRUSMAP,NRPN ENDSCRIPT:

This first version allowed me to create a header, body and a control, which I decided would be interesting to have all the non-sysex data in the one control. So this could send the full set of controller messages (NRPN MSB, LSB and Data Controller) all in one go. All the values are explained in the template file, so I will not go into them here, but the important parts are the names assigned to controls EFFECTVALUE:NRPN LONGNAME:NRPN And the fact that they are referenced in the final section; MAPARRAY:VIRUSMAP,NRPN ENDSCRIPT: Note that I use the names (where possible) to let me know what the field name is for. In this case the name of the MAPARRAY is called VIRUSMAP, and it contains one control, the control called NRPN. It is important to keep the names of controls and maps unique on that system, and that includes tables (which we shall see later on). At one point I didn't change the name of a table, and the data was referenced from a different script. That confused me for a while. Once I has a basic template I could go about adding the buttons for the controls (this time trying to fit the requirement). One problem I had is that the button_type control did not work as I expected. Also I wanted to send only one message with the sysex string, and that was only to be sent when the object was 'set' . With variables it is easy to replace a byte in the Midi string, but getting the control to work so that it only sent one value when set, was proving more difficult. To get around this, I used another script to give a me a better solution. I used tables. These allow for name and a value to be stored, thus selecting the name sends that value. This can be very useful for times where non-contiguous data is required to be sent, the drop down provides a name and the correct data is sent. The first test of this used the following, which sent two values, as that was how the template I had copied worked.

NAMETABLE: sys_names,"Not sent","sent" MAPTABLE: sys_map1,x00,x7a00 EFFECTVALUE:sysex LONGNAME:"sysex" MINVALUE: 0 MAXVALUE: 1 VALUEPOSITION:8 DEFAULTVALUE: 1 DISABLEDVALUE: -1 VALUEFLAGS: 0 VALUECLASS: CBYTE RESETVALUE: 0 MIDISTRING: f0,00,20,33,01,00,72,00,00,00,f7,ff VALUECONVERSION: wordToMsbLsb CONTROLLTYPE: POPUP_TYPE MAPLIST: sys_map1 NAMELIST: sys_names Using the MAPTABLE and NAMETABLE allowed me to have two values inserted into the Sysex string, one for 'send' and one for 'Not sent' . It was not ideal, as it was still sending a string in either case. Note the values are inserted into the MIDI STRING at the VALUEPOSITION (in this case 8, or replacing the values 00,00,00 of the Midi string). It occurred to me that it might be better to have only one choice, so I lost the 'Not sent' option and it's data leaving only one entry in the drop down menu. Effectively that drop down has become a button in it's functionality. For each iteration and idea, I removed old versions of scripts from the Trackmixer Directory, and restarted SX, to allow the new scripts to be installed. Testing was done using the MidiOX so I could see the real result of the scripts on the TrackContol . The following was the final version, which used the controls as requested, one for the sysex string, one for the MSB and LSB of NRPN messages, and one for the controller #6 (data entry)

STARTSCRIPT: DEVICENAME:"Virus3" DEVICESHORTNAME:VirUS3 UNIQID: x44011958 LIBID: x43000010 NAMETABLE: sys_names,"Send" NAMETABLE: nrpname,"Send NRP", MAPTABLE: sys_map1,x7a00 MAPTABLE: nrpmap,x0d EFFECTVALUE:sysex LONGNAME:"sysex" MINVALUE: 0 MAXVALUE: 0 VALUEPOSITION:8 DEFAULTVALUE: 1 DISABLEDVALUE: -1 VALUEFLAGS: NO_RESET_ON_OFF VALUECLASS: CBYTE RESETVALUE: 0 MIDISTRING: f0,00,20,33,01,00,72,00,00,00,f7,ff VALUECONVERSION: wordToMsbLsb CONTROLLTYPE: POPUP_TYPE MAPLIST: sys_map1 NAMELIST: sys_names

EFFECTVALUE:NRPN LONGNAME:NRPN MINVALUE: 0 MAXVALUE: 0 VALUEPOSITION: 4 DEFAULTVALUE: 0 DISABLEDVALUE: -1 VALUEFLAGS: NO_RESET_ON_OFF,IS_MULTI_MESSAGE VALUECLASS: CBYTE RESETVALUE: 0 MIDISTRING: b0,63,03,62,00,f7,ff VALUECONVERSION:0 CONTROLLTYPE: POPUP_TYPE MAPLIST: nrpmap NAMELIST:nrpname

EFFECTVALUE:dataent LONGNAME:value MINVALUE: 0 MAXVALUE: 127 VALUEPOSITION: 3 DEFAULTVALUE: 0 DISABLEDVALUE: -1 VALUEFLAGS: NO_RESET_ON_OFF VALUECLASS: CBYTE RESETVALUE: 0 MIDISTRING: b0,06,00,f7,ff VALUECONVERSION:0 CONTROLLTYPE:FADER_TYPE MAPARRAY:VIRUSMAP,sysex,NRPN,dataent ENDSCRIPT:

The TrackControl with the script selected.

Das könnte Ihnen auch gefallen