Commit e09c3f78 authored by Monty Montgomery's avatar Monty Montgomery

Reverb suppression actually works!  w00t!


git-svn-id: https://svn.xiph.org/trunk/postfish@5911 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent 52b2fd84
......@@ -203,12 +203,12 @@ static void static_compressor_change(GtkWidget *w,gpointer in){
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 @@ static void static_expander_change(GtkWidget *w,gpointer in){
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 @@ static void static_decay_change(GtkWidget *w,gpointer in,sig_atomic_t *v){
else
sprintf(buffer,"%4.1f",ms/1000);
if(ms<=1)
if(ms<=10)
sprintf(buffer," fast");
if(ms>99999.)
......@@ -350,7 +350,7 @@ static void suppress_decay_change(GtkWidget *w,gpointer in){
else
sprintf(buffer,"%4.1f",ms/1000);
if(ms<=1)
if(ms<=10)
sprintf(buffer," fast");
if(ms>99999.)
......@@ -366,12 +366,12 @@ static void suppress_ratio_change(GtkWidget *w,gpointer in){
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 @@ void compandpanel_create(postfish_mainpanel *mp,
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 @@ void compandpanel_create(postfish_mainpanel *mp,
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 @@ void compandpanel_create(postfish_mainpanel *mp,
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 @@ void compandpanel_create(postfish_mainpanel *mp,
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:");
......
......@@ -222,15 +222,6 @@ int multicompand_load(void){
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 range_compand(float *peak, float *rms, float *gain){
}
}
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 @@ static void final_followers(float *gain,envelope_state *e,int attack,int decay){
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 @@ static void multicompand_work(float **peakfeed,float **rmsfeed){
range_compand(peak,rms,gain);
/* run the suppressor */
suppress(peak,rms,gain,ms.e[j]);
//_analysis_append("peak",j,gain,input_size,offset);
......
#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] */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment