[xiph-cvs] cvs commit: postfish compandpanel.c multicompand.c version.h

Monty xiphmont at xiph.org
Sun Mar 7 23:20:15 PST 2004



xiphmont    04/03/08 02:20:15

  Modified:    .        compandpanel.c multicompand.c version.h
  Log:
  Reverb suppression actually works!  w00t!

Revision  Changes    Path
1.6       +19 -19    postfish/compandpanel.c

Index: compandpanel.c
===================================================================
RCS file: /usr/local/cvsroot/postfish/compandpanel.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- compandpanel.c	8 Mar 2004 02:08:23 -0000	1.5
+++ compandpanel.c	8 Mar 2004 07:20:15 -0000	1.6
@@ -203,12 +203,12 @@
   float val=-multibar_get_value(MULTIBAR(w),0);
 
   if(rint(1./val)>=10.)
-    sprintf(buffer,"%3.0f:1",1./val);
-  else
     sprintf(buffer,"%3.1f:1",1./val);
+  else
+    sprintf(buffer,"%3.2f:1",1./val);
 
   if(val==1.)
-    sprintf(buffer,"  off");
+    sprintf(buffer,"   off");
 
   readout_set(r,buffer);
   c.static_c_ratio=rint(100./val);
@@ -220,12 +220,12 @@
   float val=-multibar_get_value(MULTIBAR(w),0);
 
   if(rint(1./val)>=10.)
-    sprintf(buffer,"%3.0f:1",1./val);
+    sprintf(buffer,"%3.1f:1",1./val);
   else
-  sprintf(buffer,"%3.1f:1",1./val);
+  sprintf(buffer,"%3.2f:1",1./val);
 
   if(val==1.)
-    sprintf(buffer,"  off");
+    sprintf(buffer,"   off");
 
   readout_set(r,buffer);
   c.static_e_ratio=rint(100./val);
@@ -247,7 +247,7 @@
   else
     sprintf(buffer,"%4.1f",ms/1000);
 
-  if(ms<=1)
+  if(ms<=10)
     sprintf(buffer," fast");
 
   if(ms>99999.)
@@ -350,7 +350,7 @@
   else
     sprintf(buffer,"%4.1f",ms/1000);
 
-  if(ms<=1)
+  if(ms<=10)
     sprintf(buffer," fast");
 
   if(ms>99999.)
@@ -366,12 +366,12 @@
   float val=-multibar_get_value(MULTIBAR(w),0);
 
   if(rint(1./val)>=10.)
-    sprintf(buffer,"%3.0f:1",1./val);
-  else
     sprintf(buffer,"%3.1f:1",1./val);
+  else
+    sprintf(buffer,"%3.2f:1",1./val);
 
   if(val==1.)
-    sprintf(buffer,"  off");
+    sprintf(buffer,"   off");
 
   readout_set(r,buffer);
   c.suppress_ratio=rint(100./val);
@@ -413,11 +413,11 @@
   float levels[15]={-140,-130,-120,-110,-100,-90,-80,-70,-60,-50,-40,
                      -30,-20,-10,0};
 
-  float ratio_levels[7]={-1.,-.67,-.5,-.33,-.25,-.17,-.1};
-  char  *ratio_labels[6]={"1.5:1","2:1","3:1","4:1","6:1","10:1"};
+  float ratio_levels[7]={-1.,-.833,-.667,-.5,-.33,-.2,-.1};
+  char  *ratio_labels[6]={"1.2:1","1.5:1","2:1","3:1","5:1","10:1"};
 
-  float decay_levels[7]={-100000,-10000,-1000,-100,-10,-3,-1};
-  char  *decay_labels[6]={".01",".1","1","10","30","slow"};
+  float decay_levels[7]={-10000,-1000,-100,-30,-10,-3,-1};
+  char  *decay_labels[6]={".1","1","3","10","30","slow"};
     
   float bias_levels[7]={-30,-20,-10,0,10,20,30};
   char  *bias_labels[6]={"20","10","0","10","20","30"};
@@ -438,7 +438,7 @@
   GtkWidget *staticframe=gtk_frame_new(NULL);
   GtkWidget *slidertable=gtk_table_new(multicomp_freqs_max+1,5,0);
 
-  GtkWidget *envelopeframe=gtk_frame_new(" Envelope Compander ");
+  GtkWidget *envelopeframe=gtk_frame_new(" Dynamic Range ");
   GtkWidget *suppressframe=gtk_frame_new(" Reverberation Suppressor ");
 
   GtkWidget *envelopetable=gtk_table_new(3,3,0);
@@ -528,8 +528,8 @@
     GtkWidget *labelR=gtk_label_new("Ratio");
     GtkWidget *labelR1=gtk_label_new("cmpr:");
     GtkWidget *labelR2=gtk_label_new("expd:");
-    GtkWidget *readoutR1=readout_new("1.5:1");
-    GtkWidget *readoutR2=readout_new("1.5:1");
+    GtkWidget *readoutR1=readout_new("1.50:1");
+    GtkWidget *readoutR2=readout_new("1.50:1");
     GtkWidget *sliderR1=multibar_slider_new(6,ratio_labels,ratio_levels,1);
     GtkWidget *sliderR2=multibar_slider_new(6,ratio_labels,ratio_levels,1);
 
@@ -722,7 +722,7 @@
     GtkWidget *suppress_ratio_slider=multibar_slider_new(6,ratio_labels,ratio_levels,1);
     GtkWidget *suppress_depth_slider=multibar_slider_new(6,depth_labels,depth_levels,1);
     GtkWidget *suppress_decay_readout=readout_new("fast");
-    GtkWidget *suppress_ratio_readout=readout_new("1.5:1");
+    GtkWidget *suppress_ratio_readout=readout_new("1.50:1");
     GtkWidget *suppress_depth_readout=readout_new("gate");
 
     //GtkWidget *label1=gtk_label_new("mode:");

<p><p>1.3       +65 -10    postfish/multicompand.c

Index: multicompand.c
===================================================================
RCS file: /usr/local/cvsroot/postfish/multicompand.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- multicompand.c	8 Mar 2004 02:08:23 -0000	1.2
+++ multicompand.c	8 Mar 2004 07:20:15 -0000	1.3
@@ -222,15 +222,6 @@
              j<=ms.attack[h][i])
             break;
         }
-      
-      fprintf(stderr,"band %d: filter %d/%d/%d, corner frequency %f, %f-%f\n",i,
-	      ms.rmschoice[h][i],
-	      ms.attack[h][i],
-	      ms.decay[h][i],
-	      iir_corner_list[ms.rmschoice[h][i]],
-	      iir_corner_list[ms.attack[h][i]],
-	      iir_corner_list[ms.decay[h][i]]);
-      
     }
   }
   
@@ -460,6 +451,68 @@
   }
 }
 
+static void suppress(float *peak, float *rms, float *gain,
+		     envelope_state *e){
+  /* (since this one is kinda unique) The Suppressor....
+
+     Reverberation in a measurably live environment displays
+     log-amplitute decay with time (linear decay when plotted on a dB
+     scale).
+
+     In its simplest form, the suppressor follows actual {RMS|peak}
+     amplitude attacks but chooses a slower-than-actual decay, then
+     expands according to the dB distance between the slow and actual
+     decay.
+
+     The 'depth' setting is used to limit the expanded distance
+     between actual and slow decy; it's also used to drag the slow
+     decay down with the actual decay once the expansion has hit the
+     depth limit.
+
+     Thus, the suppressor can be used to 'dry out' a very 'wet'
+     reverberative track. */
+
+  int ii;
+  float *envelope; 
+  float ratio=1.+c.suppress_ratio/1000.;
+  float decay=c.suppress_decay/(float)(1024*1024);
+  float depth=-c.suppress_depth/10.;
+  float chase=e->suppress_decay_chase;
+  float undepth=depth/ratio;
+
+  switch(c.suppress_mode){
+  case 0:
+    envelope=rms;
+    break;
+  default:
+    envelope=peak;
+    break;
+  }
+
+  for(ii=0;ii<input_size;ii++){
+    float current=envelope[ii];
+
+    chase+=decay;
+    if(current>chase){
+      chase=current;
+    }else{
+      /* yes, need to expand */
+      float difference = chase - current;
+      float expanded = difference * ratio;
+
+      if(expanded>depth){
+	chase=current+undepth;
+	gain[ii]-=depth-undepth;
+      }else{
+	gain[ii]-=expanded-difference;
+
+      }
+    }
+  }
+
+  e->suppress_decay_chase=chase;
+}
+
 static void final_followers(float *gain,envelope_state *e,int attack,int decay){
   float iirx0,iirx1;
   float iiry0,iiry1;
@@ -483,7 +536,8 @@
   iirx1=e->env1_x[1];
   iiry0=e->env1_y[0];
   iiry1=e->env1_y[1];
-  
+
+  /* assymetrical filter; in general, fast attack, slow decay */
   for(k=0;k<input_size;k+=2){
     if(iiry0>iiry1){
       /* decay */
@@ -613,6 +667,7 @@
         range_compand(peak,rms,gain);
         
         /* run the suppressor */
+	suppress(peak,rms,gain,ms.e[j]);
         
         //_analysis_append("peak",j,gain,input_size,offset);
 

<p><p>1.41      +2 -2      postfish/version.h

Index: version.h
===================================================================
RCS file: /usr/local/cvsroot/postfish/version.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- version.h	8 Mar 2004 02:08:23 -0000	1.40
+++ version.h	8 Mar 2004 07:20:15 -0000	1.41
@@ -1,2 +1,2 @@
-#define VERSION "$Id: version.h,v 1.40 2004/03/08 02:08:23 xiphmont Exp $ "
-/* DO NOT EDIT: Automated versioning hack [Sun Mar  7 20:57:40 EST 2004] */
+#define VERSION "$Id: version.h,v 1.41 2004/03/08 07:20:15 xiphmont Exp $ "
+/* DO NOT EDIT: Automated versioning hack [Mon Mar  8 02:18:37 EST 2004] */

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list