Skip to content

About

Reusable gain staging, output trim, and metering for independent SuperCollider recording sources

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

gainStageDoctor

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.

Requirements

The core helper and standalone panel have no companion-repository dependencies.

gainStageDoctorTest.scd uses midiFighterControllerPanel from:

~/midiFighterControllerPanel

Files

  • gainStageDoctor.scd: audio buses, output stages, trim control, and metering
  • gainStageDoctorPanel.scd: standalone and embedded GUI components
  • gainStageDoctorTest.scd: four-channel routing and gain test

Level controls

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.

Source interface

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.

Use the helper directly

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].();

Use the panel

Load gainStageDoctorPanel.scd after gainStageDoctor.scd.

The panel publishes its interface through:

~gainStageDoctorPanel

It can open a standalone gain-stage window or provide its layout to midiFighterControllerPanel for an embedded performance interface.

Run the test

  1. Connect the configured MIDI Fighter controllers
  2. Confirm that midiFighterControllerPanel is installed at ~/midiFighterControllerPanel
  3. Run gainStageDoctorTest.scd
  4. Confirm that SuperCollider posts gainStageDoctor test is ready.
  5. Trigger the four test sources
  6. Confirm that makeup gain, output trim, and metering respond independently
  7. Run the active project cleanup when finished

Cleanup convention

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

About

Reusable gain staging, output trim, and metering for independent SuperCollider recording sources

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages