From 6a9bc88d7b52fc35b9fe3597cd29d9fbe90387ee Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 9 Feb 2010 21:40:51 +0000 Subject: updated to sigpack-0.04-win32.zip and committed forgotten debian files svn path=/trunk/externals/sigpack/; revision=13154 --- Makefile | 6 +-- chop~-help.pd | 40 +++++++-------- debian/changelog | 5 ++ debian/compat | 1 + debian/control | 16 ++++++ debian/copyright | 14 ++++++ debian/rules | 15 ++++++ decimate~-help.pd | 30 ++++++----- diode~-help.pd | 18 +++---- foldback~-help.pd | 32 ++++++------ foldover~-help.pd | 32 ++++++------ freqdiv~-help.pd | 20 ++++---- freqshift~-help.pd | 71 +++++++++++++------------- hardlimit~-help.pd | 30 +++++++++++ hardlimit~.c | 81 ++++++++++++++++++++++++++++++ harmgen~-help.pd | 58 +++++++++++----------- impulse~-help.pd | 17 +++++++ impulse~.c | 78 +++++++++++++++++++++++++++++ readme.txt | 37 +++++++++++--- rectify~-help.pd | 12 ++--- round~-help.pd | 20 ++++---- sIgpAck.c | 58 ---------------------- saturate~-help.pd | 27 +++++----- shape~-help.pd | 26 ++++++++++ shape~.c | 79 +++++++++++++++++++++++++++++ sieve~-help.pd | 22 ++++----- sigpack.c | 70 ++++++++++++++++++++++++++ split~-help.pd | 18 +++---- transient~-help.pd | 28 +++++++++++ transient~.c | 133 +++++++++++++++++++++++++++++++++++++++++++++++++ ustep~-help.pd | 55 ++++++++++----------- valverect~-help.pd | 28 +++++++++++ valverect~.c | 143 +++++++++++++++++++++++++++++++++++++++++++++++++++++ vowel~-help.pd | 59 +++++++++++----------- wavewrap~-help.pd | 26 ++++++++++ wavewrap~.c | 72 +++++++++++++++++++++++++++ 36 files changed, 1142 insertions(+), 335 deletions(-) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/rules create mode 100644 hardlimit~-help.pd create mode 100644 hardlimit~.c create mode 100644 impulse~-help.pd create mode 100644 impulse~.c delete mode 100644 sIgpAck.c create mode 100644 shape~-help.pd create mode 100644 shape~.c create mode 100644 sigpack.c create mode 100644 transient~-help.pd create mode 100644 transient~.c create mode 100644 valverect~-help.pd create mode 100644 valverect~.c create mode 100644 wavewrap~-help.pd create mode 100644 wavewrap~.c diff --git a/Makefile b/Makefile index b6be885..0c7f16e 100644 --- a/Makefile +++ b/Makefile @@ -2,11 +2,11 @@ # LIBRARY_NAME variable. The folder for your project should have the same name # as your library. LIBRARY_NAME = sigpack -LIBRARY_VERSION = 0.0.3.1 +LIBRARY_VERSION = 0.0.4.1 # Next, add your .c source files to the SOURCES variable. The help files will # be included automatically -SOURCES = chop~.c decimate~.c diode~.c foldback~.c foldover~.c freqdiv~.c freqshift~.c harmgen~.c rectify~.c round~.c saturate~.c sieve~.c split~.c ustep~.c vowel~.c +SOURCES = chop~.c decimate~.c diode~.c foldback~.c foldover~.c freqdiv~.c freqshift~.c hardlimit~.c harmgen~.c impulse~.c rectify~.c round~.c saturate~.c shape~.c sieve~.c split~.c transient~.c ustep~.c valverect~.c vowel~.c wavewrap~.c # For objects that only build on certain platforms, add those to the SOURCES @@ -25,7 +25,7 @@ PDOBJECTS = # if you want to include any other files in the source and binary tarballs, # list them here. This can be anything from header files, READMEs, example # patches, documentation, etc. -EXTRA_DIST = readme.txt sIgpAck.c LICENSE +EXTRA_DIST = readme.txt sigpack.c LICENSE #------------------------------------------------------------------------------# diff --git a/chop~-help.pd b/chop~-help.pd index e0ccf9e..99e5a97 100644 --- a/chop~-help.pd +++ b/chop~-help.pd @@ -1,32 +1,30 @@ -#N canvas 366 389 462 366 12; -#X obj 155 172 nbx 5 14 -2 2 0 0 empty empty ->factor[-2/2] 60 8 0 -10 -262144 -1 -1 0 256; +#N canvas 366 389 401 359 10; #X text 60 35 signal chopping modulator; #X obj 62 116 osc~ 220; #X obj 62 312 dac~; -#X obj 156 195 nbx 5 14 0 100 0 0 empty empty empty 0 -6 0 10 -262144 --1 -1 92 256; #X obj 62 277 *~; -#X obj 156 258 line~; -#X obj 156 235 pack 0 50; -#X obj 156 213 dbtorms; +#X obj 157 260 line~; +#X obj 157 240 pack 0 50; +#X obj 157 218 dbtorms; #X text 156 144 ->signal modulation input; #X text 155 116 ->signal input; #X text 60 51 multiplicates incoming signal by factor x; #X text 59 68 if modulation signal is positive; -#X obj 99 146 osc~ 2; +#X obj 89 146 osc~ 2; #X text 300 11 arg; -#X text 252 301 sIgpAck 0.02; +#X text 293 301 sIgpAck 0.02; #X obj 62 186 chop~ 0; -#X text 213 316 2003 www.weiss-archiv.de; +#X text 222 316 2003 www.weiss-archiv.de; #X text 60 13 ---chop~---; -#X connect 0 0 16 2; -#X connect 2 0 16 0; -#X connect 4 0 8 0; -#X connect 5 0 3 0; -#X connect 5 0 3 1; -#X connect 6 0 5 1; -#X connect 7 0 6 0; -#X connect 8 0 7 0; -#X connect 13 0 16 1; -#X connect 16 0 5 0; +#X floatatom 157 172 5 0 0 1 -->factor[-2/2] - -; +#X floatatom 157 199 5 0 100 0 - - -; +#X connect 1 0 14 0; +#X connect 3 0 2 0; +#X connect 3 0 2 1; +#X connect 4 0 3 1; +#X connect 5 0 4 0; +#X connect 6 0 5 0; +#X connect 11 0 14 1; +#X connect 14 0 3 0; +#X connect 17 0 14 2; +#X connect 18 0 6 0; diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..9c0f3e8 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +pd-sigpack (0.0.3.1-1.1) unstable; urgency=low + + * Initial release (Closes: #nnnn) + + -- Hans-Christoph Steiner Thu, 21 Jan 2010 23:27:04 -0500 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +7 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..875a239 --- /dev/null +++ b/debian/control @@ -0,0 +1,16 @@ +Source: pd-sigpack +Section: sound +Priority: optional +Maintainer: Paul Brossier +Build-Depends: debhelper (>= 7.0.50~), puredata +Standards-Version: 3.8.3 +Homepage: http://puredata.info + +Package: pd-sigpack +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, pd +Description: signal processing library from weiss-archiv + A collection of externals from weiss-archiv that mostly provide some signal + processing functions like limiting, distortion, etc. They are called chop~, + decimate~, diode~, foldback~, foldover~, freqdiv~, freqshift~, harmgen~, + rectify~, round~, saturate~, sieve~, split~, ustep~, and vowel~. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..4df82fc --- /dev/null +++ b/debian/copyright @@ -0,0 +1,14 @@ +Debianized-By: Hans-Christoph Steiner +Debianized-Date: Tue, 9 Feb 2010 17:14:25 -0400 +Original-Source: http://www.weiss-archiv.de/ext/sigpack-0.03-win32.zip +Files: * +Copyright: Copyright 2001-2007 weiss-archiv + +License: GPL-2+ + This package 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. + . + On Debian systems, the complete text of the GNU General Public License + version 2 can be found in file "/usr/share/common-licenses/GPL-2". diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..fc81576 --- /dev/null +++ b/debian/rules @@ -0,0 +1,15 @@ +#!/usr/bin/make -f + +LIBRARY_NAME = sigpack +PACKAGE = pd-$(LIBRARY_NAME) + +%: + dh $@ + +override_dh_auto_install: + make DESTDIR=$(CURDIR)/debian/$(PACKAGE) pkglibdir=/usr/lib/pd install + +override_dh_shlibdeps: + dpkg-shlibdeps $(CURDIR)/debian/$(PACKAGE)/usr/lib/pd/$(LIBRARY_NAME)/*.pd_linux \ + -T$(CURDIR)/debian/$(PACKAGE).substvars + diff --git a/decimate~-help.pd b/decimate~-help.pd index 8ea60ee..93eedd6 100644 --- a/decimate~-help.pd +++ b/decimate~-help.pd @@ -1,32 +1,30 @@ -#N canvas 285 400 488 343 12; -#N canvas 0 0 450 300 graph1 0; +#N canvas 285 400 443 319 10; +#N canvas 0 0 450 300 (subpatch) 0; #X array deci 44100 float 0; #X coords 0 1.02 44099 -1.02 100 70 1; #X restore 305 189 graph; -#X msg 8 112 bang; +#X msg 16 115 bang; #X obj 52 105 osc~ 1.5; -#N canvas 0 0 450 300 graph1 0; +#N canvas 0 0 450 300 (subpatch) 0; #X array osc 44100 float 0; #X coords 0 1 44099 -1 100 70 1; #X restore 305 102 graph; #X obj 62 132 tabwrite~ osc; -#X obj 125 172 nbx 5 14 0 1 0 0 empty empty ratio 0 -6 0 10 -262144 --1 -1 0.02 256; -#X obj 199 172 nbx 5 14 0 32 0 0 empty empty bits[1-32] 0 -6 0 10 -262144 --1 -1 0 256; #X obj 52 228 tabwrite~ deci; #X text 51 35 signal decimation; #X text 51 50 a ratio of 1 is orig. samplerate 0.5 is half; -#X text 273 11 arg; +#X text 306 10 arg; #X text 51 67 of orig. samplerate etc.; -#X text 260 268 sIgpAck 0.02; +#X text 331 268 sIgpAck 0.02; #X obj 52 195 decimate~ 0.5 16; -#X text 222 281 2003 www.weiss-archiv.de; +#X text 260 281 2003 www.weiss-archiv.de; #X text 51 13 ---decimate~---; +#X floatatom 106 175 5 0 1 2 ratio[0-1] - -; +#X floatatom 183 181 5 1 32 2 bits[1-32] - -; #X connect 1 0 4 0; -#X connect 1 0 7 0; +#X connect 1 0 5 0; #X connect 2 0 4 0; -#X connect 2 0 13 0; -#X connect 5 0 13 1; -#X connect 6 0 13 2; -#X connect 13 0 7 0; +#X connect 2 0 11 0; +#X connect 11 0 5 0; +#X connect 14 0 11 1; +#X connect 15 0 11 2; diff --git a/diode~-help.pd b/diode~-help.pd index 3d0334e..ec5dec1 100644 --- a/diode~-help.pd +++ b/diode~-help.pd @@ -1,23 +1,23 @@ -#N canvas 71 176 480 305 12; -#N canvas 0 0 450 300 graph1 0; +#N canvas 329 389 404 298 10; +#N canvas 0 0 450 300 (subpatch) 0; #X array diode 44100 float 0; #X coords 0 1.02 44099 -1.02 100 70 1; -#X restore 306 163 graph; -#X msg 18 85 bang; +#X restore 252 160 graph; +#X msg 24 88 bang; #X obj 62 78 osc~ 1.5; -#N canvas 0 0 450 300 graph1 0; +#N canvas 0 0 450 300 (subpatch) 0; #X array osc 44100 float 0; #X coords 0 1 44099 -1 100 70 1; -#X restore 306 75 graph; +#X restore 252 72 graph; #X obj 72 105 tabwrite~ osc; #X text 60 13 ---diode~---; #X obj 62 201 tabwrite~ diode; #X obj 62 168 diode~ 0; -#X floatatom 145 147 5 0 2 2 mode[0-2] - -; +#X floatatom 123 147 5 0 2 2 mode[0-2] - -; #X text 294 12 arg; #X text 60 35 diode rectifier network; -#X text 263 240 sIgpAck 0.03; -#X text 223 254 2005 www.weiss-archiv.de; +#X text 279 241 sIgpAck 0.03; +#X text 209 254 2005 www.weiss-archiv.de; #X connect 1 0 4 0; #X connect 1 0 6 0; #X connect 2 0 4 0; diff --git a/foldback~-help.pd b/foldback~-help.pd index 4a7e944..f1f49ce 100644 --- a/foldback~-help.pd +++ b/foldback~-help.pd @@ -1,30 +1,28 @@ -#N canvas 71 176 476 301 12; -#N canvas 0 0 450 300 graph1 0; +#N canvas 320 476 426 288 10; +#N canvas 0 0 450 300 (subpatch) 0; #X array fold 44100 float 0; #X coords 0 1.02 44099 -1.02 100 70 1; -#X restore 306 163 graph; -#X msg 18 85 bang; +#X restore 279 157 graph; +#X msg 23 88 bang; #X obj 62 78 osc~ 1.5; -#N canvas 0 0 450 300 graph1 0; +#N canvas 0 0 450 300 (subpatch) 0; #X array osc 44100 float 0; #X coords 0 1 44099 -1 100 70 1; -#X restore 306 75 graph; +#X restore 279 69 graph; #X obj 72 105 tabwrite~ osc; -#X obj 143 147 nbx 5 14 -1 0 0 0 empty empty neg 0 -6 0 10 -262144 --1 -1 0 256; -#X obj 225 147 nbx 5 14 0 1 0 0 empty empty pos 0 -6 0 10 -262144 -1 --1 0 256; #X obj 62 201 tabwrite~ fold; -#X text 264 240 sIgpAck 0.01; +#X text 305 244 sIgpAck 0.01; #X text 299 12 arg; #X text 60 35 signal mirror; #X obj 62 168 foldback~ -0.5 0.5; -#X text 224 254 2002 www.weiss-archiv.de; +#X text 234 255 2002 www.weiss-archiv.de; #X text 60 13 ---foldback~---; +#X floatatom 122 147 5 -1 0 2 neg[-1-0] - -; +#X floatatom 183 148 5 0 1 2 pos[0-1] - -; #X connect 1 0 4 0; -#X connect 1 0 7 0; +#X connect 1 0 5 0; #X connect 2 0 4 0; -#X connect 2 0 11 0; -#X connect 5 0 11 1; -#X connect 6 0 11 2; -#X connect 11 0 7 0; +#X connect 2 0 9 0; +#X connect 9 0 5 0; +#X connect 12 0 9 1; +#X connect 13 0 9 2; diff --git a/foldover~-help.pd b/foldover~-help.pd index d52a192..3d470a2 100644 --- a/foldover~-help.pd +++ b/foldover~-help.pd @@ -1,30 +1,28 @@ -#N canvas 71 176 480 305 12; -#N canvas 0 0 450 300 graph1 0; +#N canvas 310 372 412 288 10; +#N canvas 0 0 450 300 (subpatch) 0; #X array fold 44100 float 0; #X coords 0 1.02 44099 -1.02 100 70 1; -#X restore 306 163 graph; -#X msg 18 85 bang; +#X restore 274 157 graph; +#X msg 25 88 bang; #X obj 62 78 osc~ 1.5; -#N canvas 0 0 450 300 graph1 0; +#N canvas 0 0 450 300 (subpatch) 0; #X array osc 44100 float 0; #X coords 0 1 44099 -1 100 70 1; -#X restore 306 75 graph; +#X restore 274 69 graph; #X obj 72 105 tabwrite~ osc; -#X obj 123 144 nbx 5 14 0 0.1 0 0 empty empty amp[0-0.1] 0 -6 0 10 --262144 -1 -1 0.1 256; -#X obj 206 154 nbx 5 14 0 1 0 0 empty empty sym[0-1] 0 -6 0 10 -262144 --1 -1 1 256; #X obj 62 201 tabwrite~ fold; #X text 60 35 foldover distortion; #X text 294 12 arg; -#X text 262 240 sIgpAck 0.02; +#X text 301 241 sIgpAck 0.02; #X obj 62 168 foldover~ 0 0; -#X text 223 254 2003 www.weiss-archiv.de; +#X text 230 254 2003 www.weiss-archiv.de; #X text 60 13 ---foldover~---; +#X floatatom 107 149 5 0 0 2 amp[0-1] - -; +#X floatatom 175 154 5 0 0 2 sym[0-1] - -; #X connect 1 0 4 0; -#X connect 1 0 7 0; +#X connect 1 0 5 0; #X connect 2 0 4 0; -#X connect 2 0 11 0; -#X connect 5 0 11 1; -#X connect 6 0 11 2; -#X connect 11 0 7 0; +#X connect 2 0 9 0; +#X connect 9 0 5 0; +#X connect 12 0 9 1; +#X connect 13 0 9 2; diff --git a/freqdiv~-help.pd b/freqdiv~-help.pd index 6e5c5f5..0d14c64 100644 --- a/freqdiv~-help.pd +++ b/freqdiv~-help.pd @@ -1,23 +1,23 @@ -#N canvas 71 176 488 313 12; -#N canvas 0 0 450 300 graph1 0; +#N canvas 272 399 439 284 10; +#N canvas 0 0 450 300 (subpatch) 0; #X array div 44100 float 0; #X coords 0 1.02 44099 -1.02 100 70 1; -#X restore 338 163 graph; -#X msg 18 85 bang; -#N canvas 0 0 450 300 graph1 0; +#X restore 307 158 graph; +#X msg 23 88 bang; +#N canvas 0 0 450 300 (subpatch) 0; #X array osc 44100 float 0; #X coords 0 1 44099 -1 100 70 1; -#X restore 337 75 graph; +#X restore 306 70 graph; #X obj 72 105 tabwrite~ osc; #X obj 62 201 tabwrite~ div; -#X floatatom 161 143 5 0 8 1 -->denominate - -; +#X floatatom 135 145 5 0 8 1 -->denominate - -; #X text 315 12 arg; #X text 60 35 signal frequency divider; #X obj 62 78 osc~ 4; -#X text 220 157 [(int)0-8]; -#X text 293 239 sIgpAck 0.02; +#X text 180 155 [(int)0-8]; +#X text 333 241 sIgpAck 0.02; #X obj 62 168 freqdiv~ 1; -#X text 254 254 2003 www.weiss-archiv.de; +#X text 262 254 2003 www.weiss-archiv.de; #X text 60 13 ---freqdiv~---; #X connect 1 0 3 0; #X connect 1 0 4 0; diff --git a/freqshift~-help.pd b/freqshift~-help.pd index c0b5b09..3d0dabf 100644 --- a/freqshift~-help.pd +++ b/freqshift~-help.pd @@ -1,38 +1,33 @@ -#N canvas 106 78 492 389 12; -#N canvas 0 22 450 300 (subpatch) 0; -#X array downshift 44100 float 0; -#X coords 0 1.02 44099 -1.02 100 70 1; -#X restore 337 163 graph; -#X msg 18 105 bang; -#N canvas 0 22 450 300 (subpatch) 0; -#X array osc 44100 float 0; -#X coords 0 1 44099 -1 100 70 1; -#X restore 337 75 graph; -#X obj 112 125 tabwrite~ osc; -#X text 60 13 ---freqshift~---; -#X text 60 35 bode frequency shifter; -#X text 315 12 arg; -#X obj 102 188 freqshift~ 100; -#X obj 102 98 osc~ 110; -#X text 287 334 sIgpAck 0.03; -#X text 248 349 2005 www.weiss-archiv.de; -#X floatatom 233 163 5 0 0 2 shift[hz] - -; -#N canvas 0 22 450 300 (subpatch) 0; -#X array upshift 44100 float 0; -#X coords 0 1.02 44099 -1.02 100 70 1; -#X restore 338 252 graph; -#X obj 103 324 tabwrite~ downshift; -#X obj 113 300 tabwrite~ upshift; -#X obj 18 79 metro 250; -#X obj 18 60 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1 -; -#X connect 1 0 3 0; -#X connect 1 0 13 0; -#X connect 1 0 14 0; -#X connect 7 0 13 0; -#X connect 7 1 14 0; -#X connect 8 0 3 0; -#X connect 8 0 7 0; -#X connect 11 0 7 1; -#X connect 15 0 1 0; -#X connect 16 0 15 0; +#N canvas 331 369 412 377 10; +#N canvas 0 0 450 300 (subpatch) 0; +#X array downshift 44100 float 0; +#X coords 0 1.02 44099 -1.02 100 70 1; +#X restore 279 155 graph; +#X msg 24 87 bang; +#N canvas 0 0 450 300 (subpatch) 0; +#X array osc 44100 float 0; +#X coords 0 1 44099 -1 100 70 1; +#X restore 279 67 graph; +#X obj 72 105 tabwrite~ osc; +#X text 60 13 ---freqshift~---; +#X text 60 35 bode frequency shifter; +#X text 315 12 arg; +#X obj 62 168 freqshift~ 100; +#X obj 62 78 osc~ 110; +#X text 307 334 sIgpAck 0.03; +#X text 235 349 2005 www.weiss-archiv.de; +#X floatatom 159 148 5 0 0 2 shift[hz] - -; +#N canvas 0 0 450 300 (subpatch) 0; +#X array upshift 44100 float 0; +#X coords 0 1.02 44099 -1.02 100 70 1; +#X restore 280 244 graph; +#X obj 63 304 tabwrite~ downshift; +#X obj 73 280 tabwrite~ upshift; +#X connect 1 0 3 0; +#X connect 1 0 13 0; +#X connect 1 0 14 0; +#X connect 7 0 13 0; +#X connect 7 1 14 0; +#X connect 8 0 3 0; +#X connect 8 0 7 0; +#X connect 11 0 7 1; diff --git a/hardlimit~-help.pd b/hardlimit~-help.pd new file mode 100644 index 0000000..74adc94 --- /dev/null +++ b/hardlimit~-help.pd @@ -0,0 +1,30 @@ +#N canvas 377 391 462 294 10; +#N canvas 0 0 450 300 (subpatch) 0; +#X array div 44100 float 0; +#X coords 0 1.02 44099 -1.02 100 70 1; +#X restore 324 155 graph; +#X msg 23 88 bang; +#N canvas 0 0 450 300 (subpatch) 0; +#X array osc 44100 float 0; +#X coords 0 1 44099 -1 100 70 1; +#X restore 323 67 graph; +#X obj 72 105 tabwrite~ osc; +#X obj 62 223 tabwrite~ div; +#X floatatom 100 128 5 -50 0 1 -->limit[db-50-0] - -; +#X obj 62 78 osc~ 4; +#X text 60 13 ---hardlimit~---; +#X floatatom 138 150 5 0 0 1 -->wet_mix[0-1] - -; +#X floatatom 177 173 5 0 0 1 -->residue_mix[0-1] - -; +#X obj 62 195 hardlimit~ -8 1 0; +#X text 60 35 brick hard limiter with residue mixer; +#X text 302 11 arg; +#X text 350 241 sIgpAck 0.04; +#X text 279 254 2007 www.weiss-archiv.de; +#X connect 1 0 3 0; +#X connect 1 0 4 0; +#X connect 5 0 10 1; +#X connect 6 0 3 0; +#X connect 6 0 10 0; +#X connect 8 0 10 2; +#X connect 9 0 10 3; +#X connect 10 0 4 0; diff --git a/hardlimit~.c b/hardlimit~.c new file mode 100644 index 0000000..3ae1e10 --- /dev/null +++ b/hardlimit~.c @@ -0,0 +1,81 @@ +// sigpack +// for +// pure-data +// by weiss +// www.weiss-archiv.de + +#include "m_pd.h" +#include +#ifdef _MSC_VER +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif + +// ------------------------ hardlimit~ ----------------------------- +// brick hard limiter with residue mixer +// code from swh_plugins by steve harris www.plugin.org.uk + +static t_class *hardlimit_tilde_class; + +typedef struct _hardlimit_tilde +{ + t_object x_obj; + t_sample x_limit_db;//-50.0 - 0.0 + t_sample x_wet_gain;//0.0 - 1.0 + t_sample x_res_gain;//0.0 - 1.0 + float x_f; +} t_hardlimit_tilde; + +static void *hardlimit_tilde_new(t_floatarg limitdb, t_floatarg wetgain, t_floatarg resgain) +{ + t_hardlimit_tilde *x = (t_hardlimit_tilde *)pd_new(hardlimit_tilde_class); + x->x_limit_db = limitdb; + x->x_wet_gain = wetgain; + x->x_res_gain = resgain; + outlet_new(&x->x_obj, gensym("signal")); + floatinlet_new(&x->x_obj, &x->x_limit_db); + floatinlet_new(&x->x_obj, &x->x_wet_gain); + floatinlet_new(&x->x_obj, &x->x_res_gain); + x->x_f = 0; + if (limitdb) x->x_limit_db = limitdb; + else x->x_limit_db = 0.0; + if (wetgain) x->x_wet_gain = wetgain; + else x->x_wet_gain = 0.0; + if (resgain) x->x_res_gain = resgain; + else x->x_res_gain = 0.0; + return (x); +} + +static t_int *hardlimit_tilde_perform(t_int *w) +{ + t_hardlimit_tilde *x = (t_hardlimit_tilde *)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + int n = (int)(w[4]); + float f; + float limit_g, sign, data, residue; + while (n--) + { + f = *in++; + limit_g = pow(10, x->x_limit_db / 20); + sign = f < 0.0 ? -1.0 : 1.0; + data = f * sign; + residue = data > limit_g ? data - limit_g : 0.0; + data -= residue; + *out++ = sign * (x->x_wet_gain * data + x->x_res_gain * residue); + } + return (w+5); +} + +static void hardlimit_tilde_dsp(t_hardlimit_tilde *x, t_signal **sp) +{ + dsp_add(hardlimit_tilde_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); +} + +void hardlimit_tilde_setup(void) +{ + hardlimit_tilde_class = class_new(gensym("hardlimit~"), (t_newmethod)hardlimit_tilde_new, 0, + sizeof(t_hardlimit_tilde), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); + CLASS_MAINSIGNALIN(hardlimit_tilde_class, t_hardlimit_tilde, x_f); + class_addmethod(hardlimit_tilde_class, (t_method)hardlimit_tilde_dsp, gensym("dsp"), 0); +} diff --git a/harmgen~-help.pd b/harmgen~-help.pd index 8c4e90a..4c08443 100644 --- a/harmgen~-help.pd +++ b/harmgen~-help.pd @@ -1,41 +1,41 @@ -#N canvas 211 248 536 429 12; -#N canvas 0 0 450 300 graph1 0; +#N canvas 295 388 516 402 10; +#N canvas 0 0 450 300 (subpatch) 0; #X array harm 44100 float 0; #X coords 0 1.02 44099 -1.02 100 70 1; -#X restore 381 169 graph; -#X msg 18 85 bang; +#X restore 377 211 graph; +#X msg 22 88 bang; #X obj 62 78 osc~ 1.5; -#N canvas 0 0 450 300 graph1 0; +#N canvas 0 0 450 300 (subpatch) 0; #X array osc 44100 float 0; #X coords 0 1 44099 -1 100 70 1; -#X restore 380 79 graph; +#X restore 376 121 graph; #X obj 72 105 tabwrite~ osc; #X text 60 35 harmonic generator; -#X text 334 17 arg..; -#X text 337 358 sIgpAck 0.02; +#X text 368 14 arg..; +#X text 403 355 sIgpAck 0.02; #X obj 62 371 tabwrite~ harm; -#X floatatom 86 132 5 -1 1 0 - - -; -#X floatatom 110 153 5 -1 1 0 - - -; -#X floatatom 134 174 5 -1 1 0 - - -; -#X floatatom 159 195 5 -1 1 0 - - -; -#X floatatom 183 215 5 -1 1 0 - - -; -#X floatatom 207 236 5 -1 1 0 - - -; -#X floatatom 232 257 5 -1 1 0 - - -; -#X floatatom 256 277 5 -1 1 0 - - -; -#X floatatom 280 298 5 -1 1 0 - - -; -#X floatatom 305 319 5 -1 1 0 - - -; -#X text 351 318 ->mag10[-1/1]; -#X text 133 130 ->mag1[-1/1]:fundamental freq; -#X text 158 151 ->mag2[-1/1]; -#X text 181 173 ->mag3[-1/1]; -#X text 210 193 ->mag4[-1/1]; -#X text 229 214 ->mag5[-1/1]; -#X text 255 235 ->mag6[-1/1]; -#X text 280 256 ->mag7[-1/1]; -#X text 305 276 ->mag8[-1/1]; -#X text 327 297 ->mag9[-1/1]; +#X floatatom 80 132 5 -1 1 0 - - -; +#X floatatom 98 153 5 -1 1 0 - - -; +#X floatatom 116 174 5 -1 1 0 - - -; +#X floatatom 134 195 5 -1 1 0 - - -; +#X floatatom 152 214 5 -1 1 0 - - -; +#X floatatom 170 235 5 -1 1 0 - - -; +#X floatatom 188 254 5 -1 1 0 - - -; +#X floatatom 206 273 5 -1 1 0 - - -; +#X floatatom 224 291 5 -1 1 0 - - -; +#X floatatom 243 311 5 -1 1 0 - - -; +#X text 279 311 ->mag10[-1/1]; +#X text 114 130 ->mag1[-1/1]:fundamental freq; +#X text 133 151 ->mag2[-1/1]; +#X text 152 172 ->mag3[-1/1]; +#X text 171 193 ->mag4[-1/1]; +#X text 189 213 ->mag5[-1/1]; +#X text 205 234 ->mag6[-1/1]; +#X text 224 253 ->mag7[-1/1]; +#X text 241 272 ->mag8[-1/1]; +#X text 258 290 ->mag9[-1/1]; #X obj 62 342 harmgen~ 0 0 0 0 0 0 0 0 0 0; -#X text 298 372 2003 www.weiss-archiv.de; +#X text 332 369 2003 www.weiss-archiv.de; #X text 60 13 ---harmgen~---; #X connect 1 0 4 0; #X connect 1 0 8 0; diff --git a/impulse~-help.pd b/impulse~-help.pd new file mode 100644 index 0000000..90c4f8f --- /dev/null +++ b/impulse~-help.pd @@ -0,0 +1,17 @@ +#N canvas 344 491 402 206 10; +#X msg 20 115 bang; +#N canvas 0 0 474 324 (subpatch) 0; +#X array imp 44100 float 0; +#X coords 0 1 44099 -1 100 70 1; +#X restore 265 76 graph; +#X text 60 13 ---impulse~---; +#X text 61 35 non-bandlimited single-sample impulses; +#X obj 62 132 tabwrite~ imp; +#X text 292 163 sIgpAck 0.04; +#X obj 62 105 impulse~ 440; +#X text 309 12 arg; +#X floatatom 62 83 5 0 0 2 freq - -; +#X text 220 176 2007 www.weiss-archiv.de; +#X connect 0 0 4 0; +#X connect 6 0 4 0; +#X connect 8 0 6 0; diff --git a/impulse~.c b/impulse~.c new file mode 100644 index 0000000..96cc99a --- /dev/null +++ b/impulse~.c @@ -0,0 +1,78 @@ +// sigpack +// for +// pure-data +// by weiss +// www.weiss-archiv.de + +#include "m_pd.h" +#ifdef _MSC_VER +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif + +// ------------------------ impulse~ ----------------------------- +// non-bandlimited single-sample impulses +// code from swh_plugins by steve harris www.plugin.org.uk + +static t_class *impulse_tilde_class; + +typedef struct _impulse_tilde +{ + t_object x_obj; + t_sample x_phase; + t_sample x_sample_rate; + float x_f; +} t_impulse_tilde; + +static void *impulse_tilde_new(t_floatarg f) +{ + t_impulse_tilde *x = (t_impulse_tilde *)pd_new(impulse_tilde_class); + x->x_f = f; + x->x_phase = 0.f; + x->x_sample_rate = sys_getsr();//later put this in impulse_tilde_dsp??? + outlet_new(&x->x_obj, gensym("signal")); + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft1")); + return (x); +} + +static t_int *impulse_tilde_perform(t_int *w) +{ + t_impulse_tilde *x = (t_impulse_tilde *)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + int n = (int)(w[4]); + float f, phase_step, value; + while (n--) + { + f = *(in++); + phase_step = f / x->x_sample_rate; + if (x->x_phase > 1.f) { + x->x_phase -= 1.f; + value = 1.f; + } else { + value = 0.f; + } + *out++ = value; + x->x_phase += phase_step; + } + return (w+5); +} + +static void impulse_tilde_ft1(t_impulse_tilde *x, t_float f) +{ + x->x_phase = f; +} + +static void impulse_tilde_dsp(t_impulse_tilde *x, t_signal **sp) +{ + dsp_add(impulse_tilde_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); +} + +void impulse_tilde_setup(void) +{ + impulse_tilde_class = class_new(gensym("impulse~"), (t_newmethod)impulse_tilde_new, 0, + sizeof(t_impulse_tilde), 0, A_DEFFLOAT, 0); + CLASS_MAINSIGNALIN(impulse_tilde_class, t_impulse_tilde, x_f); + class_addmethod(impulse_tilde_class, (t_method)impulse_tilde_dsp, gensym("dsp"), 0); + class_addmethod(impulse_tilde_class, (t_method)impulse_tilde_ft1, gensym("ft1"), A_FLOAT, 0); +} diff --git a/readme.txt b/readme.txt index a1f9beb..696cf13 100644 --- a/readme.txt +++ b/readme.txt @@ -1,16 +1,37 @@ -sIgpAck version 0.03 +sigpack version 0.04 signal object library for pure-data -win-32 only -objects included -sp.chop~ sp.decimate~ sp.diode~ sp.foldback~ sp.foldover~ sp.freqdiv~ -sp.freqshift~ sp.harmgen~ sp.rectify~ sp.round~ sp.saturate~ sp.sieve~ -sp.split~ sp.ustep~ sp.vowel~ +objects: +sp_chop~ sp_decimate~ sp_diode~ sp_foldback~ sp_foldover~ sp_freqdiv~ +sp_freqshift~ sp_hardlimit~ sp_harmgen~ sp_impulse~ sp_rectify~ sp_round~ sp_saturate~ sp_shape~ sp_sieve~ +sp_split~ sp_transient~ sp_ustep~ sp_valverect~ sp_vowel~ sp_wavewrap~ +released under the GNU/GPL-license this is software with absolutely no warranty use it at your own risk contact - - \ No newline at end of file + + + +-----------------v0.04------------------- +::cleaning up code a bit +::add GNU/GPL license.txt +::new objects: + sp_hardlimit~ sp_impulse~ sp_shape~ sp_transient~ sp_valverect~ sp_wavewrap~ + +-----------------v0.03b------------------ +::change prefix to "sp_", so every extern compiles as single object (for pd-extended) + +-----------------v0.03------------------- +::add prefix "sp." to avoid nameclash +::new objects: + sp_diode~ sp_freqshift~ sp_round~ sp_sieve~ + +-----------------v0.02------------------- +::new objects: + sp_chop~ sp_decimate~ sp_foldover~ sp_freqdiv~ sp_harmgen~ sp_saturate~ sp_vowel~ + +-----------------v0.01------------------- +::initial release \ No newline at end of file diff --git a/rectify~-help.pd b/rectify~-help.pd index 4ebb2c8..a064330 100644 --- a/rectify~-help.pd +++ b/rectify~-help.pd @@ -1,12 +1,12 @@ -#N canvas 149 271 419 288 12; -#N canvas 0 0 450 300 graph1 0; +#N canvas 381 374 379 281 10; +#N canvas 0 0 450 300 (subpatch) 0; #X array rect 44100 float 0; #X coords 0 1 44099 -1 100 70 1; #X restore 231 159 graph; -#X msg 21 113 bang; +#X msg 30 116 bang; #X obj 62 75 osc~ 1.345; #X obj 75 133 tabwrite~ osc; -#N canvas 0 0 450 300 graph1 0; +#N canvas 0 0 450 300 (subpatch) 0; #X array osc 44100 float 0; #X coords 0 1 44099 -1 100 70 1; #X restore 230 72 graph; @@ -16,9 +16,9 @@ #X text 342 153 1; #X text 334 213 -1; #X obj 62 201 tabwrite~ rect; -#X text 208 237 sIgpAck 0.01; +#X text 277 244 sIgpAck 0.01; #X obj 62 165 rectify~; -#X text 166 250 2002 www.weiss-archiv.de; +#X text 205 256 2002 www.weiss-archiv.de; #X text 60 13 ---rectify~---; #X connect 1 0 3 0; #X connect 1 0 10 0; diff --git a/round~-help.pd b/round~-help.pd index 00e11dc..5f4d9e4 100644 --- a/round~-help.pd +++ b/round~-help.pd @@ -1,22 +1,22 @@ -#N canvas 190 492 440 305 12; -#N canvas 0 0 450 300 graph1 0; +#N canvas 410 382 381 280 10; +#N canvas 0 0 450 300 (subpatch) 0; #X array round 44100 float 0; #X coords 0 1.02 44099 -1.02 100 70 1; -#X restore 307 162 graph; -#X msg 18 85 bang; +#X restore 254 148 graph; +#X msg 25 88 bang; #X obj 62 78 osc~ 1.5; -#N canvas 0 0 450 300 graph1 0; +#N canvas 0 0 450 300 (subpatch) 0; #X array osc 44100 float 0; #X coords 0 1 44099 -1 100 70 1; -#X restore 306 75 graph; +#X restore 253 61 graph; #X obj 72 105 tabwrite~ osc; -#X floatatom 145 146 5 0 0 2 coarse - -; +#X floatatom 123 147 5 0 0 2 coarse - -; #X obj 62 201 tabwrite~ round; #X text 60 13 ---round~---; #X text 60 35 simple rounder; -#X text 262 240 sIgpAck 0.03; -#X text 223 254 2005 www.weiss-archiv.de; -#X text 312 12 arg; +#X text 280 241 sIgpAck 0.03; +#X text 209 254 2005 www.weiss-archiv.de; +#X text 286 12 arg; #X obj 62 168 round~ 2; #X connect 1 0 4 0; #X connect 1 0 6 0; diff --git a/sIgpAck.c b/sIgpAck.c deleted file mode 100644 index e666e75..0000000 --- a/sIgpAck.c +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef VERSION -#define VERSION "0.03" -#endif - -#include - - -typedef struct _sigpack -{ - t_object x_obj; -} t_sigpack; - -static t_class* sigpack_class; - -void chop_tilde_setup(); -void decimate_tilde_setup(); -void diode_tilde_setup(); -void foldback_tilde_setup(); -void foldover_tilde_setup(); -void freqdiv_tilde_setup(); -void freqshift_tilde_setup(); -void harmgen_tilde_setup(); -void rectify_tilde_setup(); -void round_tilde_setup(); -void saturate_tilde_setup(); -void sieve_tilde_setup(); -void split_tilde_setup(); -void ustep_tilde_setup(); -void vowel_tilde_setup(); - -static void* sigpack_new(t_symbol* s) { - t_sigpack *x = (t_sigpack *)pd_new(sigpack_class); - return (x); -} - -void sigpack_setup(void) -{ - sigpack_class = class_new(gensym("sIgpAck"), (t_newmethod)sigpack_new, 0, - sizeof(t_sigpack), 0,0); - - chop_tilde_setup(); - decimate_tilde_setup(); - diode_tilde_setup(); - foldback_tilde_setup(); - foldover_tilde_setup(); - freqdiv_tilde_setup(); - freqshift_tilde_setup(); - harmgen_tilde_setup(); - rectify_tilde_setup(); - round_tilde_setup(); - saturate_tilde_setup(); - sieve_tilde_setup(); - split_tilde_setup(); - ustep_tilde_setup(); - vowel_tilde_setup(); - - post("sIgpAck"" "VERSION " weiss www.weiss-archiv.de"); -} diff --git a/saturate~-help.pd b/saturate~-help.pd index a576666..cf326b4 100644 --- a/saturate~-help.pd +++ b/saturate~-help.pd @@ -1,29 +1,28 @@ -#N canvas 202 222 476 321 12; -#N canvas 0 0 450 300 graph1 0; +#N canvas 375 417 421 310 10; +#N canvas 0 0 450 300 (subpatch) 0; #X array sat 44100 float 0; #X coords 0 1.02 44099 -1.02 100 70 1; -#X restore 306 185 graph; -#X msg 17 109 bang; +#X restore 284 165 graph; +#X msg 24 112 bang; #X obj 61 102 osc~ 1.5; -#N canvas 0 0 450 300 graph1 0; +#N canvas 0 0 450 300 (subpatch) 0; #X array osc 44100 float 0; #X coords 0 1 44099 -1 100 70 1; -#X restore 305 99 graph; +#X restore 283 79 graph; #X obj 71 129 tabwrite~ osc; -#X obj 184 172 nbx 5 14 -1 1 0 0 empty empty thresh 0 -6 0 10 -262144 --1 -1 0 256; #X obj 61 225 tabwrite~ sat; #X text 60 35 soft saturation; #X text 316 12 arg; -#X text 263 264 sIgpAck 0.02; +#X text 312 264 sIgpAck 0.02; #X text 60 50 if signal is above threshold; #X text 60 65 a soft saturation is added; #X obj 61 193 saturate~ 0.5; -#X text 223 278 2003 www.weiss-archiv.de; +#X text 240 278 2003 www.weiss-archiv.de; #X text 60 13 ---saturate~---; +#X floatatom 152 174 5 0 0 2 thresh[-1-1] - -; #X connect 1 0 4 0; -#X connect 1 0 6 0; +#X connect 1 0 5 0; #X connect 2 0 4 0; -#X connect 2 0 12 0; -#X connect 5 0 12 1; -#X connect 12 0 6 0; +#X connect 2 0 11 0; +#X connect 11 0 5 0; +#X connect 14 0 11 1; diff --git a/shape~-help.pd b/shape~-help.pd new file mode 100644 index 0000000..b1c6064 --- /dev/null +++ b/shape~-help.pd @@ -0,0 +1,26 @@ +#N canvas 410 382 385 284 10; +#N canvas 0 0 450 300 (subpatch) 0; +#X array shape 44100 float 0; +#X coords 0 1.02 44099 -1.02 100 70 1; +#X restore 254 150 graph; +#X msg 25 88 bang; +#X obj 62 78 osc~ 1.5; +#N canvas 0 0 450 300 (subpatch) 0; +#X array osc 44100 float 0; +#X coords 0 1 44099 -1 100 70 1; +#X restore 253 63 graph; +#X obj 72 105 tabwrite~ osc; +#X floatatom 129 149 5 0 0 2 shape[-10-10] - -; +#X text 60 13 ---shape~---; +#X text 60 31 reshape input by an exponential function; +#X obj 62 168 shape~ 10; +#X obj 62 201 tabwrite~ shape; +#X text 293 12 arg; +#X text 280 241 sIgpAck 0.04; +#X text 209 254 2007 www.weiss-archiv.de; +#X connect 1 0 4 0; +#X connect 1 0 9 0; +#X connect 2 0 4 0; +#X connect 2 0 8 0; +#X connect 5 0 8 1; +#X connect 8 0 9 0; diff --git a/shape~.c b/shape~.c new file mode 100644 index 0000000..338c401 --- /dev/null +++ b/shape~.c @@ -0,0 +1,79 @@ +// sigpack +// for +// pure-data +// by weiss +// www.weiss-archiv.de + +#include "m_pd.h" +#include +#ifdef _MSC_VER +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif + +// ------------------------ shape~ ----------------------------- +// this external reshapes the wave by an exponential function, inspiration was taken from the Nord module of the same name. +// code from swh_plugins by steve harris www.plugin.org.uk + +static t_class *shape_tilde_class; + +typedef struct _shape_tilde +{ + t_object x_obj; + t_sample x_shapep; + float x_f; +} t_shape_tilde; + +static void *shape_tilde_new(t_floatarg waveshape) +{ + t_shape_tilde *x = (t_shape_tilde *)pd_new(shape_tilde_class); + x->x_shapep = waveshape; + outlet_new(&x->x_obj, gensym("signal")); + floatinlet_new(&x->x_obj, &x->x_shapep); + x->x_f = 0; + if (waveshape) x->x_shapep = waveshape; + else x->x_shapep = 0.0f; + return (x); +} + +static t_int *shape_tilde_perform(t_int *w) +{ + t_shape_tilde *x = (t_shape_tilde *)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + int n = (int)(w[4]); + float f, value; + float shape = 0.0f; + if (x->x_shapep < 1.0f && x->x_shapep < -1.0f) { + shape = 1.0f; + } else if (shape < 0) { + shape = -1.0f / shape; + } else { + shape = x->x_shapep; + } + + while (n--) + { + f = *in++; + if (f < 0.0f) { + value = -pow(-f, shape); + } else { + value = pow(f, shape); + } + *out++ = value; + } + return (w+5); +} + +static void shape_tilde_dsp(t_shape_tilde *x, t_signal **sp) +{ + dsp_add(shape_tilde_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); +} + +void shape_tilde_setup(void) +{ + shape_tilde_class = class_new(gensym("shape~"), (t_newmethod)shape_tilde_new, 0, + sizeof(t_shape_tilde), 0, A_DEFFLOAT, 0); + CLASS_MAINSIGNALIN(shape_tilde_class, t_shape_tilde, x_f); + class_addmethod(shape_tilde_class, (t_method)shape_tilde_dsp, gensym("dsp"), 0); +} diff --git a/sieve~-help.pd b/sieve~-help.pd index f121e6d..ed19f3e 100644 --- a/sieve~-help.pd +++ b/sieve~-help.pd @@ -1,24 +1,24 @@ -#N canvas 71 176 480 305 12; -#N canvas 0 0 450 300 graph1 0; +#N canvas 377 364 401 281 10; +#N canvas 0 0 450 300 (subpatch) 0; #X array sieve 44100 float 0; #X coords 0 1.02 44099 -1.02 100 70 1; -#X restore 306 163 graph; -#X msg 18 85 bang; +#X restore 269 150 graph; +#X msg 24 87 bang; #X obj 62 78 osc~ 1.5; -#N canvas 0 0 450 300 graph1 0; +#N canvas 0 0 450 300 (subpatch) 0; #X array osc 44100 float 0; #X coords 0 1 44099 -1 100 70 1; -#X restore 306 75 graph; +#X restore 269 62 graph; #X obj 72 105 tabwrite~ osc; -#X floatatom 119 145 1 0 0 2 mode - -; -#X floatatom 191 151 5 0 0 2 samp[-1/1] - -; -#X text 262 240 sIgpAck 0.03; -#X text 223 254 2005 www.weiss-archiv.de; +#X floatatom 104 140 1 0 0 2 mode - -; +#X floatatom 147 142 5 0 0 2 samp[-1/1] - -; +#X text 295 240 sIgpAck 0.03; +#X text 223 253 2005 www.weiss-archiv.de; #X obj 62 201 tabwrite~ sieve; #X obj 62 168 sieve~ 0 0.5; #X text 60 13 ---sieve~---; #X text 60 35 simple sample sifter; -#X text 294 12 arg; +#X text 279 13 arg; #X connect 1 0 4 0; #X connect 1 0 9 0; #X connect 2 0 4 0; diff --git a/sigpack.c b/sigpack.c new file mode 100644 index 0000000..4215828 --- /dev/null +++ b/sigpack.c @@ -0,0 +1,70 @@ +#ifndef VERSION +#define VERSION "0.04" +#endif + +#include + + +typedef struct _sigpack +{ + t_object x_obj; +} t_sigpack; + +static t_class* sigpack_class; + +void chop_tilde_setup(); +void decimate_tilde_setup(); +void diode_tilde_setup(); +void foldback_tilde_setup(); +void foldover_tilde_setup(); +void freqdiv_tilde_setup(); +void freqshift_tilde_setup(); +void hardlimit_tilde_setup(); +void harmgen_tilde_setup(); +void impulse_tilde_setup(); +void rectify_tilde_setup(); +void round_tilde_setup(); +void saturate_tilde_setup(); +void shape_tilde_setup(); +void sieve_tilde_setup(); +void split_tilde_setup(); +void transient_tilde_setup(); +void ustep_tilde_setup(); +void valverect_tilde_setup(); +void vowel_tilde_setup(); +void wavewrap_tilde_setup(); + +static void* sigpack_new(t_symbol* s) { + t_sigpack *x = (t_sigpack *)pd_new(sigpack_class); + return (x); +} + +void sigpack_setup(void) +{ + sigpack_class = class_new(gensym("sigpack"), (t_newmethod)sigpack_new, 0, + sizeof(t_sigpack), 0,0); + + chop_tilde_setup(); + decimate_tilde_setup(); + diode_tilde_setup(); + foldback_tilde_setup(); + foldover_tilde_setup(); + freqdiv_tilde_setup(); + freqshift_tilde_setup(); + hardlimit_tilde_setup(); + harmgen_tilde_setup(); + impulse_tilde_setup(); + rectify_tilde_setup(); + round_tilde_setup(); + saturate_tilde_setup(); + shape_tilde_setup(); + sieve_tilde_setup(); + split_tilde_setup(); + transient_tilde_setup(); + ustep_tilde_setup(); + valverect_tilde_setup(); + vowel_tilde_setup(); + wavewrap_tilde_setup(); + + post("sigpack"" "VERSION " | 12.2007 | www.weiss-archiv.de"); +} diff --git a/split~-help.pd b/split~-help.pd index 9f4f8b5..02386d6 100644 --- a/split~-help.pd +++ b/split~-help.pd @@ -1,18 +1,18 @@ -#N canvas 343 402 362 261 12; -#X floatatom 208 97 5 0 0 0 - - -; +#N canvas 378 373 323 251 10; +#X floatatom 182 97 5 0 0 0 - - -; #X obj 109 96 sig~; #X floatatom 109 74 5 0 0 0 - - -; -#X obj 208 147 snapshot~; +#X obj 182 147 snapshot~; #X obj 109 147 snapshot~; -#X obj 34 127 metro 20; -#X obj 34 102 loadbang; +#X obj 36 130 metro 20; +#X obj 36 105 loadbang; #X floatatom 109 174 5 0 0 0 - - -; -#X floatatom 208 175 5 0 0 0 - - -; +#X floatatom 182 175 5 0 0 0 - - -; #X text 60 35 signal split function; -#X text 164 209 sIgpAck 0.01; -#X text 224 13 arg; +#X text 225 211 sIgpAck 0.01; +#X text 239 13 arg; #X obj 109 120 split~ 0.5; -#X text 124 224 2002 www.weiss-archiv.de; +#X text 153 225 2002 www.weiss-archiv.de; #X text 60 13 ---split~---; #X connect 0 0 12 1; #X connect 1 0 12 0; diff --git a/transient~-help.pd b/transient~-help.pd new file mode 100644 index 0000000..08bb806 --- /dev/null +++ b/transient~-help.pd @@ -0,0 +1,28 @@ +#N canvas 410 526 389 284 10; +#N canvas 0 0 450 300 (subpatch) 0; +#X array transient 44100 float 0; +#X coords 0 1.02 44099 -1.02 100 70 1; +#X restore 266 146 graph; +#X msg 25 88 bang; +#X obj 62 78 osc~ 1.5; +#N canvas 0 0 450 300 (subpatch) 0; +#X array osc 44100 float 0; +#X coords 0 1 44099 -1 100 70 1; +#X restore 265 59 graph; +#X obj 72 105 tabwrite~ osc; +#X floatatom 116 137 5 0 0 2 attack[-1-1] - -; +#X floatatom 171 151 5 0 0 2 sustain[-1-1] - -; +#X text 60 13 ---transient~---; +#X text 60 35 transient mangler; +#X text 245 12 arg; +#X text 290 240 sIgpAck 0.04; +#X text 219 253 2007 www.weiss-archiv.de; +#X obj 62 201 tabwrite~ transient; +#X obj 62 168 transient~ 1 0.1; +#X connect 1 0 4 0; +#X connect 1 0 12 0; +#X connect 2 0 4 0; +#X connect 2 0 13 0; +#X connect 5 0 13 1; +#X connect 6 0 13 2; +#X connect 13 0 12 0; diff --git a/transient~.c b/transient~.c new file mode 100644 index 0000000..160ad52 --- /dev/null +++ b/transient~.c @@ -0,0 +1,133 @@ +// sigpack +// for +// pure-data +// by weiss +// www.weiss-archiv.de + +#include "m_pd.h" +#include +#include +#ifdef _MSC_VER +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif +#define BUFFER_SIZE 10240 +#define SSTAB 0.00001f +#define ASTAB 0.02f +//Truncate-to-zero modulo (ANSI C doesn`t specify) will only work +//if -m < v < 2m +#define MOD(v,m) (v<0?v+m:(v>=m?v-m:v)) + +// ------------------------ transient~ ----------------------------- +// transient mangler +// code from swh_plugins by steve harris www.plugin.org.uk + +static t_class *transient_tilde_class; + +typedef struct _transient_tilde +{ + t_object x_obj; + t_sample x_attack;//-1 - 1 + t_sample x_sustain;//-1 - 1 + float *x_buffer; + int x_buffer_pos; + long x_count; + float x_fast_buffer_sum; + float x_fast_track; + float x_medi_buffer_sum; + float x_medi_track; + int x_sample_rate; + float x_slow_buffer_sum; + float x_slow_track; + float x_f; +} t_transient_tilde; + +static void *transient_tilde_new(t_floatarg attack, t_floatarg sustain) +{ + t_transient_tilde *x = (t_transient_tilde *)pd_new(transient_tilde_class); + x->x_attack = attack; + x->x_sustain = sustain; + outlet_new(&x->x_obj, gensym("signal")); + floatinlet_new(&x->x_obj, &x->x_attack); + floatinlet_new(&x->x_obj, &x->x_sustain); + //memset(x->x_buffer, '/0', BUFFER_SIZE * sizeof(float)); + x->x_buffer = getbytes(BUFFER_SIZE * sizeof(float)); + x->x_fast_buffer_sum = 0.1; + x->x_medi_buffer_sum = 0.1; + x->x_slow_buffer_sum = 0.1; + x->x_buffer_pos = 0; + x->x_fast_track = 0.0; + x->x_medi_track = 0.0; + x->x_slow_track = 0.0; + x->x_count = 0; + x->x_sample_rate = sys_getsr(); + x->x_f = 0; + if (attack) x->x_attack = attack; + else x->x_attack = 0.0; + if (sustain) x->x_sustain = sustain; + else x->x_sustain = 0.0; + return (x); +} + +static t_int *transient_tilde_perform(t_int *w) +{ + t_transient_tilde *x = (t_transient_tilde *)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + int n = (int)(w[4]); + float f; + const int fast_sum_size = (2 * x->x_sample_rate) / 1000; + const int medi_sum_size = (25 * x->x_sample_rate) / 1000; + const int slow_sum_size = (100 * x->x_sample_rate) / 1000; + const float fast_track_lag = 1.5f / fast_sum_size; + const float medi_track_lag = 1.0f / medi_sum_size; + const float slow_track_lag = 1.3f / slow_sum_size; + float ratio; + + while (n--) + { + f = *in++; + x->x_buffer[x->x_buffer_pos] = fabs(f); + x->x_fast_buffer_sum += x->x_buffer[x->x_buffer_pos]; + x->x_medi_buffer_sum += x->x_buffer[x->x_buffer_pos]; + x->x_slow_buffer_sum += x->x_buffer[x->x_buffer_pos]; + x->x_fast_buffer_sum -= x->x_buffer[MOD(x->x_buffer_pos - fast_sum_size, BUFFER_SIZE)]; + x->x_medi_buffer_sum -= x->x_buffer[MOD(x->x_buffer_pos - medi_sum_size, BUFFER_SIZE)]; + x->x_slow_buffer_sum -= x->x_buffer[MOD(x->x_buffer_pos - slow_sum_size, BUFFER_SIZE)]; + if(x->x_count++ > slow_sum_size) { + x->x_fast_track += (x->x_fast_buffer_sum/fast_sum_size - x->x_fast_track) * fast_track_lag; + x->x_medi_track += (x->x_medi_buffer_sum/medi_sum_size - x->x_medi_track) * medi_track_lag; + x->x_slow_track += (x->x_slow_buffer_sum/slow_sum_size - x->x_slow_track) * slow_track_lag; + } + //Attack + ratio = (x->x_fast_track + ASTAB) / (x->x_medi_track + ASTAB); + if (ratio * x->x_attack > 1.0f) { + f *= ratio * x->x_attack; + } else if (ratio * x->x_attack < 1.0f) { + f /= ratio * -x->x_attack; + } + //Sustain + ratio = (x->x_slow_track + SSTAB) / (x->x_medi_track + SSTAB); + if (ratio * x->x_sustain > 1.0f) { + f *= ratio * x->x_sustain; + } else if (ratio * x->x_sustain < -1.0f) { + f /= ratio * x->x_sustain; + } + *out++ = f; + x->x_buffer_pos = (x->x_buffer_pos +1) % BUFFER_SIZE; + } + return (w+5); +} + +static void transient_tilde_dsp(t_transient_tilde *x, t_signal **sp) +{ + dsp_add(transient_tilde_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); +} + +void transient_tilde_setup(void) +{ + transient_tilde_class = class_new(gensym("transient~"), (t_newmethod)transient_tilde_new, 0, + sizeof(t_transient_tilde), 0, A_DEFFLOAT, A_DEFFLOAT, 0); + CLASS_MAINSIGNALIN(transient_tilde_class, t_transient_tilde, x_f); + class_addmethod(transient_tilde_class, (t_method)transient_tilde_dsp, gensym("dsp"), 0); +} diff --git a/ustep~-help.pd b/ustep~-help.pd index 81cf303..19771ae 100644 --- a/ustep~-help.pd +++ b/ustep~-help.pd @@ -1,38 +1,35 @@ -#N canvas 194 385 571 387 12; +#N canvas 286 425 449 368 10; #X obj 62 318 dac~; -#X obj 95 200 nbx 5 14 0 100 0 0 empty empty empty 0 -6 0 10 -262144 --1 -1 0 256; #X obj 62 283 *~; -#X obj 95 263 line~; -#X obj 95 240 pack 0 50; -#X obj 95 218 dbtorms; -#X floatatom 119 118 1 0 0 0 - - -; -#X obj 177 140 nbx 5 14 0 1 0 0 empty empty empty 0 -6 0 10 -262144 --1 -1 0 256; +#X obj 94 266 line~; +#X obj 94 243 pack 0 50; +#X obj 94 221 dbtorms; +#X floatatom 104 120 1 0 0 0 - - -; #X text 60 35 signal unity step function; -#X text 138 117 Mode[0/1]; -#X text 236 136 Thres[0-1]; -#X text 229 179 Mode0: if signal is above the; -#X text 286 191 specified threshold a unity; -#X text 286 203 step is output \, otherwise zero; -#X text 228 218 Mode1: same as above but if below the; -#X text 283 230 threshold \, the signal passes; -#X text 284 242 unchanged; +#X text 117 119 Mode[0/1]; +#X text 184 203 Mode0: if signal is above the; +#X text 241 215 specified threshold a unity; +#X text 241 227 step is output \, otherwise zero; +#X text 183 242 Mode1: same as above but if below the; +#X text 238 254 threshold \, the signal passes; +#X text 239 266 unchanged; #X obj 62 92 osc~ 440; #X floatatom 62 70 5 0 0 0 - - -; #X text 301 15 arg; -#X text 308 331 sIgpAck 0.01; +#X text 347 332 sIgpAck 0.01; #X obj 62 163 ustep~ 0 0.5; -#X text 269 345 2002 www.weiss-archiv.de; +#X text 276 345 2002 www.weiss-archiv.de; #X text 60 13 ---ustep~---; -#X connect 1 0 5 0; -#X connect 2 0 0 0; -#X connect 2 0 0 1; -#X connect 3 0 2 1; +#X floatatom 161 149 5 0 1 1 thresh[0-1] - -; +#X floatatom 94 203 5 0 100 0 - - -; +#X connect 1 0 0 0; +#X connect 1 0 0 1; +#X connect 2 0 1 1; +#X connect 3 0 2 0; #X connect 4 0 3 0; -#X connect 5 0 4 0; -#X connect 6 0 21 1; -#X connect 7 0 21 2; -#X connect 17 0 21 0; -#X connect 18 0 17 0; -#X connect 21 0 2 0; +#X connect 5 0 18 1; +#X connect 14 0 18 0; +#X connect 15 0 14 0; +#X connect 18 0 1 0; +#X connect 21 0 18 2; +#X connect 22 0 4 0; diff --git a/valverect~-help.pd b/valverect~-help.pd new file mode 100644 index 0000000..4b4b963 --- /dev/null +++ b/valverect~-help.pd @@ -0,0 +1,28 @@ +#N canvas 384 445 398 281 10; +#N canvas 0 0 450 300 (subpatch) 0; +#X array vrect 44100 float 0; +#X coords 0 1.02 44099 -1.02 100 70 1; +#X restore 275 147 graph; +#X msg 25 88 bang; +#X obj 62 78 osc~ 1.5; +#N canvas 0 0 450 300 (subpatch) 0; +#X array osc 44100 float 0; +#X coords 0 1 44099 -1 100 70 1; +#X restore 274 60 graph; +#X obj 72 105 tabwrite~ osc; +#X floatatom 110 126 5 0 1 1 -->level[0-1] - -; +#X floatatom 159 148 5 0 1 1 -->distortion - -; +#X obj 62 201 tabwrite~ vrect; +#X text 60 13 ---valverect~---; +#X text 60 35 valve rectifier; +#X text 243 10 arg; +#X text 303 241 sIgpAck 0.04; +#X text 232 254 2007 www.weiss-archiv.de; +#X obj 62 168 valverect~ 1 1; +#X connect 1 0 4 0; +#X connect 1 0 7 0; +#X connect 2 0 4 0; +#X connect 2 0 13 0; +#X connect 5 0 13 1; +#X connect 6 0 13 2; +#X connect 13 0 7 0; diff --git a/valverect~.c b/valverect~.c new file mode 100644 index 0000000..246878c --- /dev/null +++ b/valverect~.c @@ -0,0 +1,143 @@ +// sigpack +// for +// pure-data +// by weiss +// www.weiss-archive.de + +#include "m_pd.h" +#include +#include +#ifdef _MSC_VER +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif + +// ------------------------ valverect~ ----------------------------- +// valve rectifier +// code from swh_plugins by steve harris www.plugin.org.uk + +// 1.0 / ln(2) +#define LN2R 1.442695041f +/* Fast exponentiation function, y = e^x */ +#define f_exp(x) f_pow2(x * LN2R) + +static t_class *valverect_tilde_class; + +typedef struct _valverect_tilde +{ + t_object x_obj; + t_sample x_sag;//sag level[0-1] + t_sample x_dist_p;//distortion[0-1] + unsigned int x_apos; + float *x_avg; + int x_avg_size; + float x_avg_sizer; + float x_avgs; + float x_lp1tm1; + float x_lp2tm1; + float x_s_rate; + float x_f; +} t_valverect_tilde; + +static void *valverect_tilde_new(t_floatarg sag, t_floatarg dist) +{ + t_valverect_tilde *x = (t_valverect_tilde *)pd_new(valverect_tilde_class); + x->x_sag = sag; + x->x_dist_p = dist; + outlet_new(&x->x_obj, gensym("signal")); + floatinlet_new(&x->x_obj, &x->x_sag); + floatinlet_new(&x->x_obj, &x->x_dist_p); + x->x_s_rate = sys_getsr(); + x->x_avg_size = x->x_s_rate / 9;//number of samples in averaging buffer + x->x_avg_sizer = 9.0f / x->x_s_rate;//reciprocal of above + x->x_avg = (float *)getbytes(x->x_avg_size * sizeof(float));//averaging buffer + memset(x->x_avg, 0, x->x_avg_size * sizeof(float)); + x->x_avgs = 0.0f;//sum of samples in averaging buffer + x->x_apos = 0;//position in averaging buffer + x->x_lp1tm1 = 0.0f;//last value in lowpass 1 + x->x_lp2tm1 = 0.0f;//last value in lowpass 2 + x->x_f = 0; + if (sag) x->x_sag = sag; + else x->x_sag = 0.0; + if (dist) x->x_dist_p = dist; + else x->x_dist_p = 0.0; + return (x); +} + +/* Andrew Simper's pow(2, x) aproximation from the music-dsp list */ +static float f_pow2(float x) +{ + long *px = (long*)(&x); // store address of float as long pointer + const float tx = (x-0.5f) + (3<<22); // temporary value for truncation + const long lx = *((long*)&tx) - 0x4b400000; // integer power of 2 + const float dx = x-(float)(lx); // float remainder of power of 2 + + x = 1.0f + dx*(0.6960656421638072f + // cubic apporoximation of 2^x + dx*(0.224494337302845f + // for x in the range [0, 1] + dx*(0.07944023841053369f))); + *px += (lx<<23); // add integer power of 2 to exponent + + return x; +} + +static t_int *valverect_tilde_perform(t_int *w) +{ + t_valverect_tilde *x = (t_valverect_tilde *)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + int n = (int)(w[4]); + float abs, q, fx; + const float dist = x->x_dist_p * 40.0f + 0.1f; + float f; + while (n--) + { + f = *in++; + abs = fabs(f); + if(abs > x->x_lp1tm1) { + x->x_lp1tm1 = abs; + } + else { + x->x_lp1tm1 = 0.9999f * x->x_lp1tm1 + 0.0001f * abs; + } + x->x_avgs -= x->x_avg[x->x_apos]; + x->x_avgs += x->x_lp1tm1; + x->x_avg[x->x_apos] = x->x_lp1tm1; + x->x_apos %= x->x_avg_size; + + x->x_lp2tm1 = 0.999f * x->x_lp2tm1 + x->x_avgs * x->x_avg_sizer * 0.001f; + q = x->x_lp1tm1 * x->x_sag - x->x_lp2tm1 * 1.02f - 1.0f; + if(q > -0.01f) { + q = -0.01f; + } + else if(q < -1.0f) { + q = -1.0f; + } + + if(f == q) { + fx = 1.0f / dist + q / (1.0f - f_exp(dist * q)); + } + else { + fx = (f - q) / (1.0f - f_exp(-dist * (f - q))) + q / (1.0f - f_exp(dist * q)); + } + *out++ = fx; + } + return (w+5); +} + +static void valverect_tilde_dsp(t_valverect_tilde *x, t_signal **sp) +{ + dsp_add(valverect_tilde_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); +} + +static void valverect_tilde_free(t_valverect_tilde *x) +{ + freebytes(x->x_avg, x->x_avg_size * sizeof(float)); +} + +void valverect_tilde_setup(void) +{ + valverect_tilde_class = class_new(gensym("valverect~"), (t_newmethod)valverect_tilde_new, (t_method)valverect_tilde_free, + sizeof(t_valverect_tilde), 0, A_DEFFLOAT, A_DEFFLOAT, 0); + CLASS_MAINSIGNALIN(valverect_tilde_class, t_valverect_tilde, x_f); + class_addmethod(valverect_tilde_class, (t_method)valverect_tilde_dsp, gensym("dsp"), 0); +} diff --git a/vowel~-help.pd b/vowel~-help.pd index 442032f..6656266 100644 --- a/vowel~-help.pd +++ b/vowel~-help.pd @@ -1,45 +1,44 @@ -#N canvas 308 311 400 400 12; +#N canvas 308 311 323 356 10; #X text 60 35 simple formant filter; #X text 202 11 arg; #X obj 62 78 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 ; #X obj 62 96 metro 200; #X obj 62 120 random 440; -#X msg 195 95 0; -#X msg 195 117 1; -#X msg 195 139 2; -#X msg 195 162 3; -#X msg 194 185 4; -#X obj 193 212 nbx 5 14 0 100 0 0 empty empty empty 0 -6 0 10 -262144 --1 -1 0 256; +#X msg 195 98 0; +#X msg 195 120 1; +#X msg 195 142 2; +#X msg 195 165 3; +#X msg 194 188 4; #X obj 62 294 *~; -#X obj 193 275 line~; -#X obj 193 252 pack 0 50; -#X obj 193 230 dbtorms; +#X obj 193 277 line~; +#X obj 193 254 pack 0 50; +#X obj 193 232 dbtorms; #X obj 62 329 dac~; -#X text 232 93 ->a; -#X text 233 117 ->e; -#X text 232 138 ->i; -#X text 231 162 ->o; -#X text 231 184 ->u; +#X text 232 96 ->a; +#X text 233 120 ->e; +#X text 232 141 ->i; +#X text 231 165 ->o; +#X text 231 187 ->u; #X obj 62 145 phasor~ 220; -#X text 190 315 sIgpAck 0.02; +#X text 226 315 sIgpAck 0.02; #X obj 62 205 vowel~ 0; -#X text 151 330 2003 www.weiss-archiv.de; +#X text 154 329 2003 www.weiss-archiv.de; #X text 60 13 ---vowel~---; +#X floatatom 193 214 5 0 100 0 - - -; #X connect 2 0 3 0; #X connect 3 0 4 0; -#X connect 4 0 21 0; -#X connect 5 0 23 1; -#X connect 6 0 23 1; -#X connect 7 0 23 1; -#X connect 8 0 23 1; -#X connect 9 0 23 1; +#X connect 4 0 20 0; +#X connect 5 0 22 1; +#X connect 6 0 22 1; +#X connect 7 0 22 1; +#X connect 8 0 22 1; +#X connect 9 0 22 1; #X connect 10 0 14 0; -#X connect 11 0 15 0; -#X connect 11 0 15 1; -#X connect 12 0 11 1; +#X connect 10 0 14 1; +#X connect 11 0 10 1; +#X connect 12 0 11 0; #X connect 13 0 12 0; -#X connect 14 0 13 0; -#X connect 21 0 23 0; -#X connect 23 0 11 0; +#X connect 20 0 22 0; +#X connect 22 0 10 0; +#X connect 25 0 13 0; diff --git a/wavewrap~-help.pd b/wavewrap~-help.pd new file mode 100644 index 0000000..e126079 --- /dev/null +++ b/wavewrap~-help.pd @@ -0,0 +1,26 @@ +#N canvas 367 367 385 284 10; +#N canvas 0 0 450 300 (subpatch) 0; +#X array wrap 44100 float 0; +#X coords 0 1.02 44099 -1.02 100 70 1; +#X restore 254 148 graph; +#X msg 25 88 bang; +#X obj 62 78 osc~ 1.5; +#N canvas 0 0 450 300 (subpatch) 0; +#X array osc 44100 float 0; +#X coords 0 1 44099 -1 100 70 1; +#X restore 253 61 graph; +#X obj 72 105 tabwrite~ osc; +#X floatatom 141 147 5 0 10 2 wrap - -; +#X obj 62 168 wavewrap~ 2; +#X text 61 13 ---wavewrap~---; +#X text 60 35 sinus wavewrapper; +#X text 297 12 arg; +#X text 280 241 sIgpAck 0.04; +#X text 209 254 2007 www.weiss-archiv.de; +#X obj 62 201 tabwrite~ wrap; +#X connect 1 0 4 0; +#X connect 1 0 12 0; +#X connect 2 0 4 0; +#X connect 2 0 6 0; +#X connect 5 0 6 1; +#X connect 6 0 12 0; diff --git a/wavewrap~.c b/wavewrap~.c new file mode 100644 index 0000000..36fde56 --- /dev/null +++ b/wavewrap~.c @@ -0,0 +1,72 @@ +// sigpack +// for +// pure-data +// by weiss +// www.weiss-archiv.de + +#include "m_pd.h" +#include +#ifdef _MSC_VER +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif +#define M_PI 3.14159265358979323846 + +// ------------------------ wavewrap~ ----------------------------- +// sinus wavewrapper. produces an unusual distortion effect +// code from swh_plugins by steve harris www.plugin.org.uk + +static t_class *wavewrap_tilde_class; + +typedef struct _wavewrap_tilde +{ + t_object x_obj; + t_sample x_wrap; + float x_f; +} t_wavewrap_tilde; + +static void *wavewrap_tilde_new(t_floatarg wrap) +{ + t_wavewrap_tilde *x = (t_wavewrap_tilde *)pd_new(wavewrap_tilde_class); + x->x_wrap = wrap; + outlet_new(&x->x_obj, gensym("signal")); + floatinlet_new(&x->x_obj, &x->x_wrap); + x->x_f = 0; + if (wrap) x->x_wrap = wrap; + else x->x_wrap = 0; + return (x); +} + +static t_int *wavewrap_tilde_perform(t_int *w) +{ + t_wavewrap_tilde *x = (t_wavewrap_tilde *)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + int n = (int)(w[4]); + float f, value; + float coef = x->x_wrap * M_PI; + if (coef < 0.05f) { + coef = 0.05f; + } + + while (n--) + { + f = *in++; + value = sin(f * coef); + *out++ = value; + } + return (w+5); +} + +static void wavewrap_tilde_dsp(t_wavewrap_tilde *x, t_signal **sp) +{ + dsp_add(wavewrap_tilde_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); +} + +void wavewrap_tilde_setup(void) +{ + wavewrap_tilde_class = class_new(gensym("wavewrap~"), (t_newmethod)wavewrap_tilde_new, 0, + sizeof(t_wavewrap_tilde), 0, A_DEFFLOAT, 0); + CLASS_MAINSIGNALIN(wavewrap_tilde_class, t_wavewrap_tilde, x_f); + class_addmethod(wavewrap_tilde_class, (t_method)wavewrap_tilde_dsp, gensym("dsp"), 0); +} -- cgit v1.2.1