Reusable gain staging, output trim, and metering for independent SuperCollider recording sources.
gainStageDoctor is designed to work with projectTemplate, midiFighterControllerPanel, and reaperSessionBridge.
See the projectTemplate README for the complete installation, prototyping, performance, and recording workflow.
- SuperCollider: tested with version 3.13.0
The core helper and standalone panel have no companion-repository dependencies.
gainStageDoctorTest.scd uses midiFighterControllerPanel from:
~/midiFighterControllerPanel
gainStageDoctor.scd: audio buses, output stages, trim control, and meteringgainStageDoctorPanel.scd: standalone and embedded GUI componentsgainStageDoctorTest.scd: four-channel routing and gain test
gainStageDoctor keeps three level controls separate:
- Amp: the source’s musical amplitude control
- Makeup gain: source-specific gain applied inside the source signal path
- Output trim: final gain applied to the independent recording output
Makeup gain can compensate for a quiet source or add drive before saturation. Because it is part of the source signal path, it can change the sound of saturation or other nonlinear processing.
Output trim changes the final recording level without changing the source synthesis behavior.
Each configured source can receive:
- A private source audio bus
- A makeup-gain control bus
- A source-specific makeup-gain range
- A final output-stage Synth
- Output-trim control
- Post-trim amplitude and peak metering
A compatible SynthDef accepts outBus, makeupGainCtl, and makeupMaxDb:
SynthDef(\mySynth, { |
outBus = 0,
amp = 0.2,
makeupGainCtl = 0.0,
makeupMaxDb = 6.0
|
var makeupGainDb, sig;
makeupGainDb =
makeupGainCtl.linlin(0, 1, 0, makeupMaxDb);
sig = SinOsc.ar(220)
* amp
* makeupGainDb.dbamp;
Out.ar(outBus, sig);
}).add;Apply makeup gain before tanh or other final nonlinear processing when it is intended to add drive.
Load gainStageDoctor.scd after the SuperCollider server has booted:
~gainStageDoctorDir =
Platform.userHomeDir +/+ "gainStageDoctor";
(~gainStageDoctorDir
+/+ "gainStageDoctor.scd").load;Set up its source and output groups:
~gainStageDoctor[\setup].();Create one mono output stage for an independent recording source:
~outputStage =
~gainStageDoctor[\makeMonoStage].(
hardwareOut: 0,
trimDb: 0,
meterID: 0
);hardwareOut uses SuperCollider’s zero-based output numbering.
Route the source through the stage’s private input bus:
~source = Synth.tail(
~gainStageDoctor[\sourceGroup].(),
\mySynth,
[
\outBus, ~outputStage[\inBus]
]
);Change the final output trim:
~outputStage[\setTrim].(-6);Free the routing:
~gainStageDoctor[\cleanup].();Load gainStageDoctorPanel.scd after gainStageDoctor.scd.
The panel publishes its interface through:
~gainStageDoctorPanelIt can open a standalone gain-stage window or provide its layout to midiFighterControllerPanel for an embedded performance interface.
- Connect the configured MIDI Fighter controllers
- Confirm that
midiFighterControllerPanelis installed at~/midiFighterControllerPanel - Run
gainStageDoctorTest.scd - Confirm that SuperCollider posts
gainStageDoctor test is ready. - Trigger the four test sources
- Confirm that makeup gain, output trim, and metering respond independently
- Run the active project cleanup when finished
Projects using gainStageDoctor should free their sources, responders, GUI objects, private buses, and gainStageDoctor routing from their project cleanup function.
The standardized project structure assigns that cleanup function to:
~activeProjectCleanup