/* ArtsCompressor - aRts Compressor Effect -*-mode: c++;-*- * Copyright (C) 2001 Matthias Kretz * Copyright (C) 2003-2004 Stefan Westerfeld * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #include namespace Bse { namespace Arts { class Compressor : Effect { Info icon = "icons/compressor.png"; Info authors = "Matthias Kretz, Stefan Westerfeld"; Info license = _("GNU General Public License"); Info category = _("/Enhance/ArtsCompressor"); Info blurb = _("ArtsCompressor compresses the sound.\n\n" "Compression is a dynamic operation that consists of two parts:\n" "(1) the current input volume of the signal is detected\n" "(2) if it exceeds a given theshold, the volume of the output signal will be reduced\n\n" "The input volume detection has an attack and a release half-life time which can be specified - " "in milliseconds - with the corresponding properties. This envelope causes the compressor to " "adapt slowly to the actual input signal level.\n\n" "The ratio specifies how the volume of a signal should be reduced, if it exceeds the threshold. " "A compression ratio of 2:1 means for instance that if the input volume is 2 dB over the threshold, " "the output volume will be 1 dB over the threshold. Example (threshold = -10, ratio 2:1):\n" "input = -20 dB => output = -20 dB\n" "input = -10 dB => output = -10 dB\n" "input = 0 dB => output = -5 dB\n" "input = 10 dB => output = 0 dB\n" "input = 20 dB => output = 5 dB\n\n" "Compression is often thought off as an operation to make music \"sound louder\". To achieve this, " "the first step is to reduce the dynamic range like in the example above. As the loud parts of " "the music have been reduced in volume, we can now amplify everything, without risking distortion or clipping. " "This has the overall effect of the music sounding louder. In our example, an output " "amplification of 5 dB would be okay, if the input signal never exceeded 0 dB."); IStream audio_in1 = (_("Audio In1"), _("Audio input 1")); IStream audio_in2 = (_("Audio In2"), _("Audio input 2")); OStream audio_out1 = (_("Audio Out1"), _("Compressed audio output 1")); OStream audio_out2 = (_("Audio Out2"), _("Compressed audio output 2")); group _("Parameters") { Real attack = Real (_("Attack [ms]"), _("Set the attack time in milliseconds"), 10.0, 0.1, 250.0, 10.0, STANDARD ":scale"); Real release = Real (_("Release [ms]"), _("Set the release time in milliseconds"), 10.0, 0.1, 250.0, 10.0, STANDARD ":scale"); Real threshold_db = Gain (_("Threshold [dB]"), _("Only parts louder than threshold are compressed"), 0, -100, 0, 1, STANDARD ":scale"); Real ratio_to_one = Real (_("Ratio [x:1]"), _("Set the compression ratio to x:1"), 2, 1.0, 20.0, 1, STANDARD ":scale"); Real output_db = Gain (_("Output [dB]"), _("Set the output amplification"), 0, -20, 20, 1, STANDARD ":scale"); Bool auto_output = Bool (_("Auto Output"), _("Adjust the output amplification automatically according to threshold and ratio"), FALSE, GUI); }; group "compat" { /* compatibility properties */ Real threshold = Real (NULL, NULL, 1, 0.00001, 1, 0.01, "w"); Real ratio = Real (NULL, NULL, 0.8, 0.0, 1.0, 0.1, "w"); Real output = Real (NULL, NULL, 1, 0.1, 10.0, 1, "w"); }; }; }; // Arts }; // Bse /* vim:set ts=8 sw=2 sts=2 syntax=cpp: */