“Rotor Organ” V7.3

May 2009

This is a “Hammond Organ with Leslie Rotor” simulation for the Csound music synthesis system. [Csound is a venerable, open-source, cross-platform, extremely flexible, hard-to-learn, software synthesis scheme. Look for it on the web.]

The simulation is intended to be driven by two channels of MIDI note input (to emulate the two manuals (keyboards) of a real Hammond). Real-time control of Drawbar settings and Leslie Rotor speed can be either through MIDI or text-line input. The simulation has Hammond ‘Vibrato’, ‘Percussion’ and Reverb, controllable via text input. In fact, the emulation goes as far as to use exact tone wheel frequencies (all 91 of them), rather than a true equal-temperament scale. (The tone wheels are neither exact harmonics nor equal-temperament, which may contribute to the “Hammond sound”.)

Depending on your system, you may not be able to drive all the possible MIDI inputs —the author has a custom software ‘rig’ that splits a piano range into the two manuals, displays a ‘Drawbar Panel’ for mouse access, and selects command lines with mouse-clicks— but you can run the simulation with a single MIDI channel (ignoring the second manual), and control other parameters through the Csound Score file or run-time text lines (to stdin).

[In case you’re wondering, I’m afraid there is no built-in GUI for this app, as the widget libraries provided for some versions of Csound are not available on my system.]

These Csound files are an adaptation of Hans Mikelson’s “MIDI Rotor Organ”, though by now most of the original code has been considerably rewritten. The orchestra code has been reorganized for a little more flexibility, and for convenience in playing from live keyboard MIDI input. I’ve added the tone wheels and the Vibrato feature, improved the Percussion mechanism, written a new Leslie, put in Reverb, and included the second keyboard manual. (No ‘Pedalboard’, though!)

Recent improvements include a more uniform perceived volume across the entire harmonic range. (Earlier versions simply used constant amplitude over the range, which meant that higher notes were objectionably louder, and the bass tended to get lost.) An Instrument ‘11’ has now been added to set parameters of Vibrato, Leslie, and Reverb. (Apparently the current version of Csound5 — unlike Csound4 — will not accept a command for an instrument that is already running, so this separate temporary instrument must handle the command instead.) The default MIDI keyboard channels are 1 and 2 (rather than 4 & 5 as previously) for greater convenience.

The ‘Key Click’ present in a real Hammond has been redone. The ‘white noise’ transient in the original code was not either realistic or pleasant to my ear, so I dropped it. The key click is actually mostly due to the arbitrary point in a cycle where a harmonic is picked up, causing a transient when the key is pressed. This effect has been duplicated in the current code, and seems preferable to the complete absence of transient in earlier versions, so it is enabled (but adjustable) by default.

This version 7.3 — in addition to the more uniform volume mentioned above — has a more plausible relation between a drawbar’s position and the amplitude of that harmonic. It is now approximately exponential, compared to the earlier straight-line relation. The Leslie frequency response (high, medium, and low band) is adjustable through instrument 11, and is somewhat mellower by default. It also has a rewritten “Percussion” scheme that is truer to a real Hammond (and is free of an early-cut-off glitch that existed before...). Decay of the percussion is slower as well, again probably closer to the real instrument. Its vibrato also has an added “buzz” component (~110 Hz) corresponding to an effect produced in a real Hammond by the scanner as it passes individual pickup plates. This is adjustable by an additional parameter to that instrument.

Operation

The essential parts of the package are the usual Csound ‘Orchestra’ and ‘Score’ files: rotororgan.orc and rotororgan.sco. They are intended to be used in a Csound configuration that receives both MIDI and text input in real-time. The command line will probably be similar to:

csound  -L stdin -M <midi-in> -b-1 -o devaudio rotororgan.orc rotororgan.sco

-L stdin” here indicates that commands can arrive through standard input. The <midi-in> parameter should be set to the device on your system that handles midi input. “devaudio” (or “dac”) is Csound’s usual standard name for the audio output device. The “-b-1” argument may be needed for ensuring no delay in the buffered output; Linux seems to prefer it absent.

Running the emulation like this, with MIDI from your keyboard coming in on channel 1, will let you play the organ with the defaults set up by the score file. Switch your keyboard to channel 2, and you can try the other manual. If your system can handle live text input (Linux can, for example), you can try typing or pasting instructions into the shell window to change drawbar settings, vibrato, and so on. See the included ‘presets’ file for possibilities.

At a minimum, you can always edit the text of the score file to set all the parameters as you wish. With a more elaborate MIDI setup, you can have still greater control, as described in more detail below.

Two MIDI channels (by default 1 & 2, driving Csound instruments 4 & 5) correspond to the “Swell” (upper) and “Great” (lower) manuals. These accept Note-On/Off events in the standard 61-key range of a Hammond (two octaves below middle-C to three above), a “Swell Pedal” as Controller 11, and a contiguous bank of Controllers (by default 20..28) for Drawbar settings. [Note that only controller values 0..8 are valid for the drawbars.] MIDI channel 3 (default) will accept a small range of Note-On/Offs to vary Leslie speed; the default for these is the lowest 8 notes of an 88-key keyboard.

Instead of MIDI Controller input, you can set Drawbar positions with Score commands, either added to the Score file itself or sent in real-time to Csound’s stdin. Similarly, Leslie speed may be set by command rather than MIDI. Other Leslie characteristics, Vibrato/Chorus, and Reverb can only be altered via commands—Score or stdin. More details below.

Supplying three MIDI channels—and run-time text input—may not be possible on your system, but the simulation could at a minimum still be used with one MIDI channel, relying on the score file for other control settings. I actually use my own ‘midi preprocessor’ software to split 88-key input into the two manuals, and octave-shift them into something like the same range (not twin 61-keys, but good enough for a lot of things). Typically, I have from middle-C upward (four octaves) as Upper Manual, the bottom 8 keys of the 88 control the Leslie speed, and the intervening two and a half octaves or so are assigned to the Lower Manual. If you can feed your computer with two keyboards set to suitable channels, that would be even better.

(A quick word about my “rig” may make the decisions I made clearer. For a start, I run an older version (4.23) of Csound under the Be operating system. This has advantages to compensate for the lack of later facilities… (:-/) Everything runs in a unified configuration, with MIDI being preprocessed in a few respects before being passed to Csound’s input. Also, Csound’s stdin can be simultaneously fed command lines from a separate window; the window is loaded up with convenient commands at startup, but these can be edited or added to as desired. Hence I can make parameter changes quickly at any time while playing.)

The MIDI channels used by default are ‘1’ for the ‘Upper/Swell’ keyboard and ‘2’ for the ‘Lower/Great’, mapped to the internal Instrument numbers 4 & 5, but these can be changed by constants defined near the start of the Orchestra file. For example, the MIDI channel for the Swell manual is set by giChanSwell, so if you want to drive it from other than channel 1, change this appropriately. Similarly other defaults are defined there and can be changed if you wish. All the function tables are also specified there, so you can make modifications, or you can experiment by overriding them in the Score file.

There are also a couple of parameters to adjust the “Key-Click”. One sets the rise-time (‘attack’) of the notes, and is set by default to give a reasonable click (0.001 sec). Making it larger (up to 0.1 or so) will reduce the attack transient and give a ‘smoother’ note. The other parameter actually inserts a spike of white noise at the start of a note. Whether this corresponds to key noise in a real Hammond is not clear. By default it is zero, but if you want the effect you can increase it (probably keeping it less than 1). You can experiment with these values at run time via Instrument 11.

Please note carefully — and distinguish — the usage of MIDI channels and Instruments. MIDI channels 1 and 2 are (by default) the two keyboard manuals, but drive Instruments 4 and 5. Drawbar settings in the score or from stdin for those channels are, however, handled by corresponding Instruments 1 and 2. MIDI Drawbar changes should be sent to the same channel as note events, and will be mapped appropriately.


Orchestra File

The instruments in the Orchestra file, “rotororgan.orc”, are, briefly (control sources in parentheses):

They are set up thusly:

  • Instrument 10

    Instrument 10 should be started at time zero by the Score, and will remain running until exit. It manages the actual audio output for all the other instruments. It also will provide Reverb, with decay time (‘seconds’) controlled by parameter p4. Reverb is off by default in the supplied Score file, but it can be changed at any time by sending an event to ‘i11’ with p3=10 and an appropriate p4 (zero for no reverb). (Under Csound4 you can also send the change directly to ‘i10’.) Suitable reverb times will be a matter of taste, but a value of 2 or so can be quite impressive! (A more serious value is probably 0.2..0.5.)

  • Instrument 11

    This instrument is needed — in Csound 5 — to change parameters of Vibrato, Leslie, and Reverb, once these instruments are running. (It is not needed in Csound 4, but can be used for consistency there too.) It can also be used to experiment with the ‘Key Click’ settings, which are otherwise not accessible at run time.

    Its invocation is a bit unusual, in that p3 is used to select the instrument to be controlled — it is not ‘duration’… Instrument 11 only runs to set parameters and then turns itself off. The remaining parameters, if any, are the same as would be sent directly to that instrument at startup. Only Vibrato, Reverb, and Key-click can currently be arbitrarily changed; the Leslies can only be turned off (no parameters needed), and can then be restarted with new settings.

    As an example, to set Vibrato (instrument 6) to ‘C3’ (p4=0.5, p5=1.0, p6=10000, p7=1, and p8=1), use the command:

    i 11 0  6  0.5 1.0 10000 1 1

  • All the parameters used in the orchestra are arranged—hopefully well commented—at the beginning of the file. Indication is given as to which you can change, and which you probably should not, but of course you are free to mess with any you want!

    Score File

    The supplied Score file, “rotororgan.sco” simply provides initial Drawbar, Vibrato, and Percussion registrations, turns on the Leslie (the newer version, with deflectors), and ramps it up. It also starts instrument 10 to handle audio output and reverb. Further settings can be sent in real time to stdin as appropriate. If you don’t like the file defaults, remedy that with a text editor.

    The score needs no tables, because everything is set up to defaults in the orchestra. It does contain commented-out versions of a couple of these, though, to demonstrate how you might change them. You can also send the text of new tables at run-time—to change distortion, for instance.


    Presets

    A third file of “presets” is provided. This contains an expanded set of drawbar etc. settings (some for the Lower Manual) , configured as Score ‘i’-format instructions , so they can be sent directly to Csound’s stdin; most are adapted from the examples contained in Hans’ original score file. It also has alternatives for Vibrato and Leslie etc. Csound command lines are freely intermixed with explanatory comments that should not be sent to Csound, but the actual command lines should be fairly obvious as they all begin with ‘i’ (or ‘f’). (In my setup this file gets loaded into a “command” window at startup.)

    A further “other_presets” file contains a bunch of registrations gleaned from the Hammond Wiki, for your experimentation. (All directed to the Upper Manual, but intended to be played with according to your pleasure.)