CONVERTING STUDIOMIX ENDLESS ROTARY ENCODER DATA FOR USE IN CSOUND Art Hunkins - November 2005 abhunkin AT uncg DOT edu http://www31.brinkster.com/abhunkins For Csound as well as other music software, the Peavey StudioMix presents several challenges: instead of continuous controller (CC) and note on/off MIDI messages, the StudioMix generates *proprietary NRPN* messages. In addition, its endless rotary encoders output *relative* rather than absolute data. Thankfully, MIDIOx and MIDIYoke (free downloads from http://www.midiox.com) permit this non-standard output to be converted to familiar MIDI data for Windows systems. Doing so is fairly straightforward for StudioMix sliders and buttons, and this is described in the companion article, "The Peavey StudioMix as Standard MIDI Controller for Csound." (In such a situation, only a basic conversion file - called StudioMixSliderFix.oxm - is required.) The endless rotary encoders are another issue altogether. Unlike most other rotary encoders, which offer *absolute* data mode as an option, StudioMix only supports relative mode (that is, +/-1, with no frame of reference). To meet this challenge, a MIDIOx VBScript is required: the accompanying StudioMixEncoderFix.vbs both converts NRPNs to CC data, and relative data (of a unique sort) to absolute data - constrained to within the normal 0-127 range. Please note that endless rotary encoders should not be pressed into service as continuous controllers unless absolutely necessary. From the performance point of view, sliders are best, rotary pots are OK, while endless encoders are "a last resort." The basic problem is that encoders have no tactile/ visual beginning and end point. In addition, since they increment/decrement by single units (on the StudioMix and other units by actual tactile "stops" - 24 to 36 per turn), several rotations of the dial are required to cover the 0-127 range. Though this particular issue is solved by StudioMixEncoderFix, the lack of physical beginning and end point remains; it is inherent in encoder design. In any case, I developed StudioMixEncoderFix.vbs to enable StudioMix to function as the performance control surface for my numerous real-time Csound compositions. (My compositions are available at the website listed above.) I am eager that my work be performable on as many different control devices as possible, and many versions of these works call for multiple banks of eight controllers. (Not many less expensive control surfaces offer the substantial array of controllers and buttons that StudioMix does.) It is hoped that this script, appropriately modified, might be useful to other like-minded composers, including in live-performance situations other than Csound. StudioMixEncoderFix.vbs presents five variables that may be user-modified (in any text editor, such as Notepad). These variables are located near the beginning of the file. Four have to do with controller (CC) numbers assigned to the encoders: BANK1 specifies the number of the first controller of the lower row of eight "channel" knobs; BANK2 does likewise for the top row. BANK1M is the right-most, "Master" knob of the bottom row; BANK2M is the right-most knob of the upper row. The fifth variable is STEPS, or the number of increments/decrements that the user wishes to represent the overall control range (0-127). Physically, the StudioMix encoders have 24 steps or "stops" per rotation. The default STEPS setting (to be practical) compresses the range into 24 STEPS, or a single rotation. (You may want to set this to a lower number such as 20, which would more closely parallel the action or "travel" of the usual rotary pot.) If you vary the bank numbering, be sure that CC numbers for the banks do not overlap one another (this includes any eight-*slider* bank used concurrently - see reference to StudioMixSlider.oxm below). The combined default settings (which parallel the defaults of my live-performance Csound compositions) are as follows: CCs 20-27 for sliders, 28-35 for BANK1 encoders, 36-43 for BANK2 encoders. The Master (ninth) controller in each row immediately follows the bank of eight, in two cases duplicating the first number of the next higher bank (28, 36 and 44). (It was my intention that whenever a ninth controller is called for, higher rows would *not* be.) Setup procedure is similar to the one described in "The Peavey StudioMix as Standard MIDI Controller for Csound": 1) Before MIDIOx can be run, the MIDIYoke "virtual patch cord" driver must be installed. The fairly elaborate instructions for doing so are well detailed in the Midiyoke.rtf file included in the self-extracting download. Follow them carefully. For our purposes, only a single MIDI Yoke Junction Port need be created. Fortunately, once this setup is complete, you can forget about it. 2) Run MIDIOx, setting the MIDI Output device to MIDI Yoke Junction: 1. (Click Options, then MIDI Devices.) In the same window, select the MIDI Input device (usually your sound card) that connects StudioMix to your computer. (Once you make these selections, they remain the same until you change them.) 3) Disable the MAP icon if it's selected on the taskbar. 4) During your Csound (.csd) or other software setup, select MIDI Yoke Junction: 1 as MIDI Input Device. 5) Click on StudioMixEncoderFix.vbs. (It will "attach" itself to the running MIDIOx automatically.) Alternatively, you can do this prior to step 2, in which case the VBScript will itself open MIDIOx; you then proceed to set the devices as above. 6) To shut down the script (and MIDIOx), click Actions, then Stop WScript. (Do not close MIDIOx the normal way.) Finally, this VBScript can be used in conjunction with StudioMixSliderFix.oxm to allow a quite powerful control of Csound by StudioMix (9 sliders, 14+ buttons and 18 rotary encoders). To implement this combination, follow the setup outlined above, except substitute the following step 2 (drawn for the instructions for StudioMixSliderFix in "The Peavey StudioMix as Standard MIDI Controller for Csound"): 2) Under Options, Data Mapping, load the StudioMixSliderFix.oxm (or .txm) file. Click OK, then click/enable the MAP icon if it's not already enabled on the taskbar.