Commit f5b87249 authored by Monty Montgomery's avatar Monty Montgomery

Tweak overall usability of mutiband compander

Changes not yet tested; debug begins now.


git-svn-id: https://svn.xiph.org/trunk/postfish@5953 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent d8203104
......@@ -22,10 +22,12 @@ IEEE=-DNASTY_IEEE_FLOAT32_HACK_IS_FASTER_THAN_LOG=1
SRC = main.c mainpanel.c multibar.c readout.c input.c output.c clippanel.c \
declip.c reconstruct.c multicompand.c windowbutton.c subpanel.c \
feedback.c freq.c eq.c eqpanel.c compandpanel.c subband.c lpc.c
feedback.c freq.c eq.c eqpanel.c compandpanel.c subband.c lpc.c \
bessel.c
OBJ = main.o mainpanel.o multibar.o readout.o input.o output.o clippanel.o \
declip.o reconstruct.o multicompand.o windowbutton.o subpanel.o \
feedback.o freq.o eq.o eqpanel.o compandpanel.o subband.o lpc.o
feedback.o freq.o eq.o eqpanel.o compandpanel.o subband.o lpc.o \
bessel.o
GCF = `pkg-config --cflags gtk+-2.0` -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED
all:
......
/*
*
* postfish
*
* Copyright (C) 2002-2004 Monty
*
* Postfish 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, or (at your option)
* any later version.
*
* Postfish 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 Postfish; see the file COPYING. If not, write to the
* Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
*/
/* code derived directly from mkfilter by the late A.J. Fisher,
University of York <fisher@minster.york.ac.uk> September 1992; this
is only the minimum code needed to build an arbitrary 2nd order
Bessel filter */
#include "postfish.h"
#define TWOPI (2.0 * M_PIl)
#define EPS 1e-10
#define MAXORDER 2
#define MAXPZ 4
typedef struct {
double re, im;
} complex;
typedef struct {
complex poles[MAXPZ], zeros[MAXPZ];
int numpoles, numzeros;
} pzrep;
static complex cdiv(complex z1, complex z2){
double mag = (z2.re * z2.re) + (z2.im * z2.im);
complex ret={((z1.re * z2.re) + (z1.im * z2.im)) / mag,
((z1.im * z2.re) - (z1.re * z2.im)) / mag};
return ret;
}
static complex cmul(complex z1, complex z2){
complex ret={z1.re*z2.re - z1.im*z2.im,
z1.re*z2.im + z1.im*z2.re};
return ret;
}
static complex cadd(complex z1, complex z2){
z1.re+=z2.re;
z1.im+=z2.im;
return z1;
}
static complex csub(complex z1, complex z2){
z1.re-=z2.re;
z1.im-=z2.im;
return z1;
}
static complex eval(complex coeffs[], int npz, complex z){
complex sum = (complex){0.0,0.0};
int i;
for (i = npz; i >= 0; i--) sum = cadd(cmul(sum, z), coeffs[i]);
return sum;
}
static complex evaluate(complex topco[], int nz, complex botco[], int np, complex z){
return cdiv(eval(topco, nz, z),eval(botco, np, z));
}
static complex blt(complex pz){
complex two={2.,0.};
return cdiv(cadd(two, pz), csub(two, pz));
}
static void multin(complex w, int npz, complex coeffs[]){
int i;
complex nw = (complex){-w.re , -w.im};
for (i = npz; i >= 1; i--)
coeffs[i] = cadd(cmul(nw, coeffs[i]), coeffs[i-1]);
coeffs[0] = cmul(nw, coeffs[0]);
}
static void expand(complex pz[], int npz, complex coeffs[]){
/* compute product of poles or zeros as a polynomial of z */
int i;
coeffs[0] = (complex){1.0,0.0};
for (i=0; i < npz; i++) coeffs[i+1] = (complex){0.0,0.0};
for (i=0; i < npz; i++) multin(pz[i], npz, coeffs);
/* check computed coeffs of z^k are all real */
for (i=0; i < npz+1; i++){
if (fabs(coeffs[i].im) > EPS){
fprintf(stderr, "mkfilter: coeff of z^%d is not real; poles/zeros are not complex conjugates\n", i);
exit(1);
}
}
}
double mkbessel_2(double raw_alpha,double *ycoeff0,double *ycoeff1){
int i;
pzrep splane, zplane;
complex topcoeffs[MAXPZ+1], botcoeffs[MAXPZ+1];
double warped_alpha;
complex dc_gain;
memset(&splane,0,sizeof(splane));
memset(&zplane,0,sizeof(zplane));
splane.poles[splane.numpoles++] = (complex){ -1.10160133059e+00, 6.36009824757e-01};
splane.poles[splane.numpoles++] = (complex){ -1.10160133059e+00, -6.36009824757e-01};
warped_alpha = tan(M_PIl * raw_alpha) / M_PIl;
for (i = 0; i < splane.numpoles; i++){
splane.poles[i].re *= TWOPI * warped_alpha;
splane.poles[i].im *= TWOPI * warped_alpha;
}
zplane.numpoles = splane.numpoles;
zplane.numzeros = splane.numzeros;
for (i=0; i < zplane.numpoles; i++)
zplane.poles[i] = blt(splane.poles[i]);
for (i=0; i < zplane.numzeros; i++)
zplane.zeros[i] = blt(splane.zeros[i]);
while (zplane.numzeros < zplane.numpoles)
zplane.zeros[zplane.numzeros++] = (complex){-1.0,0.};
expand(zplane.zeros, zplane.numzeros, topcoeffs);
expand(zplane.poles, zplane.numpoles, botcoeffs);
dc_gain = evaluate(topcoeffs, zplane.numzeros, botcoeffs, zplane.numpoles, (complex){1.0,0.0});
*ycoeff0 = -(botcoeffs[0].re / botcoeffs[zplane.numpoles].re);
*ycoeff1 = -(botcoeffs[1].re / botcoeffs[zplane.numpoles].re);
return hypot(dc_gain.re,dc_gain.im);
}
/*
*
* postfish
*
* Copyright (C) 2002-2004 Monty
*
* Postfish 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, or (at your option)
* any later version.
*
* Postfish 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 Postfish; see the file COPYING. If not, write to the
* Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
*/
extern double mkbessel_2(double raw_alpha,double *ycoeff0,double *ycoeff1);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -46,31 +46,39 @@ static char *multicomp_freq_labels[multicomp_banks][multicomp_freqs_max]={
};
typedef struct {
sig_atomic_t static_g[multicomp_freqs_max];
sig_atomic_t static_e[multicomp_freqs_max];
sig_atomic_t static_c[multicomp_freqs_max];
sig_atomic_t static_o[multicomp_freqs_max];
sig_atomic_t static_u[multicomp_freqs_max];
} banked_compand_settings;
typedef struct {
sig_atomic_t link_mode;
sig_atomic_t static_mode;
sig_atomic_t static_c_trim;
sig_atomic_t static_e_trim;
sig_atomic_t static_g_trim;
sig_atomic_t static_c_decay;
sig_atomic_t static_e_decay;
sig_atomic_t static_g_decay;
sig_atomic_t static_c_ratio;
sig_atomic_t static_e_ratio;
sig_atomic_t over_mode;
sig_atomic_t over_softknee;
sig_atomic_t over_ratio;
sig_atomic_t over_limit;
sig_atomic_t base_ratio;
sig_atomic_t over_attack;
sig_atomic_t over_decay;
sig_atomic_t over_lookahead;
sig_atomic_t over_trim;
sig_atomic_t envelope_mode;
sig_atomic_t envelope_c;
sig_atomic_t under_mode;
sig_atomic_t under_softknee;
sig_atomic_t under_ratio;
sig_atomic_t under_limit;
sig_atomic_t under_attack;
sig_atomic_t under_decay;
sig_atomic_t under_lookahead;
sig_atomic_t under_trim;
sig_atomic_t suppress_mode;
sig_atomic_t suppress_ratio;
sig_atomic_t suppress_attack;
sig_atomic_t suppress_decay;
sig_atomic_t suppress_depth;
sig_atomic_t suppress_release;
sig_atomic_t link_mode;
} other_compand_settings;
......@@ -80,4 +88,10 @@ extern time_linkage *multicompand_read(time_linkage *in);
extern void multicompand_set_bank(int bank);
extern int pull_multicompand_feedback(float **peak,float **rms,int *bands);
extern int multicompand_over_attack_set(float msec);
extern int multicompand_over_decay_set(float msec);
extern int multicompand_under_attack_set(float msec);
extern int multicompand_under_decay_set(float msec);
extern int multicompand_suppress_attack_set(float msec);
extern int multicompand_suppress_decay_set(float msec);
extern int multicompand_suppress_release_set(float msec);
......@@ -20,7 +20,12 @@ style "panel-text" {
}
style "small-marker" {
font_name = "sans 8"
fg[NORMAL]="#905050"
font_name = "sans 6"
}
style "scale-marker" {
font_name = "sans 7"
}
style "frame-label" {
......@@ -59,7 +64,7 @@ style "multibar" {
text[NORMAL]="#c0c0d0"
text[ACTIVE]="#ffb0b0"
font_name = "sans 6"
font_name = "sans 7"
}
style "multislide" {
......@@ -138,6 +143,7 @@ style "side" {
}
widget "*.GtkLabel" style "panel-text"
widget "*.scalemarker" style "scale-marker"
widget "*.smallmarker" style "small-marker"
widget "*.color0" style "left"
......
#define VERSION "$Id: version.h,v 1.42 2004/03/08 11:07:06 xiphmont Exp $ "
/* DO NOT EDIT: Automated versioning hack [Mon Mar 8 06:01:38 EST 2004] */
#define VERSION "$Id: version.h,v 1.43 2004/03/17 10:32:04 xiphmont Exp $ "
/* DO NOT EDIT: Automated versioning hack [Wed Mar 17 05:30:15 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