2 include
"bse/bsecxxmodule.idl";
5 interface Compressor : Effect {
6 Info icon =
"icons/compressor.png";
7 Info authors =
"Matthias Kretz, Stefan Westerfeld";
8 Info license = _(
"GNU Lesser General Public License");
9 Info category = _(
"/Enhance/ArtsCompressor");
10 Info blurb = _(
"ArtsCompressor compresses the sound.\n\n"
11 "Compression is a dynamic operation that consists of two parts:\n"
12 "(1) the current input volume of the signal is detected\n"
13 "(2) if it exceeds a given theshold, the volume of the output signal will be reduced\n\n"
14 "The input volume detection has an attack and a release half-life time which can be specified - "
15 "in milliseconds - with the corresponding properties. This envelope causes the compressor to "
16 "adapt slowly to the actual input signal level.\n\n"
17 "The ratio specifies how the volume of a signal should be reduced, if it exceeds the threshold. "
18 "A compression ratio of 2:1 means for instance that if the input volume is 2 dB over the threshold, "
19 "the output volume will be 1 dB over the threshold. Example (threshold = -10, ratio 2:1):\n"
20 "input = -20 dB => output = -20 dB\n"
21 "input = -10 dB => output = -10 dB\n"
22 "input = 0 dB => output = -5 dB\n"
23 "input = 10 dB => output = 0 dB\n"
24 "input = 20 dB => output = 5 dB\n\n"
25 "Compression is often thought off as an operation to make music \"sound louder\". To achieve this, "
26 "the first step is to reduce the dynamic range like in the example above. As the loud parts of "
27 "the music have been reduced in volume, we can now amplify everything, without risking distortion or clipping. "
28 "This has the overall effect of the music sounding louder. In our example, an output "
29 "amplification of 5 dB would be okay, if the input signal never exceeded 0 dB.");
30 IStream audio_in1 = Stream (_(
"Audio In1"), _(
"Audio input 1"));
31 IStream audio_in2 = Stream (_(
"Audio In2"), _(
"Audio input 2"));
32 OStream audio_out1 = Stream (_(
"Audio Out1"), _(
"Compressed audio output 1"));
33 OStream audio_out2 = Stream (_(
"Audio Out2"), _(
"Compressed audio output 2"));
34 group _(
"Parameters") {
35 Real attack = SfiReal (_(
"Attack [ms]"), _(
"Set the attack time in milliseconds"), 10.0, 0.1, 250.0, 10.0, STANDARD
":scale");
36 Real release = SfiReal (_(
"Release [ms]"), _(
"Set the release time in milliseconds"), 10.0, 0.1, 250.0, 10.0, STANDARD
":scale");
37 Real threshold_db = Gain (_(
"Threshold [dB]"), _(
"Only parts louder than threshold are compressed"), 0, -100, 0, 1, STANDARD
":scale");
38 Real ratio_to_one = SfiReal (_(
"Ratio [x:1]"), _(
"Set the compression ratio to x:1"), 2, 1.0, 20.0, 1, STANDARD
":scale");
39 Real output_db = Gain (_(
"Output [dB]"), _(
"Set the output amplification"), 0, -20, 20, 1, STANDARD
":scale");
40 Bool auto_output = Bool (_(
"Auto Output"), _(
"Adjust the output amplification automatically according to threshold and ratio"), FALSE, GUI);
43 Real threshold = SfiReal (
"",
"", 1, 0.00001, 1, 0.01,
"w");
44 Real ratio = SfiReal (
"",
"", 0.8, 0.0, 1.0, 0.1,
"w");
45 Real output = SfiReal (
"",
"", 1, 0.1, 10.0, 1,
"w");