diff options
author | Cyrille Henry <nusmuk@users.sourceforge.net> | 2010-11-10 11:40:46 +0000 |
---|---|---|
committer | Cyrille Henry <nusmuk@users.sourceforge.net> | 2010-11-10 11:40:46 +0000 |
commit | 6b20330d5b3b1f8f2d6bb5016dacfecfce1fbe33 (patch) | |
tree | abdd57bd300ccf8fc0bdd8fe56ead82b0e84a906 /tab | |
parent | de31babc3eddcbabb47a33dae001777b68abbd30 (diff) |
clean of everything that are in double.
svn path=/trunk/externals/nusmuk/; revision=14362
Diffstat (limited to 'tab')
-rwxr-xr-x | tab/makefile | 100 | ||||
-rw-r--r-- | tab/tabosc4c~-help.pd | 104 | ||||
-rw-r--r-- | tab/tabosc4c~.c | 244 | ||||
-rw-r--r-- | tab/tabosci~-help.pd | 258 | ||||
-rw-r--r-- | tab/tabosci~.c | 320 | ||||
-rw-r--r-- | tab/tabread4c~-help.pd | 44 | ||||
-rw-r--r-- | tab/tabread4c~.c | 176 | ||||
-rw-r--r-- | tab/tabreadi~.c | 254 | ||||
-rw-r--r-- | tab/vdc~-help.pd | 18 | ||||
-rw-r--r-- | tab/vdc~.c | 93 |
10 files changed, 0 insertions, 1611 deletions
diff --git a/tab/makefile b/tab/makefile deleted file mode 100755 index 4b64dcf..0000000 --- a/tab/makefile +++ /dev/null @@ -1,100 +0,0 @@ -current:
- echo make pd_linux, pd_nt, pd_irix5, or pd_irix6
-
-clean: ; rm -f *.pd_linux *.o
-
-# ----------------------- NT -----------------------
-
-pd_nt: tabosc4c~.dll tabread4c~.dll tabosc4i~.dll
-
-.SUFFIXES: .dll
-
-PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo
-VC="C:\Program Files\Microsoft Visual Studio\Vc98"
-
-PDNTINCLUDE = /I. /I$(VC)\include /I..\..\..\pd\src\
-
-PDNTLDIR = $(VC)\lib
-PDNTLIB = $(PDNTLDIR)\libc.lib \
- $(PDNTLDIR)\oldnames.lib \
- $(PDNTLDIR)\kernel32.lib \
- \pds\win32\pd36\bin\pd.lib
-
-.c.dll:
- cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c
- link /dll /export:$*_setup $*.obj $(PDNTLIB)
-
-# ----------------------- IRIX 5.x -----------------------
-
-pd_irix5: tabosc4c~.pd_irix5 tabread4c~.pd_irix5 tabosc4i~.pd_irix5
-
-.SUFFIXES: .pd_irix5
-
-SGICFLAGS5 = -o32 -DPD -DUNIX -DIRIX -O2
-
-
-SGIINCLUDE = -I../../../pd/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: tabosc4c~.pd_irix6 tabread4c~.pd_irix6 tabosci~.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 -IPA -n32 -shared -rdata_shared -o $*.pd_irix6 $*.o
- rm $*.o
-
-# ----------------------- LINUX i386 -----------------------
-
-pd_linux: tabosci~.pd_linux tabosc4c~.pd_linux tabread4c~.pd_linux
-
-.SUFFIXES: .pd_linux
-
-LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer \
- -Wall -W -Wshadow -Wstrict-prototypes -Werror \
- -Wno-unused -Wno-parentheses -Wno-switch
-
-LINUXINCLUDE = -I../../../pd/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 $*.o
-
-# ----------------------- Mac OS X (Darwin) -----------------------
-
-
-pd_darwin: tabosci~.pd_darwin tabosc4c~.pd_darwin tabread4c~.pd_darwin
-
-.SUFFIXES: .pd_darwin
-
-DARWINCFLAGS = -DPD -DUNIX -DMACOSX -O2 \
- -Wall -W -Wshadow -Wstrict-prototypes \
- -Wno-unused -Wno-parentheses -Wno-switch
-
-# where is your m_pd.h ???
-DARWININCLUDE = -I/. -I../../../pd/src -I../../../pd/obj -I/Applications/Pd-0.42.5-extended-20091214.app/Contents/Resources/include
-
-.c.pd_darwin:
- cc $(DARWINCFLAGS) $(DARWININCLUDE) -o $*.o -c $*.c
- cc -bundle -undefined suppress -flat_namespace -o $*.pd_darwin $*.o
- rm -f $*.o ../$*.pd_darwin
- ln -s $*/$*.pd_darwin ..
-
-
-
-
-
-
diff --git a/tab/tabosc4c~-help.pd b/tab/tabosc4c~-help.pd deleted file mode 100644 index e8a209a..0000000 --- a/tab/tabosc4c~-help.pd +++ /dev/null @@ -1,104 +0,0 @@ -#N canvas 298 40 774 479 12; -#X floatatom 41 42 9 0 0 0 - - -; -#X obj 41 63 sig~ 100; -#N canvas 0 0 450 300 (subpatch) 0; -#X array array99 11 float 0; -#X coords 0 1 10 -1 250 200 1; -#X restore 436 180 graph; -#X obj 437 48 loadbang; -#X floatatom 41 -1 5 0 0 0 - - -; -#X obj 41 19 mtof; -#X floatatom 77 307 0 0 0 0 - - -; -#N canvas 159 26 706 447 output 0; -#X obj 414 196 t b; -#X obj 414 134 f; -#X obj 414 73 inlet; -#X text 421 36 mute; -#X obj 414 227 f; -#X msg 521 218 0; -#X msg 414 104 bang; -#X obj 414 166 moses 1; -#X obj 521 187 t b f; -#X obj 486 143 moses 1; -#X obj 102 181 dbtorms; -#X obj 486 113 r master-lvl; -#X obj 102 52 r master-lvl; -#X obj 414 257 s master-lvl; -#X obj 26 222 inlet~; -#X obj 244 50 inlet; -#X text 244 22 level; -#X obj 244 122 s master-lvl; -#X msg 118 80 set \$1; -#X obj 118 109 outlet; -#X msg 262 78 \; pd dsp 1; -#X obj 102 238 line~; -#X obj 26 259 *~; -#X obj 26 295 dac~; -#X obj 102 210 pack 0 50; -#X text 24 195 audio; -#X text 114 135 show level; -#X connect 0 0 4 0; -#X connect 1 0 7 0; -#X connect 2 0 6 0; -#X connect 4 0 13 0; -#X connect 5 0 13 0; -#X connect 6 0 1 0; -#X connect 7 0 0 0; -#X connect 7 1 8 0; -#X connect 8 0 5 0; -#X connect 9 1 4 1; -#X connect 10 0 24 0; -#X connect 11 0 1 1; -#X connect 11 0 9 0; -#X connect 12 0 10 0; -#X connect 12 0 18 0; -#X connect 14 0 22 0; -#X connect 15 0 17 0; -#X connect 15 0 20 0; -#X connect 18 0 19 0; -#X connect 21 0 22 1; -#X connect 22 0 23 0; -#X connect 22 0 23 1; -#X connect 24 0 21 0; -#X restore 43 333 pd output; -#X msg 113 307 MUTE; -#X obj 42 123 tabosc4~ array99; -#X obj 179 230 *~; -#X msg 356 42 \$1 30; -#X obj 359 19 hsl 128 15 0 1 0 0 empty empty empty -2 -8 0 10 -262144 --1 -1 0 1; -#X obj 357 89 -~ 1; -#X obj 356 113 *~ -1; -#X obj 356 66 line~; -#X obj 43 231 *~; -#X text 498 18 tabosc4~; -#X text 279 17 tabosc4c~; -#X msg 294 67 0; -#X obj 178 123 tabosc4c~ array99; -#X msg 437 75 \; array99 resize 11 \; array99 0 0 0 -0.5 -0.5 1 -1 -0.5 -1 0 0 0 \; pd dsp 1 \;; -#X text 40 395 tabosc4c~ is a drop in remplacement for tabosc4~ \, -but offer a 4 points cubic interpolation with tengent continuity. So -\, in some case \, quality is better than the standart interpolation -; -#X connect 0 0 1 0; -#X connect 1 0 9 0; -#X connect 1 0 20 0; -#X connect 3 0 21 0; -#X connect 4 0 5 0; -#X connect 5 0 0 0; -#X connect 6 0 7 1; -#X connect 7 0 6 0; -#X connect 8 0 7 2; -#X connect 9 0 16 0; -#X connect 10 0 7 0; -#X connect 11 0 15 0; -#X connect 12 0 11 0; -#X connect 13 0 14 0; -#X connect 14 0 10 1; -#X connect 15 0 13 0; -#X connect 15 0 16 1; -#X connect 16 0 7 0; -#X connect 19 0 9 1; -#X connect 19 0 20 1; -#X connect 20 0 10 0; diff --git a/tab/tabosc4c~.c b/tab/tabosc4c~.c deleted file mode 100644 index ad4e7a2..0000000 --- a/tab/tabosc4c~.c +++ /dev/null @@ -1,244 +0,0 @@ -// tabosc4c~ -// can replace with tabosc4~ -// most of this code comes from pd. just the interpolation shematic is diferent. - -/* -This software is copyrighted by Miller Puckette and others. The following -terms (the "Standard Improved BSD License") apply to all files associated with -the software unless explicitly disclaimed in individual files: - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. -3. The name of the author may not be used to endorse or promote - products derived from this software without specific prior - written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. -*/ - -// Cyrille Henry 06 2008 - - -#include "m_pd.h" - -/******************** tabosc4c~ ***********************/ - -/* this is all copied from d_osc.c... what include file could this go in? */ -#define UNITBIT32 1572864. /* 3*2^19; bit 32 has place value 1 */ - - /* machine-dependent definitions. These ifdefs really - should have been by CPU type and not by operating system! */ -#ifdef IRIX - /* big-endian. Most significant byte is at low address in memory */ -#define HIOFFSET 0 /* word offset to find MSB */ -#define LOWOFFSET 1 /* word offset to find LSB */ -#define int32 long /* a data type that has 32 bits */ -#endif /* IRIX */ - -#ifdef MSW - /* little-endian; most significant byte is at highest address */ -#define HIOFFSET 1 -#define LOWOFFSET 0 -#define int32 long -#endif - -#if defined(__FreeBSD__) || defined(__APPLE__) -#include <machine/endian.h> -#endif - -#ifdef __linux__ -#include <endian.h> -#endif - -#if defined(__unix__) || defined(__APPLE__) -#if !defined(BYTE_ORDER) || !defined(LITTLE_ENDIAN) -#error No byte order defined -#endif - -#if BYTE_ORDER == LITTLE_ENDIAN -#define HIOFFSET 1 -#define LOWOFFSET 0 -#else -#define HIOFFSET 0 /* word offset to find MSB */ -#define LOWOFFSET 1 /* word offset to find LSB */ -#endif /* __BYTE_ORDER */ -#include <sys/types.h> -#define int32 int32_t -#endif /* __unix__ or __APPLE__*/ - -union tabfudge -{ - double tf_d; - int32 tf_i[2]; -}; - -static t_class *tabosc4c_tilde_class; - -typedef struct _tabosc4c_tilde -{ - t_object x_obj; - t_float x_fnpoints; - t_float x_finvnpoints; - t_word *x_vec; - t_symbol *x_arrayname; - t_float x_f; - double x_phase; - t_float x_conv; -} t_tabosc4c_tilde; - -static void *tabosc4c_tilde_new(t_symbol *s) -{ - t_tabosc4c_tilde *x = (t_tabosc4c_tilde *)pd_new(tabosc4c_tilde_class); - x->x_arrayname = s; - x->x_vec = 0; - x->x_fnpoints = 512.; - x->x_finvnpoints = (1./512.); - outlet_new(&x->x_obj, gensym("signal")); - inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft1")); - x->x_f = 0; - return (x); -} - -static t_int *tabosc4c_tilde_perform(t_int *w) -{ - t_tabosc4c_tilde *x = (t_tabosc4c_tilde *)(w[1]); - t_sample *in = (t_sample *)(w[2]); - t_sample *out = (t_sample *)(w[3]); - int n = (int)(w[4]); - int normhipart; - union tabfudge tf; - double a3,a1,a2; // CH : for the interpolation - t_float fnpoints = x->x_fnpoints; - int mask = fnpoints - 1; - t_float conv = fnpoints * x->x_conv; - int maxindex; - t_word *tab = x->x_vec, *addr; - int i; - double dphase = fnpoints * x->x_phase + UNITBIT32; - - if (!tab) goto zero; - tf.tf_d = UNITBIT32; - normhipart = tf.tf_i[HIOFFSET]; - - while (n--) - { - t_sample frac, a, b, c, d, cminusb; - tf.tf_d = dphase; - dphase += *in++ * conv; - addr = tab + (tf.tf_i[HIOFFSET] & mask); - tf.tf_i[HIOFFSET] = normhipart; - frac = tf.tf_d - UNITBIT32; - a = addr[0].w_float; - b = addr[1].w_float; - c = addr[2].w_float; - d = addr[3].w_float; -// cminusb = c-b; -// *out++ = b + frac * ( -// cminusb - 0.1666667f * (1.-frac) * ( -// (d - a - 3.0f * cminusb) * frac + (d + 2.0f*a - 3.0f*b) ) ); -// CH -// a0 = d - c - a + b; -// a1 = a - b - a0; -// a2 = c - a; -// *out++ = ((a0*frac+a1)*frac+a2)*frac+b; - - // 4-point, 3rd-order Hermite (x-form) - a1 = 0.5f * (c - a); - a2 = a - 2.5 * b + 2.f * c - 0.5f * d; - a3 = 0.5f * (d - a) + 1.5f * (b - c); - - *out++ = ((a3 * frac + a2) * frac + a1) * frac + b; - } - - - tf.tf_d = UNITBIT32 * fnpoints; - normhipart = tf.tf_i[HIOFFSET]; - tf.tf_d = dphase + (UNITBIT32 * fnpoints - UNITBIT32); - tf.tf_i[HIOFFSET] = normhipart; - x->x_phase = (tf.tf_d - UNITBIT32 * fnpoints) * x->x_finvnpoints; - return (w+5); - zero: - while (n--) *out++ = 0; - - return (w+5); -} - -void tabosc4c_tilde_set(t_tabosc4c_tilde *x, t_symbol *s) -{ - t_garray *a; - int npoints, pointsinarray; - - x->x_arrayname = s; - if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class))) - { - if (*s->s_name) - pd_error(x, "tabosc4c~: %s: no such array", x->x_arrayname->s_name); - x->x_vec = 0; - } - else if (!garray_getfloatwords(a, &pointsinarray, &x->x_vec)) - { - pd_error(x, "%s: bad template for tabosc4c~", x->x_arrayname->s_name); - x->x_vec = 0; - } - else if ((npoints = pointsinarray - 3) != (1 << ilog2(pointsinarray - 3))) - { - pd_error(x, "%s: number of points (%d) not a power of 2 plus three", - x->x_arrayname->s_name, pointsinarray); - x->x_vec = 0; - garray_usedindsp(a); - } - else - { - x->x_fnpoints = npoints; - x->x_finvnpoints = 1./npoints; - garray_usedindsp(a); - } -} - -static void tabosc4c_tilde_ft1(t_tabosc4c_tilde *x, t_float f) -{ - x->x_phase = f; -} - -static void tabosc4c_tilde_dsp(t_tabosc4c_tilde *x, t_signal **sp) -{ - x->x_conv = 1. / sp[0]->s_sr; - tabosc4c_tilde_set(x, x->x_arrayname); - - dsp_add(tabosc4c_tilde_perform, 4, x, - sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); -} - -void tabosc4c_tilde_setup(void) -{ - tabosc4c_tilde_class = class_new(gensym("tabosc4c~"), - (t_newmethod)tabosc4c_tilde_new, 0, - sizeof(t_tabosc4c_tilde), 0, A_DEFSYM, 0); - CLASS_MAINSIGNALIN(tabosc4c_tilde_class, t_tabosc4c_tilde, x_f); - class_addmethod(tabosc4c_tilde_class, (t_method)tabosc4c_tilde_dsp, - gensym("dsp"), 0); - class_addmethod(tabosc4c_tilde_class, (t_method)tabosc4c_tilde_set, - gensym("set"), A_SYMBOL, 0); - class_addmethod(tabosc4c_tilde_class, (t_method)tabosc4c_tilde_ft1, - gensym("ft1"), A_FLOAT, 0); -} - diff --git a/tab/tabosci~-help.pd b/tab/tabosci~-help.pd deleted file mode 100644 index 5b2dad6..0000000 --- a/tab/tabosci~-help.pd +++ /dev/null @@ -1,258 +0,0 @@ -#N canvas 72 25 1011 661 12; -#X floatatom 46 55 9 0 0 0 - - -; -#N canvas 0 0 450 300 (subpatch) 0; -#X array array99 11 float 0; -#X coords 0 1 10 -1 250 200 1; -#X restore 603 153 graph; -#X obj 600 27 loadbang; -#X floatatom 46 12 5 0 135 0 - - -; -#X obj 46 32 mtof; -#X floatatom 80 380 0 0 0 0 - - -; -#N canvas 159 26 706 447 output 0; -#X obj 414 196 t b; -#X obj 414 134 f; -#X obj 414 73 inlet; -#X text 421 36 mute; -#X obj 414 227 f; -#X msg 521 218 0; -#X msg 414 104 bang; -#X obj 414 166 moses 1; -#X obj 521 187 t b f; -#X obj 486 143 moses 1; -#X obj 102 181 dbtorms; -#X obj 486 113 r master-lvl; -#X obj 102 52 r master-lvl; -#X obj 414 257 s master-lvl; -#X obj 26 222 inlet~; -#X obj 244 50 inlet; -#X text 244 22 level; -#X obj 244 122 s master-lvl; -#X msg 118 80 set \$1; -#X obj 118 109 outlet; -#X msg 262 78 \; pd dsp 1; -#X obj 102 238 line~; -#X obj 26 259 *~; -#X obj 26 295 dac~; -#X obj 102 210 pack 0 50; -#X text 24 195 audio; -#X text 114 135 show level; -#X connect 0 0 4 0; -#X connect 1 0 7 0; -#X connect 2 0 6 0; -#X connect 4 0 13 0; -#X connect 5 0 13 0; -#X connect 6 0 1 0; -#X connect 7 0 0 0; -#X connect 7 1 8 0; -#X connect 8 0 5 0; -#X connect 9 1 4 1; -#X connect 10 0 24 0; -#X connect 11 0 1 1; -#X connect 11 0 9 0; -#X connect 12 0 10 0; -#X connect 12 0 18 0; -#X connect 14 0 22 0; -#X connect 15 0 17 0; -#X connect 15 0 20 0; -#X connect 18 0 19 0; -#X connect 21 0 22 1; -#X connect 22 0 23 0; -#X connect 22 0 23 1; -#X connect 24 0 21 0; -#X restore 46 406 pd output; -#X msg 116 380 MUTE; -#X obj 200 293 *~; -#X msg 433 193 \$1 30; -#X obj 436 170 hsl 128 15 0 1 0 0 empty empty empty -2 -8 0 10 -262144 --1 -1 0 1; -#X obj 434 240 -~ 1; -#X obj 433 264 *~ -1; -#X obj 433 217 line~; -#X obj 46 294 *~; -#X msg 341 214 0; -#X msg 600 54 \; array99 resize 11 \; array99 0 0 0 -0.5 -0.5 1 -1 -0.5 -1 0 0 0 \; pd dsp 1 \;; -#X obj 200 255 tabosc4~ array99; -#X text 501 149 tabosc4~; -#N canvas 371 25 645 661 osc~ 0; -#X obj 12 133 pack~; -#X obj 14 7 inlet~; -#X text 230 14 change block size; -#X msg 77 379 0; -#X obj 47 403 f; -#X obj 63 428 + 1; -#X obj 17 379 t a b; -#X obj 16 245 gemhead; -#X text 72 7 audio input; -#X obj 13 29 rfft~; -#X obj 13 51 *~; -#X obj 53 53 *~; -#X obj 171 72 block~ 4096 4; -#X obj 12 75 /~ 4096; -#X obj 12 95 log~; -#X obj 12 114 *~ 0.05; -#X obj 12 152 list prepend 0; -#X obj 12 173 s \$0-fft; -#X obj 273 189 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 --1 -1; -#X obj 273 207 t b b; -#X obj 272 251 until; -#X msg 272 228 2048; -#X msg 331 251 0; -#X obj 272 276 f; -#X obj 287 299 + 1; -#X obj 272 349 tabread \$0-fft; -#X obj 408 348 tabread \$0-fft-lop; -#X obj 272 399 +; -#X obj 272 443 tabwrite \$0-fft-lop; -#X obj 272 324 t f f f; -#X obj 296 183 bang~; -#X obj 272 421 / 8; -#X obj 409 376 * 7; -#X obj 77 494 tabread \$0-fft-lop; -#X obj 26 611 loadbang; -#X obj 47 451 t f f; -#X obj 72 578 l; -#X obj 22 224 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 -1; -#X obj 71 547 t l b; -#X obj 18 659 curve 2; -#X obj 46 519 pack f f f; -#X floatatom 36 296 5 0 0 0 - - -; -#X floatatom 78 297 5 0 0 0 - - -; -#X obj 17 334 t a b; -#X floatatom 72 250 5 0 0 0 - - -; -#X floatatom 114 251 5 0 0 0 - - -; -#X obj 17 358 repeat 2048; -#X obj 14 277 translateXYZ -4 0 0; -#X obj 47 471 log; -#X obj 17 314 scaleXYZ 1.04 6 0; -#X msg 26 633 res 2; -#X obj 170 92 table \$0-fft 2048; -#X obj 170 112 table \$0-fft-lop 2048; -#X connect 0 0 16 0; -#X connect 1 0 9 0; -#X connect 3 0 4 0; -#X connect 4 0 5 0; -#X connect 4 0 35 0; -#X connect 5 0 4 1; -#X connect 6 0 39 0; -#X connect 6 1 4 0; -#X connect 7 0 47 0; -#X connect 9 0 10 0; -#X connect 9 0 10 1; -#X connect 9 1 11 0; -#X connect 9 1 11 1; -#X connect 10 0 13 0; -#X connect 11 0 13 0; -#X connect 13 0 14 0; -#X connect 14 0 15 0; -#X connect 15 0 0 0; -#X connect 16 0 17 0; -#X connect 18 0 19 0; -#X connect 19 0 21 0; -#X connect 19 1 22 0; -#X connect 20 0 23 0; -#X connect 21 0 20 0; -#X connect 22 0 23 1; -#X connect 23 0 24 0; -#X connect 23 0 29 0; -#X connect 24 0 23 1; -#X connect 25 0 27 0; -#X connect 26 0 32 0; -#X connect 27 0 31 0; -#X connect 29 0 25 0; -#X connect 29 1 26 0; -#X connect 29 2 28 1; -#X connect 30 0 19 0; -#X connect 31 0 28 0; -#X connect 32 0 27 1; -#X connect 33 0 40 1; -#X connect 34 0 50 0; -#X connect 35 0 48 0; -#X connect 35 1 33 0; -#X connect 36 0 39 2; -#X connect 37 0 7 0; -#X connect 38 0 36 1; -#X connect 38 1 36 0; -#X connect 40 0 38 0; -#X connect 40 0 39 1; -#X connect 41 0 49 1; -#X connect 42 0 49 2; -#X connect 43 0 46 0; -#X connect 43 1 3 0; -#X connect 44 0 47 1; -#X connect 45 0 47 2; -#X connect 46 0 6 0; -#X connect 47 0 49 0; -#X connect 48 0 40 0; -#X connect 49 0 43 0; -#X connect 50 0 39 0; -#X restore 55 356 pd osc~; -#X msg 605 385 reset \, create \, 1; -#X msg 611 407 0 \, destroy; -#X msg 46 73 \$1 100; -#X obj 46 96 line~; -#X obj 605 429 gemwin 20; -#X msg 172 77 cutoff \$1; -#X floatatom 172 14 5 0 0 0 - - -; -#X obj 172 34 mtof; -#X floatatom 185 58 9 0 0 0 - - -; -#X text 396 149 tabosc4i~; -#X obj 45 333 +~; -#X floatatom 286 52 5 0 0 0 - - -; -#X msg 286 75 upsample \$1; -#X msg 325 23 4; -#X msg 286 23 2; -#X obj 47 254 tabosci~ array99; -#X obj 214 353 oscillo~; -#X msg 364 23 8; -#X text 41 458 tabosc4c~ is a drop in remplacement for tabosc4~ \, -but offer an other 4 points interpolation. So \, in some case \, quality -is better than the standart interpolation. Moreover \, it can use table -size 2^n (and not 2^n+3) \, so you dan't have to copy the 1st 3 point -of the table at the end.; -#X text 764 387 <- draw spectrum with Gem; -#X text 43 543 You can also adjust an upsamplig factor \, and a cutoff -freq of the internal biquad. Upsample by 4 is ok most of the time. -To remove "all" spectrom folding \, main sampling rate should be 96000Hz -\, but it already gives good result at 44.1 or 48KHz...; -#X msg 171 110 cutoff 0; -#X text 255 110 no filter; -#X connect 0 0 22 0; -#X connect 2 0 16 0; -#X connect 3 0 4 0; -#X connect 4 0 0 0; -#X connect 5 0 6 1; -#X connect 6 0 5 0; -#X connect 7 0 6 2; -#X connect 8 0 30 0; -#X connect 9 0 13 0; -#X connect 10 0 9 0; -#X connect 11 0 12 0; -#X connect 12 0 14 1; -#X connect 13 0 11 0; -#X connect 13 0 8 1; -#X connect 14 0 30 0; -#X connect 15 0 17 1; -#X connect 15 0 35 1; -#X connect 17 0 8 0; -#X connect 20 0 24 0; -#X connect 21 0 24 0; -#X connect 22 0 23 0; -#X connect 23 0 17 0; -#X connect 23 0 35 0; -#X connect 25 0 35 0; -#X connect 26 0 27 0; -#X connect 27 0 28 0; -#X connect 27 0 25 0; -#X connect 30 0 6 0; -#X connect 30 0 19 0; -#X connect 30 0 36 0; -#X connect 31 0 32 0; -#X connect 32 0 35 0; -#X connect 33 0 31 0; -#X connect 34 0 31 0; -#X connect 35 0 14 0; -#X connect 37 0 31 0; -#X connect 41 0 35 0; diff --git a/tab/tabosci~.c b/tab/tabosci~.c deleted file mode 100644 index 9936c77..0000000 --- a/tab/tabosci~.c +++ /dev/null @@ -1,320 +0,0 @@ -// tabosci~ -// tabosc interpolation -// can replace tabosc4~ -// most of this code comes from pd. but with somes modifications - -/* -This software is copyrighted by Miller Puckette and others. The following -terms (the "Standard Improved BSD License") apply to all files associated with -the software unless explicitly disclaimed in individual files: - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. -3. The name of the author may not be used to endorse or promote - products derived from this software without specific prior - written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. -*/ - -// Cyrille Henry 02 2009 - - -#include "m_pd.h" -#include <math.h> - -#define max(a,b) ( ((a) > (b)) ? (a) : (b) ) -#define min(a,b) ( ((a) < (b)) ? (a) : (b) ) - -/******************** tabosci~ ***********************/ - -/* this is all copied from d_osc.c... what include file could this go in? */ -#define UNITBIT32 1572864. /* 3*2^19; bit 32 has place value 1 */ - - /* machine-dependent definitions. These ifdefs really - should have been by CPU type and not by operating system! */ -#ifdef IRIX - /* big-endian. Most significant byte is at low address in memory */ -#define HIOFFSET 0 /* word offset to find MSB */ -#define LOWOFFSET 1 /* word offset to find LSB */ -#define int32 long /* a data type that has 32 bits */ -#endif /* IRIX */ - -#ifdef MSW - /* little-endian; most significant byte is at highest address */ -#define HIOFFSET 1 -#define LOWOFFSET 0 -#define int32 long -#endif - -#if defined(__FreeBSD__) || defined(__APPLE__) -#include <machine/endian.h> -#endif - -#ifdef __linux__ -#include <endian.h> -#endif - -#if defined(__unix__) || defined(__APPLE__) -#if !defined(BYTE_ORDER) || !defined(LITTLE_ENDIAN) -#error No byte order defined -#endif - -#if BYTE_ORDER == LITTLE_ENDIAN -#define HIOFFSET 1 -#define LOWOFFSET 0 -#else -#define HIOFFSET 0 /* word offset to find MSB */ -#define LOWOFFSET 1 /* word offset to find LSB */ -#endif /* __BYTE_ORDER */ -#include <sys/types.h> -#define int32 int32_t -#endif /* __unix__ or __APPLE__*/ - -union tabfudge -{ - double tf_d; - int32 tf_i[2]; -}; - -static t_class *tabosci_tilde_class; - -typedef struct _tabosci_tilde -{ - t_object x_obj; - t_float x_fnpoints; - t_float x_finvnpoints; - t_word *x_vec; - t_symbol *x_arrayname; - t_float x_f; - double x_phase; - t_float x_conv; - t_sample x_prev_in, x_last_in, x_prev_out, x_last_out; - t_float x_fa1, x_fa2, x_fb1, x_fb2, x_fb3; - t_float cutoff; - t_int upsample; - t_float x_sr; -} t_tabosci_tilde; - -void tabosci_tilde_cutoff(t_tabosci_tilde *x, t_float cut) -{ - x->cutoff = cut; - - if (x->cutoff == 0) - { - x->x_fb1 = 1; - x->x_fb2 = 0; - x->x_fb3 = 0; - x->x_fa1 = 0; - x->x_fa2 = 0; - - x->x_prev_in = 0; - x->x_last_in = 0; - x->x_prev_out = 0; // reset filter memory - } - else - { - // filter coef to cut all high freq. - t_float tmp1, tmp2; - - tmp1 = sqrt(2)/2; - tmp1 = sinh(tmp1); - - tmp2 = x->cutoff * 2 * 3.1415926 / (x->upsample * x->x_sr); - tmp2 = min(6.28,tmp2); - - tmp1 *= sin(tmp2); - tmp2 = cos(tmp2); - - x->x_fb1 = (1-tmp2 ) /2; - x->x_fb2 = (1-tmp2 ); - x->x_fb3 = (1-tmp2 ) /2; - x->x_fa1 = -2 * tmp2; - x->x_fa2 = 1 - tmp1; - - tmp1 +=1; - - x->x_fb1 /= tmp1; - x->x_fb2 /= tmp1; - x->x_fb3 /= tmp1; - x->x_fa1 /= tmp1; - x->x_fa2 /= tmp1; - } -} - -static void *tabosci_tilde_new(t_symbol *s) -{ - t_tabosci_tilde *x = (t_tabosci_tilde *)pd_new(tabosci_tilde_class); - x->x_arrayname = s; - x->x_vec = 0; - x->x_fnpoints = 512.; - x->x_finvnpoints = (1./512.); - outlet_new(&x->x_obj, gensym("signal")); - inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft1")); - x->x_f = 0; - x->cutoff = 0; - x->upsample = 1; - x->x_sr = 0; - tabosci_tilde_cutoff(x,0); // comput filter coef - return (x); -} - -static t_int *tabosci_tilde_perform(t_int *w) -{ - t_tabosci_tilde *x = (t_tabosci_tilde *)(w[1]); - t_sample *in = (t_sample *)(w[2]); - t_sample *out = (t_sample *)(w[3]); - int n = (int)(w[4]); - int normhipart; - union tabfudge tf; - double a1,a2,a3; // CH : for the interpolation - t_float fnpoints = x->x_fnpoints; - int mask = fnpoints - 1; - t_float conv = fnpoints * x->x_conv; - int maxindex; - t_word *tab = x->x_vec, *addr; - int i; - double dphase = fnpoints * x->x_phase + UNITBIT32; - - if (!tab) goto zero; - tf.tf_d = UNITBIT32; - normhipart = tf.tf_i[HIOFFSET]; - - while (n--) - { - t_sample frac, a, b, c, d, cminusb, temp, filter_out; - - for (i=0;i<x->upsample;i++) - { - tf.tf_d = dphase; - dphase += *in/x->upsample * conv; - addr = tab + (tf.tf_i[HIOFFSET] & mask); - a = addr[0].w_float; - addr = tab + ((1+tf.tf_i[HIOFFSET]) & mask); - b = addr[0].w_float; - addr = tab + ((2+tf.tf_i[HIOFFSET]) & mask); - c = addr[0].w_float; - addr = tab + ((3+tf.tf_i[HIOFFSET]) & mask); - d = addr[0].w_float; - tf.tf_i[HIOFFSET] = normhipart; - frac = tf.tf_d - UNITBIT32; - - // 4-point, 3rd-order Hermite (x-form) - a1 = 0.5f * (c - a); - a2 = a - 2.5 * b + 2.f * c - 0.5f * d; - a3 = 0.5f * (d - a) + 1.5f * (b - c); - - temp = ((a3 * frac + a2) * frac + a1) * frac + b; - - filter_out = x->x_fb1* temp + x->x_fb2 * x->x_last_in + x->x_fb3 * x->x_prev_in - x->x_fa1 * x->x_last_out - x->x_fa2 * x->x_prev_out; - // low pass - - x->x_prev_in = x->x_last_in; - x->x_last_in = temp; - x->x_prev_out = x->x_last_out; - x->x_last_out = filter_out; - } - *out++ = x->x_last_out; - *in++; - } - - tf.tf_d = UNITBIT32 * fnpoints; - normhipart = tf.tf_i[HIOFFSET]; - tf.tf_d = dphase + (UNITBIT32 * fnpoints - UNITBIT32); - tf.tf_i[HIOFFSET] = normhipart; - x->x_phase = (tf.tf_d - UNITBIT32 * fnpoints) * x->x_finvnpoints; - return (w+5); - zero: - while (n--) *out++ = 0; - - return (w+5); -} - -void tabosci_tilde_set(t_tabosci_tilde *x, t_symbol *s) -{ - t_garray *a; - int npoints, pointsinarray; - - x->x_arrayname = s; - if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class))) - { - if (*s->s_name) - pd_error(x, "tabosci~: %s: no such array", x->x_arrayname->s_name); - x->x_vec = 0; - } - else if (!garray_getfloatwords(a, &pointsinarray, &x->x_vec)) - { - pd_error(x, "%s: bad template for tabosci~", x->x_arrayname->s_name); - x->x_vec = 0; - } - else - { - npoints = 1 << ilog2(pointsinarray); -// if ( npoints != pointsinarray) post("warning, tabosci~ is using only the first %d points of array %s",npoints, x->x_arrayname->s_name); - x->x_fnpoints = npoints; - x->x_finvnpoints = 1./npoints; - garray_usedindsp(a); - } -} - - -void tabosci_tilde_upsample(t_tabosci_tilde *x, t_float up) -{ - x->upsample = max(1,up); - tabosci_tilde_cutoff(x,x->cutoff); -} - -static void tabosci_tilde_ft1(t_tabosci_tilde *x, t_float f) -{ - x->x_phase = f; -} - -static void tabosci_tilde_dsp(t_tabosci_tilde *x, t_signal **sp) -{ - if (x->x_sr != sp[0]->s_sr) - { - x->x_sr = sp[0]->s_sr; - tabosci_tilde_cutoff(x,x->cutoff); - x->x_conv = 1. / sp[0]->s_sr; - } - tabosci_tilde_set(x, x->x_arrayname); - dsp_add(tabosci_tilde_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); -} - -void tabosci_tilde_setup(void) -{ - tabosci_tilde_class = class_new(gensym("tabosci~"), - (t_newmethod)tabosci_tilde_new, 0, - sizeof(t_tabosci_tilde), 0, A_DEFSYM, 0); - CLASS_MAINSIGNALIN(tabosci_tilde_class, t_tabosci_tilde, x_f); - class_addmethod(tabosci_tilde_class, (t_method)tabosci_tilde_dsp, - gensym("dsp"), 0); - class_addmethod(tabosci_tilde_class, (t_method)tabosci_tilde_set, - gensym("set"), A_SYMBOL, 0); - class_addmethod(tabosci_tilde_class, (t_method)tabosci_tilde_cutoff, - gensym("cutoff"), A_FLOAT, 0); - class_addmethod(tabosci_tilde_class, (t_method)tabosci_tilde_upsample, - gensym("upsample"), A_FLOAT, 0); - class_addmethod(tabosci_tilde_class, (t_method)tabosci_tilde_ft1, - gensym("ft1"), A_FLOAT, 0); -} - diff --git a/tab/tabread4c~-help.pd b/tab/tabread4c~-help.pd deleted file mode 100644 index 82acd94..0000000 --- a/tab/tabread4c~-help.pd +++ /dev/null @@ -1,44 +0,0 @@ -#N canvas 252 101 743 661 10; -#N canvas 0 0 450 300 (subpatch) 0; -#X array array99 11 float 0; -#X coords 0 1 10 -1 250 200 1; -#X restore 461 80 graph; -#X obj 69 195 line~; -#X obj 36 139 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 --1; -#X msg 69 172 0 \, 10 1000; -#X obj 70 219 tabread4c~ array99; -#X obj 36 32 loadbang; -#X obj 296 195 line~; -#X msg 296 172 0 \, 10 1000; -#X obj 297 219 tabread4~ array99; -#X obj 298 241 tabwrite~ test_miller; -#X obj 70 241 tabwrite~ test_cubic; -#X obj 36 55 t b b; -#N canvas 0 0 450 300 (subpatch) 0; -#X array test_miller 44100 float 0; -#X coords 0 1 44099 -1 250 200 1; -#X restore 295 312 graph; -#N canvas 0 0 450 300 (subpatch) 0; -#X array test_cubic 44100 float 0; -#X coords 0 1 44099 -1 250 200 1; -#X restore 34 312 graph; -#X msg 63 77 \; array99 resize 10 \; array99 0 -0.5 -0.5 -0.5 0.5 0.5 -0.5 -0.5 0 0 \; pd dsp 1 \;; -#X text 43 531 tabread4c~ is a drop in remplacement for tabrad4~ \, -but offer a 4 points cubic interpolation with tengent continuity. So -\, in some case \, quality is better than the standart interpolation -; -#X connect 1 0 4 0; -#X connect 2 0 3 0; -#X connect 2 0 7 0; -#X connect 2 0 9 0; -#X connect 2 0 10 0; -#X connect 3 0 1 0; -#X connect 4 0 10 0; -#X connect 5 0 11 0; -#X connect 6 0 8 0; -#X connect 7 0 6 0; -#X connect 8 0 9 0; -#X connect 11 0 2 0; -#X connect 11 1 14 0; diff --git a/tab/tabread4c~.c b/tab/tabread4c~.c deleted file mode 100644 index c4a7804..0000000 --- a/tab/tabread4c~.c +++ /dev/null @@ -1,176 +0,0 @@ -// tabread4c~ -// can replace tabread4c~ -// most of this code comes from pd. just the interpolation shematic is diferent. - - -/* -This software is copyrighted by Miller Puckette and others. The following -terms (the "Standard Improved BSD License") apply to all files associated with -the software unless explicitly disclaimed in individual files: - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. -3. The name of the author may not be used to endorse or promote - products derived from this software without specific prior - written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. -*/ - -// Cyrille Henry 06 2008 - -#include "m_pd.h" - -/******************** tabread4c~ ***********************/ - -static t_class *tabread4c_tilde_class; - -typedef struct _tabread4c_tilde -{ - t_object x_obj; - int x_npoints; - t_word *x_vec; - t_symbol *x_arrayname; - t_float x_f; -} t_tabread4c_tilde; - -static void *tabread4c_tilde_new(t_symbol *s) -{ - t_tabread4c_tilde *x = (t_tabread4c_tilde *)pd_new(tabread4c_tilde_class); - x->x_arrayname = s; - x->x_vec = 0; - outlet_new(&x->x_obj, gensym("signal")); - x->x_f = 0; - return (x); -} - -static t_int *tabread4c_tilde_perform(t_int *w) -{ - t_tabread4c_tilde *x = (t_tabread4c_tilde *)(w[1]); - t_sample *in = (t_sample *)(w[2]); - t_sample *out = (t_sample *)(w[3]); - int n = (int)(w[4]); - int maxindex; - t_word *buf = x->x_vec, *wp; - int i; - double a3,a1,a2; // CH - - maxindex = x->x_npoints - 3; - - if (!buf) goto zero; - -#if 0 /* test for spam -- I'm not ready to deal with this */ - for (i = 0, xmax = 0, xmin = maxindex, fp = in1; i < n; i++, fp++) - { - t_sample f = *in1; - if (f < xmin) xmin = f; - else if (f > xmax) xmax = f; - } - if (xmax < xmin + x->c_maxextent) xmax = xmin + x->c_maxextent; - for (i = 0, splitlo = xmin+ x->c_maxextent, splithi = xmax - x->c_maxextent, - fp = in1; i < n; i++, fp++) - { - t_sample f = *in1; - if (f > splitlo && f < splithi) goto zero; - } -#endif - - for (i = 0; i < n; i++) - { - t_sample findex = *in++; - int index = findex; - t_sample frac, a, b, c, d, cminusb; - static int count; - if (index < 1) - index = 1, frac = 0; - else if (index > maxindex) - index = maxindex, frac = 1; - else frac = findex - index; - wp = buf + index; - a = wp[-1].w_float; - b = wp[0].w_float; - c = wp[1].w_float; - d = wp[2].w_float; - /* if (!i && !(count++ & 1023)) - post("fp = %lx, shit = %lx, b = %f", fp, buf->b_shit, b); */ -// cminusb = c-b; -// *out++ = b + frac * ( -// cminusb - 0.1666667f * (1.-frac) * ( -// (d - a - 3.0f * cminusb) * frac + (d + 2.0f*a - 3.0f*b) -// CH - // 4-point, 3rd-order Hermite (x-form) - a1 = 0.5f * (c - a); - a2 = a - 2.5 * b + 2.f * c - 0.5f * d; - a3 = 0.5f * (d - a) + 1.5f * (b - c); - - *out++ = ((a3 * frac + a2) * frac + a1) * frac + b; - } - return (w+5); - zero: - while (n--) *out++ = 0; - - return (w+5); -} - -void tabread4c_tilde_set(t_tabread4c_tilde *x, t_symbol *s) -{ - t_garray *a; - - x->x_arrayname = s; - if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class))) - { - if (*s->s_name) - pd_error(x, "tabread4c~: %s: no such array", x->x_arrayname->s_name); - x->x_vec = 0; - } - else if (!garray_getfloatwords(a, &x->x_npoints, &x->x_vec)) - { - pd_error(x, "%s: bad template for tabread4c~", x->x_arrayname->s_name); - x->x_vec = 0; - } - else garray_usedindsp(a); -} - -static void tabread4c_tilde_dsp(t_tabread4c_tilde *x, t_signal **sp) -{ - tabread4c_tilde_set(x, x->x_arrayname); - - dsp_add(tabread4c_tilde_perform, 4, x, - sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); - -} - -static void tabread4c_tilde_free(t_tabread4c_tilde *x) -{ -} - -void tabread4c_tilde_setup(void) -{ - tabread4c_tilde_class = class_new(gensym("tabread4c~"), - (t_newmethod)tabread4c_tilde_new, (t_method)tabread4c_tilde_free, - sizeof(t_tabread4c_tilde), 0, A_DEFSYM, 0); - CLASS_MAINSIGNALIN(tabread4c_tilde_class, t_tabread4c_tilde, x_f); - class_addmethod(tabread4c_tilde_class, (t_method)tabread4c_tilde_dsp, - gensym("dsp"), 0); - class_addmethod(tabread4c_tilde_class, (t_method)tabread4c_tilde_set, - gensym("set"), A_SYMBOL, 0); -} diff --git a/tab/tabreadi~.c b/tab/tabreadi~.c deleted file mode 100644 index 85fee98..0000000 --- a/tab/tabreadi~.c +++ /dev/null @@ -1,254 +0,0 @@ -// tabreadi~ -// can replace tabread4~ -// most of this code comes from pd. just the interpolation shematic is diferent. - - -/* -This software is copyrighted by Miller Puckette and others. The following -terms (the "Standard Improved BSD License") apply to all files associated with -the software unless explicitly disclaimed in individual files: - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. -3. The name of the author may not be used to endorse or promote - products derived from this software without specific prior - written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. -*/ - -// Cyrille Henry 06 2008 - -#include "m_pd.h" - -#define max(a,b) ( ((a) > (b)) ? (a) : (b) )
-#define min(a,b) ( ((a) < (b)) ? (a) : (b) ) - -/******************** tabreadi~ ***********************/ - -static t_class *tabreadi_tilde_class; - -typedef struct _tabreadi_tilde -{ - t_object x_obj; - int x_npoints; - t_word *x_vec; - t_symbol *x_arrayname; - t_float x_f; - t_sample x_prev_in, x_last_in, x_prev_out, x_last_out; - t_float x_fa1, x_fa2, x_fb1, x_fb2, x_fb3; - t_float cutoff; - t_int upsample; - t_float x_sr; -} t_tabreadi_tilde; - -void tabreadi_tilde_cutoff(t_tabreadi_tilde *x, t_float cut) -{ - x->cutoff = cut; - - if (x->cutoff == 0) - { - x->x_fb1 = 1; - x->x_fb2 = 0; - x->x_fb3 = 0; - x->x_fa1 = 0; - x->x_fa2 = 0; - - x->x_prev_in = 0; - x->x_last_in = 0; - x->x_prev_out = 0; // reset filter memory - } - else - { - // filter coef to cut all high freq. - t_float tmp1, tmp2; - - tmp1 = sqrt(2)/2; - tmp1 = sinh(tmp1); - - tmp2 = x->cutoff * 2 * 3.1415926 / (x->upsample * x->x_sr); - tmp2 = min(6.28,tmp2); - - tmp1 *= sin(tmp2); - tmp2 = cos(tmp2); - - x->x_fb1 = (1-tmp2 ) /2; - x->x_fb2 = (1-tmp2 ); - x->x_fb3 = (1-tmp2 ) /2; - x->x_fa1 = -2 * tmp2; - x->x_fa2 = 1 - tmp1; - - tmp1 +=1; - - x->x_fb1 /= tmp1; - x->x_fb2 /= tmp1; - x->x_fb3 /= tmp1; - x->x_fa1 /= tmp1; - x->x_fa2 /= tmp1; - } -} - -static void *tabreadi_tilde_new(t_symbol *s) -{ - t_tabreadi_tilde *x = (t_tabreadi_tilde *)pd_new(tabreadi_tilde_class); - x->x_arrayname = s; - x->x_vec = 0; - outlet_new(&x->x_obj, gensym("signal")); - x->x_f = 0; - x->cutoff = 0; - x->upsample = 1; - x->x_sr = 44100; - tabreadi_tilde_cutoff(x,0); // comput filter coef return (x); -} - -static t_int *tabreadi_tilde_perform(t_int *w) -{ - t_tabreadi_tilde *x = (t_tabreadi_tilde *)(w[1]); - t_sample *in = (t_sample *)(w[2]); - t_sample *out = (t_sample *)(w[3]); - int n = (int)(w[4]); - int maxindex; - t_word *buf = x->x_vec, *wp; - int i; - double a3,a1,a2; // CH - - maxindex = x->x_npoints - 3; - - if (!buf) goto zero; - -#if 0 /* test for spam -- I'm not ready to deal with this */ - for (i = 0, xmax = 0, xmin = maxindex, fp = in1; i < n; i++, fp++) - { - t_sample f = *in1; - if (f < xmin) xmin = f; - else if (f > xmax) xmax = f; - } - if (xmax < xmin + x->c_maxextent) xmax = xmin + x->c_maxextent; - for (i = 0, splitlo = xmin+ x->c_maxextent, splithi = xmax - x->c_maxextent, - fp = in1; i < n; i++, fp++) - { - t_sample f = *in1; - if (f > splitlo && f < splithi) goto zero; - } -#endif - - for (i = 0; i < n; i++) - { - for (i=0;i<x->upsample;i++) - { - t_sample findex = *in++; // ??? comment limiter ca pour faire un band limited???? - int index = findex; - t_sample frac, a, b, c, d, cminusb; - static int count; - if (index < 1) - index = 1, frac = 0; - else if (index > maxindex) - index = maxindex, frac = 1; - else frac = findex - index; - wp = buf + index; - a = wp[-1].w_float; - b = wp[0].w_float; - c = wp[1].w_float; - d = wp[2].w_float; - /* if (!i && !(count++ & 1023)) - post("fp = %lx, shit = %lx, b = %f", fp, buf->b_shit, b); */ -// cminusb = c-b; -// *out++ = b + frac * ( -// cminusb - 0.1666667f * (1.-frac) * ( -// (d - a - 3.0f * cminusb) * frac + (d + 2.0f*a - 3.0f*b) -// CH - // 4-point, 3rd-order Hermite (x-form) - a1 = 0.5f * (c - a); - a2 = a - 2.5 * b + 2.f * c - 0.5f * d; - a3 = 0.5f * (d - a) + 1.5f * (b - c); - - -// TODO - - } - - *out++ = ((a3 * frac + a2) * frac + a1) * frac + b; - } - return (w+5); - zero: - while (n--) *out++ = 0; - - return (w+5); -} - -void tabreadi_tilde_set(t_tabreadi_tilde *x, t_symbol *s) -{ - t_garray *a; - - x->x_arrayname = s; - if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class))) - { - if (*s->s_name) - pd_error(x, "tabreadi~: %s: no such array", x->x_arrayname->s_name); - x->x_vec = 0; - } - else if (!garray_getfloatwords(a, &x->x_npoints, &x->x_vec)) - { - pd_error(x, "%s: bad template for tabreadi~", x->x_arrayname->s_name); - x->x_vec = 0; - } - else garray_usedindsp(a); -} - - -void tabreadi_tilde_upsample(t_tabreadi_tilde *x, t_float up) -{ - x->upsample = max(1,up); - tabreadi_tilde_cutoff(x,x->cutoff); -} - - -static void tabreadi_tilde_dsp(t_tabreadi_tilde *x, t_signal **sp) -{ - if (x->x_sr != sp[0]->s_sr) - { - x->x_sr = sp[0]->s_sr; - tabreadi_tilde_cutoff(x,x->cutoff); - } - - tabreadi_tilde_set(x, x->x_arrayname); - - dsp_add(tabreadi_tilde_perform, 4, x, - sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); - -} - -static void tabreadi_tilde_free(t_tabreadi_tilde *x) -{ -} - -void tabreadi_tilde_setup(void) -{ - tabreadi_tilde_class = class_new(gensym("tabreadi~"), - (t_newmethod)tabreadi_tilde_new, (t_method)tabreadi_tilde_free, - sizeof(t_tabreadi_tilde), 0, A_DEFSYM, 0); - CLASS_MAINSIGNALIN(tabreadi_tilde_class, t_tabreadi_tilde, x_f); - class_addmethod(tabreadi_tilde_class, (t_method)tabreadi_tilde_dsp, - gensym("dsp"), 0); - class_addmethod(tabreadi_tilde_class, (t_method)tabreadi_tilde_set, - gensym("set"), A_SYMBOL, 0); -} diff --git a/tab/vdc~-help.pd b/tab/vdc~-help.pd deleted file mode 100644 index ce59096..0000000 --- a/tab/vdc~-help.pd +++ /dev/null @@ -1,18 +0,0 @@ -#N canvas 695 59 307 351 12; -#X floatatom 35 39 0 0 0 0 - - -; -#X text 115 131 signal output (delayed signal); -#X obj 35 67 sig~; -#X text 84 64 signal input (delay time in ms); -#X text 178 97 creation argument: name of delay line; -#X obj 31 297 phasor~; -#X msg 31 272 222; -#X obj 31 248 loadbang; -#X obj 34 159 oscillo~; -#X obj 34 92 vdc~ test; -#X obj 32 322 delwrite~ test 1000; -#X connect 0 0 2 0; -#X connect 2 0 9 0; -#X connect 5 0 10 0; -#X connect 6 0 5 0; -#X connect 7 0 6 0; -#X connect 9 0 8 0; diff --git a/tab/vdc~.c b/tab/vdc~.c deleted file mode 100644 index c2efbd0..0000000 --- a/tab/vdc~.c +++ /dev/null @@ -1,93 +0,0 @@ -#include "m_pd.h" -#include "d_delay.c" - - -/* ----------------------------- vdc~ ----------------------------- */ -static t_class *sigvdc_class; - -typedef struct _sigvdc -{ - t_object x_obj; - t_symbol *x_sym; - t_float x_sr; /* samples per msec */ - int x_zerodel; /* 0 or vecsize depending on read/write order */ - t_float x_f; -} t_sigvdc; - -static void *sigvdc_new(t_symbol *s) -{ - t_sigvdc *x = (t_sigvdc *)pd_new(sigvdc_class); - if (!*s->s_name) s = gensym("vdc~"); - x->x_sym = s; - x->x_sr = 1; - x->x_zerodel = 0; - outlet_new(&x->x_obj, &s_signal); - x->x_f = 0; - return (x); -} - - -static t_int *sigvdc_perform(t_int *w) -{ - t_sample *in = (t_sample *)(w[1]); - t_sample *out = (t_sample *)(w[2]); - t_delwritectl *ctl = (t_delwritectl *)(w[3]); - t_sigvdc *x = (t_sigvdc *)(w[4]); - int n = (int)(w[5]); - - int nsamps = ctl->c_n; - t_sample limit = nsamps - n - 1; - t_sample fn = n-1; - t_sample *vp = ctl->c_vec, *bp, *wp = vp + ctl->c_phase; - t_sample zerodel = x->x_zerodel; - while (n--) - { - t_sample delsamps = x->x_sr * *in++ - zerodel, frac; - int idelsamps; - t_sample a, b, c, d, cminusb; - if (delsamps < 1.00001f) delsamps = 1.00001f; - if (delsamps > limit) delsamps = limit; - delsamps += fn; - fn = fn - 1.0f; - idelsamps = delsamps; - frac = delsamps - (t_sample)idelsamps; - bp = wp - idelsamps; - if (bp < vp + 4) bp += nsamps; - d = bp[-3]; - c = bp[-2]; - b = bp[-1]; - a = bp[0]; - cminusb = c-b; - *out++ = b + frac * ( - cminusb - 0.1666667f * (1.-frac) * ( - (d - a - 3.0f * cminusb) * frac + (d + 2.0f*a - 3.0f*b) - ) - ); - } - return (w+6); -} - -static void sigvdc_dsp(t_sigvdc *x, t_signal **sp) -{ - t_sigdelwrite *delwriter = - (t_sigdelwrite *)pd_findbyclass(x->x_sym, sigdelwrite_class); - x->x_sr = sp[0]->s_sr * 0.001; - if (delwriter) - { - sigdelwrite_checkvecsize(delwriter, sp[0]->s_n); - x->x_zerodel = (delwriter->x_sortno == ugen_getsortno() ? - 0 : delwriter->x_vecsize); - dsp_add(sigvdc_perform, 5, - sp[0]->s_vec, sp[1]->s_vec, - &delwriter->x_cspace, x, sp[0]->s_n); - } - else error("vdc~: %s: no such delwrite~",x->x_sym->s_name); -} - -void vdc_tilde_setup(void) -{ - sigvdc_class = class_new(gensym("vdc~"), (t_newmethod)sigvdc_new, 0, - sizeof(t_sigvdc), 0, A_DEFSYM, 0); - class_addmethod(sigvdc_class, (t_method)sigvdc_dsp, gensym("dsp"), 0); - CLASS_MAINSIGNALIN(sigvdc_class, t_sigvdc, x_f); -} |