SuperCollider CLASSES (extension)

Balance
ExtensionExtension

Balances two signals with each other
Inherits from: UGen : AbstractFunction : Object
 

Description

Balance will try to match the RMS levels of in to the RMS of test.

Class Methods

*ar (in, test, hp: 10, stor: 0, mul: 1, add: 0)

Arguments:

in

The signal you want to balance.

test

The signal that should be used to balance in. If test is a k-rate sig, it will represent a target RMS.

hp
stor
mul
add

Inherited class methods

Instance Methods

Inherited instance methods

Examples

s.boot;
s.scope(2);

SynthDef(\noise, {arg noiseout = 1;
    var noise, filt;
    noise = WhiteNoise.ar(MouseX.kr(0, 1));
    filt = BPF.ar(noise, LFNoise2.kr(0.2, 440, 880), 0.001);
    // comment out to compare without balance
    filt = Balance.ar(filt, Amplitude.kr(noise, 0.01, 0.2).max(0.01));
//    filt = filt * 1000;
    Out.ar(0, [filt, noise * noiseout]);
    }).add;

s.sendMsg(\s_new, \noise, a = s.nextNodeID, 0, 1);
s.sendMsg(\n_set, a, \noiseout, 0);
s.sendMsg(\n_free, a);

SynthDef(\test, {
    var src, sig;
    src = SinOsc.ar(440, 0, MouseX.kr(0, 1));
    sig = SinOsc.ar(440, 0, 0.1);
    // comment out to compare without balance
    sig = Balance.ar(sig, src);
    Out.ar(0, [src, sig]);
    }).add;

s.sendMsg(\s_new, \test, a = s.nextNodeID, 0, 1);

s.sendMsg(\n_free, a);