diff options
Diffstat (limited to 'compressor~')
-rw-r--r-- | compressor~/CHANGES.LOG | 2 | ||||
-rw-r--r-- | compressor~/INSTALL | 15 | ||||
-rw-r--r-- | compressor~/Makefile | 82 | ||||
-rw-r--r-- | compressor~/README | 19 | ||||
-rw-r--r-- | compressor~/compressor~.c | 105 | ||||
-rw-r--r-- | compressor~/help-compressor~.pd | 14 |
6 files changed, 237 insertions, 0 deletions
diff --git a/compressor~/CHANGES.LOG b/compressor~/CHANGES.LOG new file mode 100644 index 0000000..0c44e99 --- /dev/null +++ b/compressor~/CHANGES.LOG @@ -0,0 +1,2 @@ +0.1 + initial compressor~ implementation diff --git a/compressor~/INSTALL b/compressor~/INSTALL new file mode 100644 index 0000000..8139fba --- /dev/null +++ b/compressor~/INSTALL @@ -0,0 +1,15 @@ +untar in /my/pd/dir/externs + +cd /my/pd/dir/externs/compressor~ + +make clean + +make + +make install + +open help-compressor~.pd + +Thanx for getting here. +Yves/ +comments and bugs @ ydegoyon@free.fr diff --git a/compressor~/Makefile b/compressor~/Makefile new file mode 100644 index 0000000..d513669 --- /dev/null +++ b/compressor~/Makefile @@ -0,0 +1,82 @@ +NAME=compressor~ +CSYM=compressor~ + +current: pd_linux + +# ----------------------- NT ----------------------- + +pd_nt: $(NAME).dll + +.SUFFIXES: .dll + +PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo +VC="C:\Program Files\Microsoft Visual Studio\Vc98" + +PDNTINCLUDE = /I. /I\tcl\include /I\ftp\pd\src /I$(VC)\include + +PDNTLDIR = $(VC)\lib +PDNTLIB = $(PDNTLDIR)\libc.lib \ + $(PDNTLDIR)\oldnames.lib \ + $(PDNTLDIR)\kernel32.lib \ + \ftp\pd\bin\pd.lib + +.c.dll: + cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c + link /dll /export:$(CSYM)_setup $*.obj $(PDNTLIB) + +# ----------------------- IRIX 5.x ----------------------- + +pd_irix5: $(NAME).pd_irix5 + +.SUFFIXES: .pd_irix5 + +SGICFLAGS5 = -o32 -DPD -DUNIX -DIRIX -O2 + +SGIINCLUDE = -I../../src + +.c.pd_irix5: + cc $(SGICFLAGS5) $(SGIINCLUDE) -o $*.o -c $*.c + ld -elf -shared -rdata_shared -o $*.pd_irix5 $*.o + rm $*.o + +# ----------------------- IRIX 6.x ----------------------- + +pd_irix6: $(NAME).pd_irix6 + +.SUFFIXES: .pd_irix6 + +SGICFLAGS6 = -n32 -DPD -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \ + -OPT:roundoff=3 -OPT:IEEE_arithmetic=3 -OPT:cray_ivdep=true \ + -Ofast=ip32 + +.c.pd_irix6: + cc $(SGICFLAGS6) $(SGIINCLUDE) -o $*.o -c $*.c + ld -n32 -IPA -shared -rdata_shared -o $*.pd_irix6 $*.o + rm $*.o + +# ----------------------- LINUX i386 ----------------------- + +pd_linux: $(NAME).pd_linux + +.SUFFIXES: .pd_linux + +LINUXCFLAGS = -DPD -DUNIX -DICECAST -O2 -funroll-loops -fomit-frame-pointer \ + -Wall -W -Wno-shadow -Wstrict-prototypes \ + -Wno-unused -Wno-parentheses -Wno-switch #-Werror + +LINUXINCLUDE = -I../../src + +.c.pd_linux: + cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c + ld -export_dynamic -shared -o $*.pd_linux $*.o -lc -lm + strip --strip-unneeded $*.pd_linux + rm -f $*.o ../$*.pd_linux + ln -s $*/$*.pd_linux .. + +# ---------------------------------------------------------- + +install: + cp help-*.pd ../../doc/5.reference + +clean: + rm -f *.o *.pd_* so_locations diff --git a/compressor~/README b/compressor~/README new file mode 100644 index 0000000..401ee0f --- /dev/null +++ b/compressor~/README @@ -0,0 +1,19 @@ +Version 0.01
+copyright 2002 by Yves Degoyon.
+
+tarballs and updates available @ http://ydegoyon.free.fr
+
+compressor~ : a compressor of audio signals
+
+To install compressor~, follow the steps from INSTALL
+
+This software is published under GPL terms.
+
+This is software with ABSOLUTELY NO WARRANTY.
+Use it at your OWN RISK. It's possible to damage e.g. hardware or your hearing
+due to a bug or for other reasons.
+We do not warrant that the program is free of infringement of any third-party
+patents.
+
+*****************************************************************************
+
diff --git a/compressor~/compressor~.c b/compressor~/compressor~.c new file mode 100644 index 0000000..e58fda2 --- /dev/null +++ b/compressor~/compressor~.c @@ -0,0 +1,105 @@ +/* Copyright (c) 2002 Yves Degoyon. */ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL */ +/* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ +/* */ +/* compressor~ -- compresses audio signal according to a factor */ +/* */ +/* 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. */ +/* */ +/* See file LICENSE for further informations on licensing terms. */ +/* */ +/* 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. */ +/* */ +/* Based on PureData by Miller Puckette and others. */ +/* */ +/* Made while listening to : */ +/* */ +/* "I can't get you out of my head" */ +/* "Na, na, na, na, na, na, na, na, na, ...." */ +/* Kylie Minogue ( without Nick Cave ) */ +/* ---------------------------------------------------------------------------- */ + +#include "m_pd.h" +#include <stdlib.h> +#include <math.h> + +static char *compressor_version = "compressor~: an audio compressor, version 0.1 (ydegoyon@free.fr)"; + +typedef struct _compressor +{ + t_object x_obj; + t_float x_strength; + t_float x_pifactor; + t_float x_f; +} t_compressor; + +static t_class *compressor_class; + +static void compressor_strength(t_compressor *x, t_floatarg fstrength ) +{ + if (fstrength < -1.0) + { + x->x_strength = -1.0; + } + else if (fstrength > 5) + { + x->x_strength = 5; + } + else + { + x->x_strength = fstrength; + } + x->x_pifactor = pow( M_PI, x->x_strength ); +} + +static void *compressor_new(void) +{ + t_compressor *x = (t_compressor *)pd_new(compressor_class); + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("strength")); + x->x_strength = 0.; + x->x_pifactor = pow( M_PI, x->x_strength ); + outlet_new(&x->x_obj, &s_signal); + return (x); +} + +static t_int *compressor_perform(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_float *out = (t_float *)(w[2]); + int n = (int)(w[3]); + t_compressor *x = (t_compressor*)(w[4]); + t_float isample_fact = x->x_pifactor; + t_float osample_fact = 2.0 / M_PI; + + while (n--) { + *out = atan (*in * isample_fact) * osample_fact; + out++; in++; + } + return (w+5); +} + +static void compressor_dsp(t_compressor *x, t_signal **sp) +{ + dsp_add(compressor_perform, 4, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n, x ); +} + +void compressor_tilde_setup(void) +{ + post( compressor_version ); + compressor_class = class_new(gensym("compressor~"), (t_newmethod)compressor_new, 0, + sizeof(t_compressor), 0, 0); + CLASS_MAINSIGNALIN( compressor_class, t_compressor, x_f ); + class_sethelpsymbol( compressor_class, gensym("help-compressor~.pd") ); + class_addmethod(compressor_class, (t_method)compressor_dsp, gensym("dsp"), 0); + class_addmethod(compressor_class, (t_method)compressor_strength, gensym("strength"), A_FLOAT, 0); +} diff --git a/compressor~/help-compressor~.pd b/compressor~/help-compressor~.pd new file mode 100644 index 0000000..0b5d277 --- /dev/null +++ b/compressor~/help-compressor~.pd @@ -0,0 +1,14 @@ +#N canvas 251 75 572 506 10; +#X obj 149 202 dac~; +#X obj 150 128 compressor~; +#X text 290 253 comments & bugs @ ydegoyon.free.fr; +#X text 243 19 Compressor~ : an audio compressor; +#X floatatom 259 86 5 -100 500; +#X obj 108 41 osc~ 250; +#X text 305 83 strength [ min : -1 \; max = 5 \; default = 0 ]; +#X obj 215 88 / 100; +#X connect 1 0 0 0; +#X connect 1 0 0 1; +#X connect 4 0 7 0; +#X connect 5 0 1 0; +#X connect 7 0 1 1; |