[SCM] calf/master: New modules: mono input and stereo tools Manuals for mono, stereo and limiter and multiband limiter

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:40:43 UTC 2013


The following commit has been merged in the master branch:
commit 2248a4a636f2a3c0a06a581e73dadf71faeba2d6
Author: Markus Schmidt <schmidt at boomshop.net>
Date:   Fri Dec 9 03:11:32 2011 +0100

    New modules: mono input and stereo tools
    Manuals for mono, stereo and limiter and multiband limiter

diff --git a/doc/manuals/Limiter.html b/doc/manuals/Limiter.html
new file mode 100644
index 0000000..14ca5e7
--- /dev/null
+++ b/doc/manuals/Limiter.html
@@ -0,0 +1,41 @@
+<html>
+    <head>
+        <link type="text/css" rel="stylesheet" href="scripts/thickbox.css" />
+        <link type="text/css" rel="stylesheet" href="scripts/style.css" />
+        <script language="javascript" type="text/javascript" src="scripts/jquery.js"></script>
+        <script language="javascript" type="text/javascript" src="scripts/thickbox.js"></script>
+        <script language="javascript" type="text/javascript" src="scripts/manual.js"></script>
+    </head>
+    <body>
+        <div class="wrapper">
+            <h1>Limiter</h1>
+            <a href="images/Calf - Limiter.png" title="Calf - Limiter" class="thickbox"><img class="thumbnail" src="images/Calf - Limiter.png" /></a>
+            <h2>Functionality</h2>
+            <p>
+                The Limiter prevents your signals from raising over a desired thershold. The Calf limiter makes up your audio signal automatically by the threshold set.<br /><br />
+                This limiter uses lookahead technology to prevent your signal from distorting. It means that there is a small delay after your signal is processed. Keep in mind that the delay it produces is the lookahead time you set.<br /><br />
+            </p>
+            <h2>Controls</h2>
+            <ul>
+                <li><strong>Input (knob):</strong> Raise the volume before the signal is sent in the compression stage. If you have found some great settings but want to raise the overall loudness of the track simply increase this level.</li>
+                <li><strong>Input L/R (VU-meter):</strong> The level of the original signal</li>
+                <li><strong>0dB (LED):</strong> Flashes if the level of the original signal raises above 0dB (it doesn't clip your signal)</li>
+                <li><strong>Output L/R (VU-meter):</strong> The level of the compressed and made up signal</li>
+                <li><strong>0dB (LED):</strong> Flashes if the level of the output signal raises above 0dB (it may clip your signal depending on your host and your systems' bitrate!)</li>
+                <li><strong>Output (knob):</strong> Raise the overall volume after the compression stage</li>
+                <li><strong>Bypass:</strong> Don't process anything, just bypass the signal</li>
+                
+                <li><strong>Split:</strong> Frequency to split between these strips</li>
+                <li><strong>S:</strong> Separate or overlap the frequencies of the neighbour bands</li>
+                <li><strong>Q:</strong> Raise the center frequency</li>
+                <li><strong>Limit:</strong> Don't let signals above this level pass the limiter. The removed amplitude is added automatically.</li>
+                <li><strong>Lookahead:</strong> The Limiter will reach its attenuation level in this amount of time (output will be delayed two times this time)</li>
+                <li><strong>Min Release:</strong>Don't let the release time fall beneath 2.5 times the lowest possible wavelength per band</li>
+                <li><strong>Release:</strong> Come back from limiting to attenuation 1.0 in this amount of milliseconds</li>
+                <li><strong>Release (per strip):</strong> Coefficient the master release time is computed with to have separate release times for each strip</li>
+                <li><strong>Weight:</strong> The "importance" of this strip in the resulting signal</li>
+                <li><strong>Solo:</strong> Hear single (or more) bands exclusively to set the crossover and the release times exactly</li>
+            </ul>
+        </div>
+    </body>
+</html>
diff --git a/doc/manuals/Mono Input.html b/doc/manuals/Mono Input.html
new file mode 100644
index 0000000..3f86991
--- /dev/null
+++ b/doc/manuals/Mono Input.html	
@@ -0,0 +1,41 @@
+<html>
+    <head>
+        <link type="text/css" rel="stylesheet" href="scripts/thickbox.css" />
+        <link type="text/css" rel="stylesheet" href="scripts/style.css" />
+        <script language="javascript" type="text/javascript" src="scripts/jquery.js"></script>
+        <script language="javascript" type="text/javascript" src="scripts/thickbox.js"></script>
+        <script language="javascript" type="text/javascript" src="scripts/manual.js"></script>
+    </head>
+    <body>
+        <div class="wrapper">
+            <h1>Mono Input</h1>
+            <a href="images/Calf - Mono Input.png" title="Calf - Mono Input" class="thickbox"><img class="thumbnail" src="images/Calf - Mono Input.png" /></a>
+            <h2>Functionality</h2>
+            <p>
+                The Mono Input is a utility for splitting a mono signal into two channels. It is necessary for using the stereo processors of Calf on mono channels in programs like Ardour. Additionally it has some features to manipulate basic attributes of the audio stream like phase or delay of channels.
+            </p>
+            <h2>Controls</h2>
+            <ul>
+                
+                <li><strong>Input L/R (VU-meter):</strong> The level of the original signal</li>
+                <li><strong>0dB (LED):</strong> Flashes if the level of the original signal raises above 0dB (it doesn't clip your signal)</li>
+                
+                <li><strong>Input (knob):</strong> Raise the volume before the signal is sent in the compression stage. If you have found some great settings but want to raise the overall loudness of the track simply increase this level.</li>
+                <li><strong>Softclip:</strong> Do kind of analog distortion instead of harsh digital 0db clipping</li>
+                <li><strong>Bypass:</strong> Don't process anything, just bypass the signal</li>
+                
+                <li><strong>Mute L:</strong> Mute the left channel</li>
+                <li><strong>Phase L:</strong> Change the phase of the left channel</li>
+                <li><strong>Mute R:</strong> Mute the right channel</li>
+                <li><strong>Phase R:</strong> Change the phase of the right channel</li>
+                
+                
+                <li><strong>Output L/R (VU-meter):</strong> The level of the compressed and made up signal</li>
+                <li><strong>0dB (LED):</strong> Flashes if the level of the output signal raises above 0dB (it may clip your signal depending on your host and your systems' bitrate!)</li>
+                <li><strong>Output (knob):</strong> Raise the overall volume after the compression stage</li>
+                <li><strong>Delay:</strong> Delay the left or the right channel (milliseconds)</li>
+                <li><strong>Balance:</strong> Set the balance between both channels</li>
+            </ul>
+        </div>
+    </body>
+</html>
diff --git a/doc/manuals/Multiband Compressor.html b/doc/manuals/Multiband Compressor.html
index a02c628..7515eea 100644
--- a/doc/manuals/Multiband Compressor.html	
+++ b/doc/manuals/Multiband Compressor.html	
@@ -28,21 +28,21 @@
                 <li><strong>Output (knob):</strong> Raise the overall volume after the compression stage</li>
                 <li><strong>Bypass:</strong> Don't process anything, just bypass the signal</li>
                 
-                <li><strong>Split x:</strong> Frequency to split between these strips</li>
-                <li><strong>Sx:</strong> Separate or overlap the frequencies of the neighbour bands</li>
-                <li><strong>Qx:</strong> Raise the center frequency</li>
+                <li><strong>Split:</strong> Frequency to split between these strips</li>
+                <li><strong>S:</strong> Separate or overlap the frequencies of the neighbour bands</li>
+                <li><strong>Q:</strong> Raise the center frequency</li>
                 
-                <li><strong>Attack n:</strong> Amount of milliseconds the signal has to rise above the threshold before gain reduction starts</li>
-                <li><strong>Release n:</strong> Amount of milliseconds the signal has to fall below the threshold before the reduction is decreased again</li>
-                <li><strong>Knee n:</strong> Curve the sharp knee around the threshold to enter gain reduction more softly</li>
-                <li><strong>Ratio n:</strong> Set a ratio about which the signal is reduced. 1:2 means that if the level rises 4dB above the threshold, it will be only 2dB above after the reduction.</li>
-                <li><strong>Threshold n:</strong> If a signal rises above this level it will affect the gain reduction</li>
-                <li><strong>Makeup n:</strong> Amplify this frequency range after processing</li>
-                <li><strong>Detection n:</strong> Choose if the strip should take the exact signal for detection or an RMS like one (it's mainly smoother).</li>
-                <li><strong>Gain Reduction n:</strong> The level of reduction in this strip</li>
-                <li><strong>Output n:</strong> The output level of this strip</li>
-                <li><strong>Bypass n:</strong> Don't process anything, just bypass the signal of this strip</li>
-                <li><strong>Mute n:</strong> Don't output anything, just mute the signal of this strip</li>
+                <li><strong>Attack:</strong> Amount of milliseconds the signal has to rise above the threshold before gain reduction starts</li>
+                <li><strong>Release:</strong> Amount of milliseconds the signal has to fall below the threshold before the reduction is decreased again</li>
+                <li><strong>Knee:</strong> Curve the sharp knee around the threshold to enter gain reduction more softly</li>
+                <li><strong>Ratio:</strong> Set a ratio about which the signal is reduced. 1:2 means that if the level rises 4dB above the threshold, it will be only 2dB above after the reduction.</li>
+                <li><strong>Threshold:</strong> If a signal rises above this level it will affect the gain reduction</li>
+                <li><strong>Makeup:</strong> Amplify this frequency range after processing</li>
+                <li><strong>Detection:</strong> Choose if the strip should take the exact signal for detection or an RMS like one (it's mainly smoother).</li>
+                <li><strong>Gain Reduction:</strong> The level of reduction in this strip</li>
+                <li><strong>Output:</strong> The output level of this strip</li>
+                <li><strong>Bypass:</strong> Don't process anything, just bypass the signal of this strip</li>
+                <li><strong>Solo:</strong> Mute all strips not set to solo</li>
             </ul>
         </div>
     </body>
diff --git a/doc/manuals/Multiband Limiter.html b/doc/manuals/Multiband Limiter.html
new file mode 100644
index 0000000..19ed8e4
--- /dev/null
+++ b/doc/manuals/Multiband Limiter.html	
@@ -0,0 +1,45 @@
+<html>
+    <head>
+        <link type="text/css" rel="stylesheet" href="scripts/thickbox.css" />
+        <link type="text/css" rel="stylesheet" href="scripts/style.css" />
+        <script language="javascript" type="text/javascript" src="scripts/jquery.js"></script>
+        <script language="javascript" type="text/javascript" src="scripts/thickbox.js"></script>
+        <script language="javascript" type="text/javascript" src="scripts/manual.js"></script>
+    </head>
+    <body>
+        <div class="wrapper">
+            <h1>Multiband Limiter</h1>
+            <a href="images/Calf - Multiband Limiter.png" title="Calf - Multiband Limiter" class="thickbox"><img class="thumbnail" src="images/Calf - Multiband Limiter.png" /></a>
+            <h2>Functionality</h2>
+            <p>
+                The Multiband Limiter splits the incoming signal into different bands according to the settings of the crossover stage and <a href="Limiter.html" alt="Calf - Limiter">limits</a> them individually afterwards before they are summed up again. This signal processor is normally used for mastering a mixdown to bring a lot of loudness and power to your tracks. It keeps the signal <em>always</em> below the threshold to prevent digital equipmenmt from clipping.<br /><br />
+                This limiter uses lookahead technology to prevent your signal from distorting. That means that there is a small delay after your signal is processed. Keep in mind that the delay it produces is two times the lookahead time you set.<br /><br />
+            </p>
+            <h2>Tipps</h2>
+            <p>
+                With the <strong>weight</strong> coefficient you can give importance to signals you don't want to loose in the limiting process. E.g. if your high-mid band (containing most of the vocals) starts fading in the background from now and then turn up its weight to let other bands process the gain reduction for reaching the desired limit. Your vocals will remain in the foreground even if heavy gain reduction is necessary. Values below zero will remove weight from a band and means "prefer this band when it comes to harder limitation". The weighting is affecting all bands equally, so setting all knobs to 1 has the same effect as having them all set to 0 - that is to say none.
+            </p>
+            <h2>Controls</h2>
+            <ul>
+                <li><strong>Input (knob):</strong> Raise the volume before the signal is sent in the compression stage. If you have found some great settings but want to raise the overall loudness of the track simply increase this level.</li>
+                <li><strong>Input L/R (VU-meter):</strong> The level of the original signal</li>
+                <li><strong>0dB (LED):</strong> Flashes if the level of the original signal raises above 0dB (it doesn't clip your signal)</li>
+                <li><strong>Output L/R (VU-meter):</strong> The level of the compressed and made up signal</li>
+                <li><strong>0dB (LED):</strong> Flashes if the level of the output signal raises above 0dB (it may clip your signal depending on your host and your systems' bitrate!)</li>
+                <li><strong>Output (knob):</strong> Raise the overall volume after the compression stage</li>
+                <li><strong>Bypass:</strong> Don't process anything, just bypass the signal</li>
+                
+                <li><strong>Split:</strong> Frequency to split between these strips</li>
+                <li><strong>S:</strong> Separate or overlap the frequencies of the neighbour bands</li>
+                <li><strong>Q:</strong> Raise the center frequency</li>
+                <li><strong>Limit:</strong> Don't let signals above this level pass the limiter. The removed amplitude is added automatically.</li>
+                <li><strong>Lookahead:</strong> The Limiter will reach its attenuation level in this amount of time (output will be delayed two times this time)</li>
+                <li><strong>Min Release:</strong>Don't let the release time fall beneath 2.5 times the lowest possible wavelength per band</li>
+                <li><strong>Release:</strong> Come back from limiting to attenuation 1.0 in this amount of milliseconds</li>
+                <li><strong>Release (per strip):</strong> Coefficient the master release time is computed with to have separate release times for each strip</li>
+                <li><strong>Weight:</strong> The "importance" of this strip in the resulting signal</li>
+                <li><strong>Solo:</strong> Hear single (or more) bands exclusively to set the crossover and the release times exactly</li>
+            </ul>
+        </div>
+    </body>
+</html>
diff --git a/doc/manuals/Stereo Tools.html b/doc/manuals/Stereo Tools.html
new file mode 100644
index 0000000..dc83e2b
--- /dev/null
+++ b/doc/manuals/Stereo Tools.html	
@@ -0,0 +1,52 @@
+<html>
+    <head>
+        <link type="text/css" rel="stylesheet" href="scripts/thickbox.css" />
+        <link type="text/css" rel="stylesheet" href="scripts/style.css" />
+        <script language="javascript" type="text/javascript" src="scripts/jquery.js"></script>
+        <script language="javascript" type="text/javascript" src="scripts/thickbox.js"></script>
+        <script language="javascript" type="text/javascript" src="scripts/manual.js"></script>
+    </head>
+    <body>
+        <div class="wrapper">
+            <h1>Stereo Tools</h1>
+            <a href="images/Calf - Stereo Tools.png" title="Calf - Stereo Tools" class="thickbox"><img class="thumbnail" src="images/Calf - Stereo Tools.png" /></a>
+            <h2>Functionality</h2>
+            <p>
+                Stereo Tools are some handy utilities for managing stereo signals, e.g. as a extensive input stage in a stereo channel of a multitrack program like Ardour, for converting M/S stereo recordings to a L/R signal while havong control over the paramaters or spreading the stereo image of your master track.
+                
+            </p>
+            <h2>Controls</h2>
+            <ul>
+                
+                <li><strong>Bypass:</strong> Don't process anything, just bypass the signal</li>
+                <li><strong>Input L/R (VU-meter):</strong> The level of the original signal</li>
+                <li><strong>0dB (LED):</strong> Flashes if the level of the original signal raises above 0dB (it doesn't clip your signal)</li>
+                
+                <li><strong>Input (knob):</strong> Raise the volume before the signal is sent in the compression stage. If you have found some great settings but want to raise the overall loudness of the track simply increase this level.</li>
+                <li><strong>Balance:</strong> Set the balance between both channels</li>
+                <li><strong>Flip L/R:</strong> Toggle the channels</li>
+                <li><strong>Softclip:</strong> Do kind of analog distortion instead of harsh digital 0db clipping</li>
+                
+                <li><strong>S level:</strong> The level of the side signal</li>
+                <li><strong>S Balance:</strong> The balance of the side signal</li>
+                <li><strong>M Level:</strong> The level of the middle signal</li>
+                <li><strong>M Panorama:</strong> The position in the panorama of the middle signal</li>
+                <li><strong>Mode:</strong> Choose normal stereo behavior (LR - LR) or convert between MS and LR</li>
+                
+                
+                <li><strong>Mute L:</strong> Mute the left channel</li>
+                <li><strong>Phase L:</strong> Change the phase of the left channel</li>
+                <li><strong>Mute R:</strong> Mute the right channel</li>
+                <li><strong>Phase R:</strong> Change the phase of the right channel</li>
+                
+                
+                <li><strong>Output L/R (VU-meter):</strong> The level of the compressed and made up signal</li>
+                <li><strong>0dB (LED):</strong> Flashes if the level of the output signal raises above 0dB (it may clip your signal depending on your host and your systems' bitrate!)</li>
+                <li><strong>Output (knob):</strong> Raise the overall volume after the compression stage</li>
+                <li><strong>Delay:</strong> Delay the left or the right channel (milliseconds)</li>
+                <li><strong>Widener:</strong> Add a litte amount of phase-inverted signal to the other channel to spread the stereo image</li>
+                <li><strong>Balance:</strong> Set the balance between both channels</li>
+            </ul>
+        </div>
+    </body>
+</html>
diff --git a/doc/manuals/images/Calf - Limiter.png b/doc/manuals/images/Calf - Limiter.png
new file mode 100644
index 0000000..0ea83d2
Binary files /dev/null and b/doc/manuals/images/Calf - Limiter.png differ
diff --git a/doc/manuals/images/Calf - Mono Input.png b/doc/manuals/images/Calf - Mono Input.png
new file mode 100644
index 0000000..f26549d
Binary files /dev/null and b/doc/manuals/images/Calf - Mono Input.png differ
diff --git a/doc/manuals/images/Calf - Multiband Limiter.png b/doc/manuals/images/Calf - Multiband Limiter.png
new file mode 100644
index 0000000..be4a2d3
Binary files /dev/null and b/doc/manuals/images/Calf - Multiband Limiter.png differ
diff --git a/doc/manuals/images/Calf - Stereo Tools.png b/doc/manuals/images/Calf - Stereo Tools.png
new file mode 100644
index 0000000..38db1c7
Binary files /dev/null and b/doc/manuals/images/Calf - Stereo Tools.png differ
diff --git a/doc/manuals/scripts/manual.js b/doc/manuals/scripts/manual.js
index a3be619..ca41477 100644
--- a/doc/manuals/scripts/manual.js
+++ b/doc/manuals/scripts/manual.js
@@ -32,7 +32,9 @@ $(document).ready(function () {
                 ["Compressor", "Compressor.html", "images/Calf - Compressor.png"],
                 ["Sidechain Compressor", "Sidechain Compressor.html", "images/Calf - Sidechain Compressor.png"],
                 ["Multiband Compressor", "Multiband Compressor.html", "images/Calf - Multiband Compressor.png"],
-                ["Deesser", "Deesser.html", "images/Calf - Deesser.png"]
+                ["Deesser", "Deesser.html", "images/Calf - Deesser.png"],
+                ["Limiter", "Limiter.html", "images/Calf - Limiter.png"],
+                ["Multiband Limiter", "Multiband Limiter.html", "images/Calf - Multiband Limiter.png"]
             ]
         ],
         [
@@ -52,7 +54,9 @@ $(document).ready(function () {
                 ["(Rotary Speaker)", "Rotary Speaker.html", "images/Calf - Rotary Speaker.png"],
                 ["(Saturator)", "Saturator.html", "images/Calf - Saturator.png"],
                 ["(Exciter)", "Exciter.html", "images/Calf - Exciter.png"],
-                ["(Bass Enhancer)", "Bass Enhancer.html", "images/Calf - Bass Enhancer.png"]
+                ["(Bass Enhancer)", "Bass Enhancer.html", "images/Calf - Bass Enhancer.png"],
+                ["Mono Input", "Mono Input.html", "images/Calf - Mono Input.png"],
+                ["Stereo Tools", "Stereo Tools.html", "images/Calf - Stereo Tools.png"]
             ]
         ]
     ];
diff --git a/doc/manuals/scripts/style.css b/doc/manuals/scripts/style.css
index 519d8ae..4a9b833 100644
--- a/doc/manuals/scripts/style.css
+++ b/doc/manuals/scripts/style.css
@@ -18,15 +18,18 @@ img {
     border: none;
 }
 h1 {
-    color: #D5F16A;
+/*    color: #D5F16A;*/
+    color: white;
+    font-weight: normal;
 /*    background: url(../images/style_p.png) transparent;*/
     text-align: center;
     margin: 20px;
-    border-bottom: 1px dotted #fff;
+/*    border-bottom: 1px dotted #fff;*/
 }
 h2 {
-    color: #D5F16A;
-    font-size: 20px;
+/*    color: #D5F16A;*/
+    color: white;
+    font-size: 16px;
     font-weight: normal;
     
     padding: 5px 0 10px 0;
@@ -38,7 +41,7 @@ p, ul {
     background: url(../images/style_p.png) transparent;
     margin: 0 0 15px;
     padding: 10px;
-    border: 1px solid black;
+    border: 2px groove white;
     -moz-border-radius: 12px;
     -webkit-border-radius: 12px;
 }
@@ -50,6 +53,7 @@ li {
 }
 strong {
     color: #D5F16A;
+/*    color: black;*/
 }
 
 .wrapper {
@@ -125,20 +129,20 @@ strong {
     text-align: center;
     font-weight: normal;
     position: absolute;
-    top: 100px;
+    top: 120px;
     width: 150px;
 }
 .index img {
     position: absolute;
     bottom: 55px !important;
     top: auto;
-    left: 25px;
+    left: 5px;
     text-align: center;
     border: 1px solid black;
     border-top: 5px solid black;
 }
 .index img {
-    width: 100px;
+    width: 140px;
 }
 .index ul {
     background: none;
@@ -149,7 +153,7 @@ strong {
     position: relative;
     display: block;
     width: 150px;
-    height: 150px;
+    height: 170px;
     margin: 8px;
     float: left;
     text-align: center;
diff --git a/gui/gui-mono.xml b/gui/gui-mono.xml
index 67bd0d8..9bffe53 100644
--- a/gui/gui-mono.xml
+++ b/gui/gui-mono.xml
@@ -69,6 +69,11 @@
             </table>
             <hbox spacing="8">
                 <vbox spacing="12">
+                    <label param="delay" />
+                    <knob param="delay" size="2" type="1" />
+                    <value param="delay" />
+                </vbox>
+                <vbox spacing="12">
                     <label param="balance_out" />
                     <knob param="balance_out" size="2" type="1" />
                     <value param="balance_out" />
diff --git a/gui/gui-stereo.xml b/gui/gui-stereo.xml
index 9f81602..fa53a1c 100644
--- a/gui/gui-stereo.xml
+++ b/gui/gui-stereo.xml
@@ -109,6 +109,16 @@
             </table>
             <hbox spacing="8">
                 <vbox expand="0" spacing="12">
+                    <label param="delay" />
+                    <knob param="delay" size="3" type="1" />
+                    <value param="delay" />
+                </vbox>
+                <vbox expand="0" spacing="12">
+                    <label param="widener" />
+                    <knob param="widener" size="3" />
+                    <value param="widener" />
+                </vbox>
+                <vbox expand="0" spacing="12">
                     <label param="balance_out" />
                     <knob param="balance_out" size="3" type="1" />
                     <value param="balance_out" />
diff --git a/src/audio_fx.cpp b/src/audio_fx.cpp
index e952ba3..c720327 100644
--- a/src/audio_fx.cpp
+++ b/src/audio_fx.cpp
@@ -632,17 +632,21 @@ void lookahead_limiter::process(float &left, float &right, float * multi_buffer)
     // check multiband coefficient again for output pointer
     multi_coeff = (use_multi) ? multi_buffer[(pos + channels) % buffer_size] : 1.f;
     
-    //if(pos % 20 == 2 and debug) printf("%+.5f | %3d\n", multi_coeff, pos);
-    
     // output peak - impact in left or right channel?
     peak = fabs(left) > fabs(right) ? fabs(left) : fabs(right);
     
     // we need  "and (pos == pos_next or pos_next < 0)" in the next if
     // but that fucks up delta = release
-    // because this screws the CPU
+    // (because this screws the CPU)
     
     // output is over the limit?
+    // then we have to search for new delta.
+    // the idea is to calculate a delta for every peak and always use the
+    // lowest. this produces a soft transition between limiting targets without
+    // passing values above limit
+    
     if(peak > limit * multi_coeff * weight) {
+        // default is to do a release
         delta = (1.0f - att) / (srate * release);
         pos_next = -1;
         unsigned int j;
@@ -667,7 +671,6 @@ void lookahead_limiter::process(float &left, float &right, float * multi_buffer)
     
     // change the attenuation level
     att += delta;
-    //if(debug and (pos%20 == 0 or in0 or out0)) printf("%03d: limit: %+.4f - att %+.4f - delta: %+.8f - in: %+.4f", pos, limit * multi_coeff * weight, att, delta, left);
     // ...and calculate outpout from it
     left *= att;
     right *= att;
@@ -677,11 +680,6 @@ void lookahead_limiter::process(float &left, float &right, float * multi_buffer)
 	    att = 1.0f;
 	    delta = 0.0f;
 	}
-    
-    
-    //if(debug and (pos%20 == 0 or in0 or out0)) printf(" - out: %+.4f | in: %1d - out: %1d\n", left, in0, out0);
-//    if(fabs(left) > limit * multi_coeff * weight or fabs(right) > limit * multi_coeff * weight)
-//        printf("%+.5f - %+.5f | %+.5f\n", left, right, limit);
 
     // security personnel pawing your values
 	if(att < 0.f) {
@@ -705,14 +703,10 @@ void lookahead_limiter::process(float &left, float &right, float * multi_buffer)
     denormal(&left);
     denormal(&right);
     
-//    if(pos%20==0)
-//        printf("%d: limit: %+.5f eff_limit: %+.5f\n", id, limit, limit * multi_coeff * weight);
-    
     left = std::max(left, -limit * multi_coeff * weight);
     left = std::min(left, limit * multi_coeff * weight);
     right = std::max(right, -limit * multi_coeff * weight);
     right = std::min(right, limit * multi_coeff * weight);
-    //if(left > 0.001f) printf("%3d: left: %+.5f - limit: %+.5f - mc: %+.5f weight: %+.5f\n", pos, left, limit, multi_coeff, weight);
     
     att_max = (att < att_max) ? att : att_max; // store max atten for meter output
     
diff --git a/src/calf/metadata.h b/src/calf/metadata.h
index 3339681..6109279 100644
--- a/src/calf/metadata.h
+++ b/src/calf/metadata.h
@@ -363,8 +363,9 @@ struct stereo_metadata: public plugin_metadata<stereo_metadata>
            STEREO_VU_METER_PARAMS, param_balance_in, param_balance_out, param_flip, param_softclip, 
            param_mute_l, param_mute_r, param_phase_l, param_phase_r,
            param_mode, param_slev, param_sbal, param_mlev, param_mpan,
+           param_widener, param_delay,
            param_count };
-    PLUGIN_NAME_ID_LABEL("stereo", "stereo", "Stereo Input")
+    PLUGIN_NAME_ID_LABEL("stereo", "stereo", "Stereo Tools")
 };
 /// Markus's Mono Module - metadata
 struct mono_metadata: public plugin_metadata<mono_metadata>
@@ -374,6 +375,7 @@ struct mono_metadata: public plugin_metadata<mono_metadata>
            param_meter_in, param_meter_outL, param_meter_outR, param_clip_in,param_clip_outL, param_clip_outR,
            param_balance_out, param_softclip, 
            param_mute_l, param_mute_r, param_phase_l, param_phase_r,
+           param_delay,
            param_count };
     PLUGIN_NAME_ID_LABEL("mono", "mono", "Mono Input")
 };
diff --git a/src/calf/modules.h b/src/calf/modules.h
index 24491fc..4e8b1cd 100644
--- a/src/calf/modules.h
+++ b/src/calf/modules.h
@@ -246,6 +246,11 @@ class mono_audio_module:
 {
     uint32_t srate;
     bool active;
+    
+    float * buffer;
+    unsigned int pos;
+    unsigned int buffer_size;
+    
     void softclip(float &s) {
         int ph = s / fabs(s);
         s = s > 0.63 ? ((0.63 + 0.36) * ph * (1 - pow(MATH_E, (1.f / 3) * (0.63 + s * ph)))) : s;
@@ -258,12 +263,18 @@ public:
     void deactivate();
     uint32_t process(uint32_t offset, uint32_t numsamples, uint32_t inputs_mask, uint32_t outputs_mask);
 };
+
 class stereo_audio_module:
     public audio_module<stereo_metadata>
 {
     float LL, LR, RL, RR;
     uint32_t srate;
     bool active;
+    
+    float * buffer;
+    unsigned int pos;
+    unsigned int buffer_size;
+    
     void softclip(float &s) {
         int ph = s / fabs(s);
         s = s > 0.63 ? ((0.63 + 0.36) * ph * (1 - pow(MATH_E, (1.f / 3) * (0.63 + s * ph)))) : s;
diff --git a/src/metadata.cpp b/src/metadata.cpp
index a4da798..d26c64d 100644
--- a/src/metadata.cpp
+++ b/src/metadata.cpp
@@ -807,6 +807,7 @@ CALF_PORT_PROPS(mono) = {
     { 0,          0,            1,     0,  PF_BOOL | PF_CTL_TOGGLE, NULL, "phasel", "Phase L" },
     { 0,          0,            1,     0,  PF_BOOL | PF_CTL_TOGGLE, NULL, "phaser", "Phase R" },
     
+    { 0.f,         -20.f,        20.f,  0,  PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF, NULL, "delay", "Delay" },
     {}
 };
 
@@ -847,10 +848,12 @@ CALF_PORT_PROPS(stereo) = {
     { 0.f,      -1.f,            1.f,   0,  PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_GRAPH, NULL, "mlev", "M Level" },
     { 0.f,      -1.f,            1.f,   0,  PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_GRAPH, NULL, "mpan", "M Panorama" },
     
+    { 0,           0,           1,    0,  PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_NOBOUNDS, NULL, "widener", "Widener" },
+    { 0.f,         -20.f,        20.f,  0,  PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF, NULL, "delay", "Delay" },
     {}
 };
 
-CALF_PLUGIN_INFO(stereo) = { 0x8588, "StereoInput", "Calf Stereo Input", "Markus Schmidt", calf_plugins::calf_copyright_info, "Utility" };
+CALF_PLUGIN_INFO(stereo) = { 0x8588, "StereoTools", "Calf Stereo Tools", "Markus Schmidt", calf_plugins::calf_copyright_info, "Utility" };
 
 
 ////////////////////////////////////////////////////////////////////////////
diff --git a/src/modules.cpp b/src/modules.cpp
index 3e31270..275744b 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -538,6 +538,24 @@ uint32_t stereo_audio_module::process(uint32_t offset, uint32_t numsamples, uint
             L += LL*L + RL*R;
             R += RR*R + LR*L;
             
+            // widener
+            L += *params[param_widener] * R * -1;
+            R += *params[param_widener] * L * -1;
+            
+            // delay
+            buffer[pos]     = L;
+            buffer[pos + 1] = R;
+            
+            int nbuf = srate * (fabs(*params[param_delay]) / 1000.f);
+            nbuf -= nbuf % 2;
+            if(*params[param_delay] > 0.f) {
+                R = buffer[(pos - (int)nbuf + 1 + buffer_size) % buffer_size];
+            } else if (*params[param_delay] < 0.f) {
+                L = buffer[(pos - (int)nbuf + buffer_size)     % buffer_size];
+            }
+            
+            pos = (pos + 2) % buffer_size;
+            
             // balance out
             L *= (1.f - std::max(0.f, *params[param_balance_out]));
             R *= (1.f + std::min(0.f, *params[param_balance_out]));
@@ -553,6 +571,12 @@ uint32_t stereo_audio_module::process(uint32_t offset, uint32_t numsamples, uint
 void stereo_audio_module::set_sample_rate(uint32_t sr)
 {
     srate = sr;
+    // rebuild buffer
+    buffer_size = (int)(srate * 0.05 * 2.f); // buffer size attack rate multiplied by 2 channels
+    printf("%4d\n", buffer_size);
+    buffer = (float*) calloc(buffer_size, sizeof(float));
+    memset(buffer, 0, buffer_size * sizeof(float)); // reset buffer to zero
+    pos = 0;
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////
@@ -579,9 +603,8 @@ uint32_t mono_audio_module::process(uint32_t offset, uint32_t numsamples, uint32
             outs[0][i] = ins[0][i];
             outs[1][i] = ins[0][i];
         } else {
-            float L, R;
-            L = ins[0][i];
-            R = ins[0][i];
+            float L = ins[0][i];
+            float R = ins[0][i];
             
             // mute
             L *= (1 - floor(*params[param_mute_l] + 0.5));
@@ -604,6 +627,20 @@ uint32_t mono_audio_module::process(uint32_t offset, uint32_t numsamples, uint32
             L *= (2 * (1 - floor(*params[param_phase_l] + 0.5))) - 1;
             R *= (2 * (1 - floor(*params[param_phase_r] + 0.5))) - 1;
             
+            // delay
+            buffer[pos]     = L;
+            buffer[pos + 1] = R;
+            
+            int nbuf = srate * (fabs(*params[param_delay]) / 1000.f);
+            nbuf -= nbuf % 2;
+            if(*params[param_delay] > 0.f) {
+                R = buffer[(pos - (int)nbuf + 1 + buffer_size) % buffer_size];
+            } else if (*params[param_delay] < 0.f) {
+                L = buffer[(pos - (int)nbuf + buffer_size)     % buffer_size];
+            }
+            
+            pos = (pos + 2) % buffer_size;
+            
             // balance out
             L *= (1.f - std::max(0.f, *params[param_balance_out]));
             R *= (1.f + std::min(0.f, *params[param_balance_out]));
@@ -619,4 +656,9 @@ uint32_t mono_audio_module::process(uint32_t offset, uint32_t numsamples, uint32
 void mono_audio_module::set_sample_rate(uint32_t sr)
 {
     srate = sr;
+    // rebuild buffer
+    buffer_size = (int)srate * 0.05 * 2; // delay buffer size multiplied by 2 channels
+    buffer = (float*) calloc(buffer_size, sizeof(float));
+    memset(buffer, 0, buffer_size * sizeof(float)); // reset buffer to zero
+    pos = 0;
 }

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list