├── PenroseRand.h ├── Updates.txt ├── sound ├── CP.aif ├── BD0010.aif ├── bell.aiff ├── mar2.aif ├── voice.wav ├── BT0AADA.aiff ├── soda-bd.aif ├── trickhit.aif ├── KR55SNAR.aiff ├── hi_c_12b.aiff ├── hi_o_06e.aiff ├── hi_o_15g.aiff ├── kick_11d.aiff └── prettypad.aif ├── lyonpotpourri-meta.pd ├── collect.pl ├── PenroseOscil.h ├── PenroseRand.c ├── smap-help.pd ├── from_msp.c ├── power_of_two.c ├── INSTALLATION.txt ├── leanconvert.c ├── overlapadd.c ├── click2float~-help.pd ├── click2bang~-help.pd ├── fold.c ├── lpp-icon.pd ├── unconvert.c ├── clickhold~-help.pd ├── pd-template.spec ├── shoehorn~-help.pd ├── leanunconvert.c ├── smap.pd ├── latch~-help.pd ├── PenroseOscil.c ├── CHANGELOG.txt ├── bloscbank.c ├── killdc~-help.pd ├── clean_selector~-help.pd ├── rotapan~-help.pd ├── ugens.h ├── click~-help.pd ├── LICENSE.txt ├── ugens_pd.h ├── sfplay~.pd ├── counter~-help.pd ├── granola~-help.pd ├── waveshape~-help.pd ├── distortion~-help.pd ├── lpp.h ├── pulser~-help.pd ├── poltocar~-help.pd ├── lpp-meters.pd ├── clickhold~.c ├── convert.c ├── vecdex~.c ├── vdp~-help.pd ├── MSPd.h ├── epluribus~-help.pd ├── cartopol~-help.pd ├── sel~-help.pd ├── click2bang~.c ├── cartopol~.c ├── click2float~.c ├── poltocar~.c ├── flanjah~-help.pd ├── windowvec~-help.pd ├── bvplay~-help.pd ├── click~.c ├── channel~.c ├── kbuffer~-help.pd ├── channel~-help.pd ├── vecdex~-help.pd ├── magfreq_analysis~-help.pd ├── fftease.h ├── windowvec~.c ├── arrayfilt~.c ├── Makefile ├── sigseq~-help.pd ├── adsr~-help.pd ├── latch~.c ├── dynss~-help.pd ├── killdc~.c ├── squash~-help.pd ├── makewindows.c ├── counter~.c ├── npan~-help.pd ├── markov~-help.pd ├── rtrig~.c ├── quadpan~-help.pd ├── stutter~-help.pd ├── oscil~-help.pd ├── npan~.c ├── pd-lib-builder └── CHANGELOG.txt ├── README.txt ├── quadpan~.c ├── fft.c ├── phasemod~.c ├── epluribus~.c ├── README.md ├── rotapan~.c ├── waveshape~.c ├── convolver~-help.pd ├── expflam~-help.pd ├── player~-help.pd ├── sel~.c ├── phasemod~-help.pd └── sarec~-help.pd /PenroseRand.h: -------------------------------------------------------------------------------- 1 | 2 | t_float rrand(int *seed); 3 | t_float prand(int *seed); 4 | -------------------------------------------------------------------------------- /Updates.txt: -------------------------------------------------------------------------------- 1 | Updates to LyonPotpourri 3.0 2 | 3 | 12.22.2013 4 | Nothing yet! -------------------------------------------------------------------------------- /sound/CP.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlyon/pd-lyonpotpourri/HEAD/sound/CP.aif -------------------------------------------------------------------------------- /sound/BD0010.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlyon/pd-lyonpotpourri/HEAD/sound/BD0010.aif -------------------------------------------------------------------------------- /sound/bell.aiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlyon/pd-lyonpotpourri/HEAD/sound/bell.aiff -------------------------------------------------------------------------------- /sound/mar2.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlyon/pd-lyonpotpourri/HEAD/sound/mar2.aif -------------------------------------------------------------------------------- /sound/voice.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlyon/pd-lyonpotpourri/HEAD/sound/voice.wav -------------------------------------------------------------------------------- /sound/BT0AADA.aiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlyon/pd-lyonpotpourri/HEAD/sound/BT0AADA.aiff -------------------------------------------------------------------------------- /sound/soda-bd.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlyon/pd-lyonpotpourri/HEAD/sound/soda-bd.aif -------------------------------------------------------------------------------- /sound/trickhit.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlyon/pd-lyonpotpourri/HEAD/sound/trickhit.aif -------------------------------------------------------------------------------- /sound/KR55SNAR.aiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlyon/pd-lyonpotpourri/HEAD/sound/KR55SNAR.aiff -------------------------------------------------------------------------------- /sound/hi_c_12b.aiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlyon/pd-lyonpotpourri/HEAD/sound/hi_c_12b.aiff -------------------------------------------------------------------------------- /sound/hi_o_06e.aiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlyon/pd-lyonpotpourri/HEAD/sound/hi_o_06e.aiff -------------------------------------------------------------------------------- /sound/hi_o_15g.aiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlyon/pd-lyonpotpourri/HEAD/sound/hi_o_15g.aiff -------------------------------------------------------------------------------- /sound/kick_11d.aiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlyon/pd-lyonpotpourri/HEAD/sound/kick_11d.aiff -------------------------------------------------------------------------------- /sound/prettypad.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlyon/pd-lyonpotpourri/HEAD/sound/prettypad.aif -------------------------------------------------------------------------------- /lyonpotpourri-meta.pd: -------------------------------------------------------------------------------- 1 | #N canvas 15 49 200 200 10; 2 | #N canvas 25 49 420 300 META 1; 3 | #X text 13 41 NAME lyonpotpourri; 4 | #X text 10 25 AUTHOR Eric Lyon ; 5 | #X text 10 10 VERSION 2.0; 6 | #X text 10 60 LICENSE MIT; 7 | #X restore 10 10 pd META; 8 | -------------------------------------------------------------------------------- /collect.pl: -------------------------------------------------------------------------------- 1 | if (! -e "lyonpotpourri"){ 2 | mkdir("lyonpotpourri"); 3 | } 4 | while(<*>){ 5 | chomp; 6 | if(/darwin$/ | /liblyonpotpourri.dylib/ | /help.pd/){ 7 | `mv $_ lyonpotpourri`; 8 | } 9 | } 10 | `cp lpp-icon.pd lyonpotpourri`; 11 | `cp lpp-meters.pd lyonpotpourri`; 12 | `mv sound lyonpotpourri`; 13 | -------------------------------------------------------------------------------- /PenroseOscil.h: -------------------------------------------------------------------------------- 1 | 2 | t_float frequencyToIncrement( t_float samplingRate, t_float frequency, 3 | int bufferLength ); 4 | 5 | void makeSineBuffer( t_float *buffer, int bufferLength ); 6 | 7 | t_float bufferOscil( t_float *phase, t_float increment, t_float *buffer, 8 | int bufferLength ); 9 | -------------------------------------------------------------------------------- /PenroseRand.c: -------------------------------------------------------------------------------- 1 | #include "PenroseRand.h" 2 | 3 | t_float rrand(int *seed) 4 | { 5 | int i = ((*seed = *seed * 1103515245 + 12345)>>16) & 077777; 6 | return((t_float)i/16384. - 1.); 7 | } 8 | 9 | t_float prand(int *seed) 10 | { 11 | int i = ((*seed = *seed * 1103515245 + 12345)>>16) & 077777; 12 | return((t_float)i/32768.); 13 | } 14 | -------------------------------------------------------------------------------- /smap-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 246 169 450 300 10; 2 | #X obj 141 163 smap 0 4; 3 | #X obj 144 113 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 4 | -1 -1 0 1; 5 | #X floatatom 141 195 5 0 0 0 - - -; 6 | #X text 49 56 remap a 0-127 MIDI input range to the output range specified 7 | in the arguments; 8 | #X connect 0 0 2 0; 9 | #X connect 1 0 0 0; 10 | -------------------------------------------------------------------------------- /from_msp.c: -------------------------------------------------------------------------------- 1 | 2 | #include "MSPd.h" 3 | void atom_arg_getfloat(t_float *c, long idx, long ac, t_atom *av) 4 | { 5 | if (c&&ac&&av&&(idx 2 | #include "PenroseOscil.h" 3 | 4 | 5 | t_float frequencyToIncrement( t_float samplingRate, t_float frequency, int bufferLength ) { 6 | return (frequency / samplingRate) * (t_float) bufferLength; 7 | } 8 | 9 | void makeSineBuffer( t_float *buffer, int bufferLength ) { 10 | int i; 11 | t_float myTwoPi = 8. * atan(1.); 12 | 13 | for ( i=0; i <= bufferLength; i++ ) 14 | *(buffer+i) = sin( myTwoPi * ((t_float) i / (t_float) bufferLength) ); 15 | 16 | return; 17 | } 18 | 19 | 20 | t_float bufferOscil( t_float *phase, t_float increment, t_float *buffer, 21 | int bufferLength ) 22 | { 23 | t_float sample; 24 | 25 | while ( *phase > bufferLength ) 26 | *phase -= bufferLength; 27 | 28 | while ( *phase < 0. ) 29 | *phase += bufferLength; 30 | 31 | sample = *( buffer + (int) (*phase) ); 32 | 33 | *phase += increment; 34 | 35 | return sample; 36 | } 37 | -------------------------------------------------------------------------------- /CHANGELOG.txt: -------------------------------------------------------------------------------- 1 | Version 3.0.1 2 | 3 | Updated function~ with some methods that could be helpful for amp simulation algorithms: tanh, arctan, and abs which implements the formula y = x / (abs(x) + 1). Also added a chebyshev method for classic waveshaping. 4 | 5 | Updated the following externals to use Pd memory functions: 6 | 7 | expflam~, shoehorn~, convolver~, buffet~ ,byplay~~, clean_selector~,chopper~~, byplay~~, clean_selector~, convolver~, dmach~, 8 | dynss~, epluribus~, flanjah~, granola~, kbuffer~, npan~, phasemod~, player~, pulser~, rotapan~, samm~, sarec~, sel~, 9 | shoehorn~, splitbank~, splitspec~, squash~, vdb~, vdp~, granulesf~, granule~, markov~, mask~, quadpan~ 10 | 11 | 12 | Version 3.0 13 | 14 | Code updated from earlier 2.0 version (originally designed in 2005) for compatibility with modern Pd. 15 | Help files updated. Shared functions renamed to (hopefully) avoid name clashes. Ported oracular processing object chameleon~. 16 | 17 | -------------------------------------------------------------------------------- /bloscbank.c: -------------------------------------------------------------------------------- 1 | 2 | #include "fftease.h" 3 | 4 | void bloscbank( t_float *S, t_float *O, int D, t_float iD, t_float *lf, t_float *la, t_float *index, t_float *tab, 5 | int len, t_float synt, int lo, int hi ) 6 | { 7 | int amp,freq,chan, i; 8 | 9 | t_float a,ainc,f,finc,address; 10 | 11 | for ( chan = lo; chan < hi; chan++ ) { 12 | 13 | freq = ( amp = ( chan << 1 ) ) + 1; 14 | if ( S[amp] > synt ) { 15 | finc = ( S[freq] - ( f = lf[chan] ) )* iD; 16 | ainc = ( S[amp] - ( a = la[chan] ) )* iD; 17 | address = index[chan]; 18 | for ( i = 0; i < D ; i++ ) { 19 | O[i] += a*tab[ (int) address ]; 20 | 21 | address += f; 22 | while ( address >= len ) 23 | address -= len; 24 | while ( address < 0 ) 25 | address += len; 26 | a += ainc; 27 | f += finc; 28 | } 29 | lf[chan] = S[freq]; 30 | la[chan] = S[amp]; 31 | index[chan] = address; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /killdc~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 565 486 12; 2 | #X obj 45 256 killdc~; 3 | #X obj 45 204 +~ 0.5; 4 | #X obj 45 174 *~ 0.5; 5 | #N canvas 0 22 450 300 (subpatch) 0; 6 | #X array sine+dc 441 float 2; 7 | #X coords 0 1 441 -1 200 140 1; 8 | #X restore 306 103 graph; 9 | #X obj 24 336 tabwrite~ sine+dc; 10 | #X msg 99 278 bang; 11 | #N canvas 0 22 450 300 (subpatch) 0; 12 | #X array dc-gone 441 float 2; 13 | #X coords 0 1 441 -1 200 140 1; 14 | #X restore 305 257 graph; 15 | #X obj 151 336 tabwrite~ dc-gone; 16 | #X obj 45 144 osc~ 100; 17 | #X text 136 278 <- see DC cut in action; 18 | #X obj 25 375 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 19 | 1; 20 | #X text 45 380 DACs need to be on; 21 | #X obj 22 12 lpp-icon killdc~; 22 | #X text 252 39 - DC blocker; 23 | #X text 24 116 [killdc~] removes DC from input signal; 24 | #X msg 25 398 \; pd dsp \$1; 25 | #X connect 0 0 7 0; 26 | #X connect 1 0 0 0; 27 | #X connect 1 0 4 0; 28 | #X connect 2 0 1 0; 29 | #X connect 5 0 4 0; 30 | #X connect 5 0 7 0; 31 | #X connect 8 0 2 0; 32 | #X connect 10 0 15 0; 33 | -------------------------------------------------------------------------------- /clean_selector~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 662 626 12; 2 | #X msg 141 230 channel \$1; 3 | #X floatatom 141 200 5 0 0 0 - - -; 4 | #X obj 156 266 osc~ 440; 5 | #X obj 221 267 osc~ 777; 6 | #X obj 302 267 noise~; 7 | #X obj 383 265 osc~ 899; 8 | #X msg 47 227 fadetime \$1; 9 | #X msg 47 199 20; 10 | #X msg 173 165 1; 11 | #X msg 207 165 2; 12 | #X msg 239 166 3; 13 | #X text 271 166 select channel; 14 | #X text 43 179 set fadetime; 15 | #X msg 92 199 1000; 16 | #X msg 141 166 0; 17 | #X obj 141 308 lyonpotpourri/clean_selector~ 4 250; 18 | #X obj 108 384 lpp-meters; 19 | #X obj 37 24 lpp-icon clean_selector~; 20 | #X text 267 55 - Cross fade between multiple sources; 21 | #X text 405 308 args: inputs \, fadetime; 22 | #X connect 0 0 15 0; 23 | #X connect 1 0 0 0; 24 | #X connect 2 0 15 0; 25 | #X connect 3 0 15 1; 26 | #X connect 4 0 15 2; 27 | #X connect 5 0 15 3; 28 | #X connect 6 0 15 0; 29 | #X connect 7 0 6 0; 30 | #X connect 8 0 1 0; 31 | #X connect 9 0 1 0; 32 | #X connect 10 0 1 0; 33 | #X connect 13 0 6 0; 34 | #X connect 14 0 1 0; 35 | #X connect 15 0 16 0; 36 | #X connect 15 0 16 1; 37 | -------------------------------------------------------------------------------- /rotapan~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 512 761 12; 2 | #X obj 37 190 osc~ 400; 3 | #X obj 70 213 osc~ 500; 4 | #X obj 202 335 phasor~ 0.08; 5 | #X obj 136 257 osc~ 430; 6 | #X obj 169 280 osc~ 479; 7 | #X obj 103 235 osc~ 300; 8 | #X obj 37 372 lyonpotpourri/rotapan~ 5; 9 | #X obj 37 476 lyonpotpourri/shoehorn~ 5 2; 10 | #X obj 37 559 lpp-meters; 11 | #X floatatom 202 309 5 0 0 1 panning_speed - -; 12 | #X text 28 127 [rotapan~] rotates an array of channels preserving spatial 13 | relations. The rightmost inlet controls the phase of the rotation \, 14 | in the range (0-1). The argument determines the length of the channel 15 | array.; 16 | #X text 222 375 arg: number of input signals; 17 | #X text 251 50 - multichannel rotation; 18 | #X obj 30 23 lpp-icon rotapan~; 19 | #X connect 0 0 6 0; 20 | #X connect 1 0 6 1; 21 | #X connect 2 0 6 5; 22 | #X connect 3 0 6 3; 23 | #X connect 4 0 6 4; 24 | #X connect 5 0 6 2; 25 | #X connect 6 0 7 0; 26 | #X connect 6 1 7 1; 27 | #X connect 6 2 7 2; 28 | #X connect 6 3 7 3; 29 | #X connect 6 4 7 4; 30 | #X connect 7 0 8 0; 31 | #X connect 7 1 8 1; 32 | #X connect 9 0 2 0; 33 | -------------------------------------------------------------------------------- /ugens.h: -------------------------------------------------------------------------------- 1 | /* THIS IS A TOTALLY HACKED HEADER - NO LONGER ANY GOOD FOR CMIX */ 2 | 3 | #define MAXSECTS 20 4 | #define RESON_NO_SCL (0.) 5 | #define START 3 6 | #define STARTM1 2 /* for start of comb memory in a array */ 7 | #define NCOMBS 6 /* for reverb */ 8 | #define NALPASSES 2 /* for reverb */ 9 | 10 | typedef struct { 11 | t_float ps0; 12 | t_float ps1; 13 | t_float ps2; 14 | t_float ps3; 15 | t_float c0; 16 | t_float c1; 17 | t_float c2; 18 | t_float c3; 19 | } LSTRUCT ; 20 | 21 | typedef struct { 22 | int len; 23 | t_float *func; 24 | t_float amp; 25 | t_float phs; 26 | t_float si; 27 | } CMIXOSC ; 28 | 29 | typedef struct { 30 | t_float *arr; 31 | t_float lpt; 32 | t_float rvbt; 33 | int len; 34 | int status; 35 | } CMIXCOMB ; 36 | 37 | typedef struct { 38 | t_float cf; 39 | t_float bw; 40 | t_float scl; 41 | t_float q[5]; 42 | } CMIXRESON ; 43 | 44 | typedef struct { 45 | t_float a; 46 | t_float d; 47 | t_float s; 48 | t_float r; 49 | t_float v1; 50 | t_float v2; 51 | t_float v3; 52 | t_float v4; 53 | t_float v5; 54 | t_float *func; 55 | int len; 56 | } CMIXADSR ; 57 | -------------------------------------------------------------------------------- /click~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 592 447 12; 2 | #N canvas 0 22 450 300 (subpatch) 0; 3 | #X array click-array 8 float 2; 4 | #X coords 0 1 8 -1 140 70 1; 5 | #X restore 227 172 graph; 6 | #X obj 78 321 tabwrite~ click-array; 7 | #X obj 43 176 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 8 | -1; 9 | #X obj 101 292 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 10 | -1 -1; 11 | #X text 61 176 record click; 12 | #X msg 78 228 set 0.333; 13 | #X text 121 293 clear array; 14 | #X msg 154 227 set 1; 15 | #X text 34 116 click~ - convert a bang into a click. the default value 16 | is 1 but the click can be set to any value except zero.; 17 | #X text 75 209 set click value; 18 | #X obj 78 259 lyonpotpourri/click~; 19 | #X msg 77 381 \; pd dsp \$1; 20 | #X obj 77 353 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 21 | 1; 22 | #X text 101 352 DACs must be on for this to work; 23 | #X obj 34 12 lpp-icon click~; 24 | #X text 262 42 - bang to single-sample click converter; 25 | #X connect 2 0 1 0; 26 | #X connect 2 0 10 0; 27 | #X connect 3 0 1 0; 28 | #X connect 5 0 10 0; 29 | #X connect 7 0 10 0; 30 | #X connect 10 0 1 0; 31 | #X connect 12 0 11 0; 32 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | LyonPotpourri for Pd 2 | Copyright (c) 2007-2021 Eric Lyon 3 | 4 | Permission is hereby granted, free of charge, to any person 5 | obtaining a copy of this software and associated documentation 6 | files (the "Software"), to deal in the Software without 7 | restriction, including without limitation the rights to use, 8 | copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /ugens_pd.h: -------------------------------------------------------------------------------- 1 | /* THIS IS A TOTALLY HACKED HEADER - NO LONGER ANY GOOD FOR CMIX */ 2 | 3 | #define MAXSECTS 20 4 | #define RESON_NO_SCL (0.) 5 | #define START 3 6 | #define STARTM1 2 /* for start of comb memory in a array */ 7 | #define NCOMBS 6 /* for reverb */ 8 | #define NALPASSES 2 /* for reverb */ 9 | 10 | typedef struct { 11 | double ps0; 12 | double ps1; 13 | double ps2; 14 | double ps3; 15 | double c0; 16 | double c1; 17 | double c2; 18 | double c3; 19 | } LSTRUCT ; 20 | 21 | typedef struct { 22 | int len; 23 | double *func; 24 | double amp; 25 | double phs; 26 | double si; 27 | } CMIXOSC ; 28 | 29 | typedef struct { 30 | double *arr; 31 | double lpt; 32 | double rvbt; 33 | int len; 34 | int status; 35 | } CMIXCOMB ; 36 | 37 | typedef struct { 38 | double cf; 39 | double bw; 40 | double scl; 41 | double q[5]; 42 | } CMIXRESON ; 43 | 44 | typedef struct { 45 | double a; 46 | double d; 47 | double s; 48 | double r; 49 | double v1; 50 | double v2; 51 | double v3; 52 | double v4; 53 | double v5; 54 | double *func; 55 | int len; 56 | } CMIXADSR ; 57 | -------------------------------------------------------------------------------- /sfplay~.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 456 434 12; 2 | #X obj 49 22 inlet; 3 | #X obj 103 123 bng 16 250 50 0 \$0-bang \$0-dummy empty 17 7 0 10 -228856 4 | -1 -1; 5 | #X obj 49 62 route bang float; 6 | #X obj 103 104 tgl 16 0 \$0-tgl \$0-dummy empty 17 7 0 10 -228856 -1 7 | -1 0 1; 8 | #X obj 103 185 openpanel; 9 | #X msg 103 296 open \$1 \, 1; 10 | #X obj 215 332 readsf~; 11 | #X obj 317 215 spigot; 12 | #X obj 215 382 outlet~; 13 | #X obj 184 172 != 0; 14 | #X text 120 122 Choose; 15 | #X text 120 103 Play, f 6; 16 | #X obj 184 143 trigger float float, f 25; 17 | #X obj 184 201 sel 1; 18 | #X text 195 52 Helper abstraction used in the documentation of FFTease 19 | to play sound files., f 30; 20 | #X obj 184 115 r \$0-tgl; 21 | #X obj 103 271 symbol \$1; 22 | #X connect 0 0 2 0; 23 | #X connect 1 0 4 0; 24 | #X connect 2 0 1 0; 25 | #X connect 2 1 3 0; 26 | #X connect 4 0 16 0; 27 | #X connect 5 0 6 0; 28 | #X connect 6 0 8 0; 29 | #X connect 6 1 7 0; 30 | #X connect 7 0 16 0; 31 | #X connect 9 0 13 0; 32 | #X connect 12 0 9 0; 33 | #X connect 12 1 7 1; 34 | #X connect 13 0 16 0; 35 | #X connect 13 1 6 0; 36 | #X connect 15 0 12 0; 37 | #X connect 16 0 5 0; 38 | #X coords 0 -1 1 1 67 43 2 100 100; 39 | -------------------------------------------------------------------------------- /counter~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 486 409 12; 2 | #X floatatom 38 244 5 0 0 0 - - -; 3 | #N canvas 600 60 450 300 messages 0; 4 | #X obj 86 215 s counter.msgs; 5 | #X msg 87 118 minmax 20 30; 6 | #X msg 217 120 direction \$1; 7 | #X msg 218 58 1; 8 | #X msg 262 84 -1; 9 | #X text 248 58 forward; 10 | #X text 291 83 backward; 11 | #X msg 191 174 setnext 25; 12 | #X text 76 99 reset boundaries; 13 | #X text 269 174 set next value; 14 | #X connect 1 0 0 0; 15 | #X connect 2 0 0 0; 16 | #X connect 3 0 2 0; 17 | #X connect 4 0 2 0; 18 | #X connect 7 0 0 0; 19 | #X restore 131 240 pd messages; 20 | #X obj 46 154 r counter.msgs; 21 | #X text 238 185 args: minimum \, maximum; 22 | #X text 216 241 <- more here; 23 | #X obj 38 208 lyonpotpourri/click2float~; 24 | #X obj 36 14 lpp-icon counter~; 25 | #X text 263 43 - click-driven counter; 26 | #X msg 40 317 \; pd dsp \$1; 27 | #X obj 40 291 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 28 | 1; 29 | #X text 58 292 DACs must be on for this to work; 30 | #X obj 38 122 lyonpotpourri/samm~ 60 2; 31 | #X obj 38 183 lyonpotpourri/counter~ 1 10; 32 | #X connect 2 0 12 0; 33 | #X connect 5 0 0 0; 34 | #X connect 9 0 8 0; 35 | #X connect 11 0 12 0; 36 | #X connect 12 0 5 0; 37 | -------------------------------------------------------------------------------- /granola~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 486 507 12; 2 | #X obj 92 198 phasor~ 450; 3 | #X floatatom 271 199 5 0 0 2 - g-transpose -; 4 | #X obj 274 177 hsl 128 15 0.1 3 0 0 g-transpose granola-transpose-in 5 | transposition_factor -2 -6 0 10 -4075 -1 -1 3941 1; 6 | #X obj 21 194 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 7 | ; 8 | #X msg 21 226 mute \$1; 9 | #X obj 92 298 lpp-meters; 10 | #X obj 16 10 lpp-icon granola~; 11 | #X obj 92 257 lyonpotpourri/granola~ 100; 12 | #X obj 92 229 lyonpotpourri/killdc~; 13 | #N canvas 600 60 191 186 init 0; 14 | #X msg 3 111 1; 15 | #X obj 3 88 loadbang; 16 | #X obj 3 133 s granola-transpose-in; 17 | #X obj 3 63 s granola-gain-in; 18 | #X obj 3 18 loadbang; 19 | #X msg 3 41 0.05; 20 | #X connect 0 0 2 0; 21 | #X connect 1 0 0 0; 22 | #X connect 4 0 5 0; 23 | #X connect 5 0 3 0; 24 | #X restore 255 314 pd init; 25 | #X text 281 258 arg: grain size (ms); 26 | #X text 234 36 - a granular pitch transposer; 27 | #X text 15 107 Overlapped grains provide the capability for transposition 28 | without FFT analysis/resynthesis.; 29 | #X connect 0 0 8 0; 30 | #X connect 1 0 7 1; 31 | #X connect 3 0 4 0; 32 | #X connect 4 0 7 0; 33 | #X connect 7 0 5 0; 34 | #X connect 8 0 7 0; 35 | -------------------------------------------------------------------------------- /waveshape~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 571 761 12; 2 | #X msg 127 369 0 0 0 1 1; 3 | #X msg 129 395 0 0.5 0 0 1 0.3 1; 4 | #X msg 129 422 0 0.2 0 0.2 0 0.2 0 0 1 0 0 0 0 0 0.5; 5 | #X text 126 351 select a weighted summation of Chebychev polynomials 6 | ; 7 | #X obj 398 396 loadbang; 8 | #X obj 31 195 osc~ 200; 9 | #X obj 102 241 osc~ 0.1; 10 | #X obj 102 262 *~ 0.49; 11 | #X obj 102 285 +~ 0.51; 12 | #X obj 31 316 *~; 13 | #X obj 31 444 lyonpotpourri/waveshape~; 14 | #X obj 31 480 lyonpotpourri/killdc~; 15 | #X obj 31 522 lpp-meters; 16 | #X obj 19 15 lpp-icon waveshape~; 17 | #X text 27 109 [waveshape~] stores a user-specified sum of Chebychev 18 | polynomials in a table which is then used as a transfer function. Waveshaping 19 | is a non-linear process - higher amplitude of input will generally 20 | increase the amount of harmonic distortion.; 21 | #X text 95 193 <= sinewave input; 22 | #X text 166 287 <= time-varying gain also varies output spectrum; 23 | #X text 243 49 - waveshaper; 24 | #X connect 0 0 10 0; 25 | #X connect 1 0 10 0; 26 | #X connect 2 0 10 0; 27 | #X connect 4 0 2 0; 28 | #X connect 5 0 9 0; 29 | #X connect 6 0 7 0; 30 | #X connect 7 0 8 0; 31 | #X connect 8 0 9 1; 32 | #X connect 9 0 10 0; 33 | #X connect 10 0 11 0; 34 | #X connect 11 0 12 0; 35 | #X connect 11 0 12 1; 36 | -------------------------------------------------------------------------------- /distortion~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 649 602 12; 2 | #X floatatom 135 247 5 0 0 2 knee knee -; 3 | #X floatatom 221 247 5 0 0 2 cut cut -; 4 | #X obj 49 239 osc~ 270; 5 | #X floatatom 49 217 5 50 10000 0 - - -; 6 | #X obj 228 385 hsl 128 15 0.001 0.4 0 0 knee knee-input knee -2 -6 7 | 0 8 -259157 -1 -1 1560 1; 8 | #X obj 227 417 hsl 128 15 0.01 1 0 0 cut cut-input cut -2 -6 0 8 -259157 9 | -1 -1 1796 1; 10 | #X obj 49 318 lop~ 8000; 11 | #X obj 49 281 lyonpotpourri/distortion~; 12 | #X obj 49 378 lpp-meters; 13 | #X obj 46 26 lpp-icon distortion~; 14 | #X text 274 53 - linear transfer function distortion; 15 | #N canvas 0 23 180 162 init 0; 16 | #X obj 2 23 loadbang; 17 | #X msg 58 64 0.15; 18 | #X msg 3 58 0.05; 19 | #X obj 3 108 s knee-input; 20 | #X obj 34 89 s cut-input; 21 | #X connect 0 0 1 0; 22 | #X connect 0 0 2 0; 23 | #X connect 1 0 4 0; 24 | #X connect 2 0 3 0; 25 | #X restore 224 447 pd init; 26 | #X text 43 139 [distortion~] creates an internal transfer function 27 | to shape the wave. "knee" is where the transfer function starts to 28 | bend and "cut" is the clipping point. The transfer function is linearly 29 | interpolated from the bend point to the cut point., f 79; 30 | #X connect 0 0 7 1; 31 | #X connect 1 0 7 2; 32 | #X connect 2 0 7 0; 33 | #X connect 3 0 2 0; 34 | #X connect 6 0 8 0; 35 | #X connect 6 0 8 1; 36 | #X connect 7 0 6 0; 37 | -------------------------------------------------------------------------------- /lpp.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #define LYONPOTPOURRI_MSG "-[LyonPotpourri 3.0]-" 8 | #define LYONPOTPOURRI_VERSION "3.0 (pre-release 3.1)" 9 | #define LPP_COMPILE_DATE "12 May 2010" 10 | #define lpp_version(objectname) post("%s: version %s compiled %s",objectname,LYONPOTPOURRI_VERSION,LPP_COMPILE_DATE); 11 | // #define potpourri_announce(objname) post("%s\t ( %s )",LYONPOTPOURRI_MSG,objname) 12 | 13 | #define NO_FREE_FUNCTION 0 14 | 15 | #ifndef PI 16 | #define PI 3.1415926535898 17 | #endif 18 | #ifndef PIOVERTWO 19 | #define PIOVERTWO 1.5707963268 20 | #endif 21 | #ifndef TWOPI 22 | #define TWOPI 6.2831853072 23 | #endif 24 | // budget version of Max/MSP denorm function 25 | #define FIX_DENORM_FLOAT(v) (v=(fabs(v) < 0.000001 ? 0.f : (v))) 26 | 27 | 28 | /*** MSP helper functions, thanks JKC! ***/ 29 | 30 | void atom_arg_getfloat(t_float *c, long idx, long ac, t_atom *av); 31 | void atom_arg_getsym(t_symbol **c, long idx, long ac, t_atom *av); 32 | 33 | void atom_arg_getfloat(t_float *c, long idx, long ac, t_atom *av) 34 | { 35 | if (c&&ac&&av&&(idx; 17 | #X text 44 321 sets FFT size and overlap; 18 | #X obj 225 308 lyonpotpourri/windowvec~; 19 | #X obj 225 98 lyonpotpourri/windowvec~; 20 | #X obj 225 171 lyonpotpourri/cartopol~; 21 | #X obj 225 215 lyonpotpourri/poltocar~; 22 | #X connect 0 0 16 0; 23 | #X connect 2 0 17 0; 24 | #X connect 2 1 17 1; 25 | #X connect 4 0 5 0; 26 | #X connect 5 0 15 0; 27 | #X connect 6 0 9 1; 28 | #X connect 7 0 8 0; 29 | #X connect 8 0 9 0; 30 | #X connect 8 1 6 0; 31 | #X connect 8 2 6 1; 32 | #X connect 9 0 10 0; 33 | #X connect 10 0 5 1; 34 | #X connect 12 0 7 0; 35 | #X connect 15 0 1 0; 36 | #X connect 16 0 2 0; 37 | #X connect 17 0 18 0; 38 | #X connect 17 1 18 1; 39 | #X connect 18 0 4 0; 40 | #X connect 18 1 4 1; 41 | #X restore 52 150 pd basic-fft; 42 | #X obj 52 123 osc~ 440; 43 | #X obj 52 184 lpp-meters; 44 | #X obj 43 24 lpp-icon poltocar~; 45 | #X text 272 47 - converts from polar form to rfft~ complex format; 46 | #X connect 0 0 2 0; 47 | #X connect 0 0 2 1; 48 | #X connect 1 0 0 0; 49 | -------------------------------------------------------------------------------- /lpp-meters.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 723 729 12; 2 | #X obj 124 275 vu 15 120 empty empty -1 -8 0 10 -66577 -1 1 0; 3 | #X obj 123 219 - 96; 4 | #X obj 123 157 env~ 8192 4096; 5 | #X obj 180 275 vu 15 120 empty empty -1 -8 0 10 -66577 -1 1 0; 6 | #X obj 202 219 - 96; 7 | #X obj 262 157 env~ 8192 4096; 8 | #X obj 123 91 inlet~; 9 | #X obj 262 91 inlet~; 10 | #X obj 104 407 hsl 134 15 0 1 0 0 empty empty Gain 50 9 0 14 -228856 11 | -1 -1 0 1; 12 | #X obj 321 232 *~; 13 | #X obj 460 236 *~; 14 | #X obj 120 472 change; 15 | #X obj 321 277 dac~; 16 | #X obj 123 249 tgl 15 0 empty \$0-dspstatus DSP 23 7 0 10 -262144 -1 17 | -1 0 1; 18 | #X msg 24 241 \; pd dsp \$1; 19 | #X obj 120 448 != 0; 20 | #X msg 253 374 color #DCDCDC #000000 #000000; 21 | #X obj 120 494 s \$0-dspstatus; 22 | #X obj 44 464 line~; 23 | #X msg 44 441 \$1 10; 24 | #X obj 44 488 *~; 25 | #X obj 44 512 *~; 26 | #X obj 44 544 throw~ \$0-gainval; 27 | #X obj 494 170 catch~ \$0-gainval; 28 | #X connect 1 0 0 0; 29 | #X connect 2 0 1 0; 30 | #X connect 4 0 3 0; 31 | #X connect 5 0 4 0; 32 | #X connect 6 0 9 0; 33 | #X connect 7 0 10 0; 34 | #X connect 8 0 15 0; 35 | #X connect 8 0 19 0; 36 | #X connect 9 0 12 0; 37 | #X connect 9 0 2 0; 38 | #X connect 10 0 12 1; 39 | #X connect 10 0 5 0; 40 | #X connect 11 0 17 0; 41 | #X connect 13 0 14 0; 42 | #X connect 15 0 11 0; 43 | #X connect 18 0 20 0; 44 | #X connect 18 0 20 1; 45 | #X connect 19 0 18 0; 46 | #X connect 20 0 21 1; 47 | #X connect 20 0 21 0; 48 | #X connect 21 0 22 0; 49 | #X connect 23 0 10 1; 50 | #X connect 23 0 9 1; 51 | #X coords 0 -1 1 1 140 182 2 100 240; 52 | -------------------------------------------------------------------------------- /clickhold~.c: -------------------------------------------------------------------------------- 1 | #include "MSPd.h" 2 | 3 | static t_class *clickhold_class; 4 | 5 | #define OBJECT_NAME "clickhold~" 6 | 7 | typedef struct _clickhold 8 | { 9 | t_object x_obj; 10 | t_float x_f; 11 | t_float hold_value; 12 | } t_clickhold; 13 | 14 | static void *clickhold_new(void); 15 | static t_int *clickhold_perform(t_int *w); 16 | static void clickhold_dsp(t_clickhold *x, t_signal **sp); 17 | 18 | 19 | void clickhold_tilde_setup(void) 20 | { 21 | clickhold_class = class_new(gensym("clickhold~"), (t_newmethod)clickhold_new, 22 | NO_FREE_FUNCTION,sizeof(t_clickhold), 0,0); 23 | CLASS_MAINSIGNALIN(clickhold_class, t_clickhold, x_f); 24 | class_addmethod(clickhold_class, (t_method)clickhold_dsp, gensym("dsp"), A_CANT, 0); 25 | potpourri_announce(OBJECT_NAME); 26 | } 27 | 28 | void *clickhold_new(void) 29 | { 30 | t_clickhold *x = (t_clickhold *)pd_new(clickhold_class); 31 | outlet_new(&x->x_obj, gensym("signal")); 32 | x->hold_value = 0; 33 | return x; 34 | } 35 | 36 | t_int *clickhold_perform(t_int *w) 37 | { 38 | t_clickhold *x = (t_clickhold *) (w[1]); 39 | t_float *in_vec = (t_float *)(w[2]); 40 | t_float *out_vec = (t_float *)(w[3]); 41 | int n = (int) w[4]; 42 | 43 | t_float hold_value = x->hold_value; 44 | 45 | while( n-- ) { 46 | if(*in_vec) { 47 | hold_value = *in_vec; 48 | } 49 | in_vec++; 50 | *out_vec++ = hold_value; 51 | 52 | } 53 | x->hold_value = hold_value; 54 | return (w+5); 55 | } 56 | 57 | void clickhold_dsp(t_clickhold *x, t_signal **sp) 58 | { 59 | dsp_add(clickhold_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, (t_int)sp[0]->s_n); 60 | } 61 | -------------------------------------------------------------------------------- /convert.c: -------------------------------------------------------------------------------- 1 | #include "fftease.h" 2 | 3 | 4 | /* S is a spectrum in rfft format, i.e., it contains N real values 5 | arranged as real followed by imaginary values, except for first 6 | two values, which are real parts of 0 and Nyquist frequencies; 7 | convert first changes these into N/2+1 PAIRS of magnitude and 8 | phase values to be stored in output array C; the phases are then 9 | unwrapped and successive phase differences are used to compute 10 | estimates of the instantaneous frequencies for each phase vocoder 11 | analysis channel; decimation rate D and sampling rate R are used 12 | to render these frequency values directly in Hz. */ 13 | 14 | void lpp_convert(t_float *S, t_float *C, int N2, t_float *lastphase, t_float fundamental, t_float factor ) 15 | { 16 | t_float phase, phasediff; 17 | int real, imag, amp,freq; 18 | t_float a, b; 19 | int i; 20 | 21 | /* t_float myTWOPI, myPI; */ 22 | /* double sin(), cos(), atan(), hypot();*/ 23 | 24 | /* myTWOPI = 8.*atan(1.); 25 | myPI = 4.*atan(1.); */ 26 | 27 | 28 | for ( i = 0; i <= N2; i++ ) { 29 | imag = freq = ( real = amp = i<<1 ) + 1; 30 | a = ( i == N2 ? S[1] : S[real] ); 31 | b = ( i == 0 || i == N2 ? 0. : S[imag] ); 32 | 33 | C[amp] = hypot( a, b ); 34 | if ( C[amp] == 0. ) 35 | phasediff = 0.; 36 | else { 37 | phasediff = ( phase = -atan2( b, a ) ) - lastphase[i]; 38 | lastphase[i] = phase; 39 | 40 | while ( phasediff > PI ) 41 | phasediff -= TWOPI; 42 | while ( phasediff < -PI ) 43 | phasediff += TWOPI; 44 | } 45 | C[freq] = phasediff*factor + i*fundamental; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /vecdex~.c: -------------------------------------------------------------------------------- 1 | /* Required Header Files */ 2 | 3 | #include "MSPd.h" 4 | 5 | /* The class pointer */ 6 | 7 | static t_class *vecdex_class; 8 | 9 | /* The object structure */ 10 | 11 | typedef struct _vecdex { 12 | t_object obj; 13 | t_float x_f; 14 | // t_float top; 15 | } t_vecdex; 16 | 17 | #define OBJECT_NAME "vecdex~" 18 | 19 | /* Function prototypes */ 20 | 21 | static void *vecdex_new(t_symbol *msg, int argc, t_atom *argv); 22 | static void vecdex_dsp(t_vecdex *x, t_signal **sp); 23 | static t_int *vecdex_perform(t_int *w); 24 | 25 | /* The object setup function */ 26 | 27 | void vecdex_tilde_setup(void) 28 | { 29 | vecdex_class = class_new(gensym("vecdex~"), (t_newmethod)vecdex_new, 0,sizeof(t_vecdex),0,A_GIMME,0); 30 | CLASS_MAINSIGNALIN(vecdex_class, t_vecdex, x_f); 31 | class_addmethod(vecdex_class, (t_method)vecdex_dsp, gensym("dsp"), A_CANT, 0); 32 | 33 | potpourri_announce(OBJECT_NAME); 34 | } 35 | 36 | /* The new instance routine */ 37 | 38 | void *vecdex_new(t_symbol *msg, int argc, t_atom *argv) 39 | { 40 | t_vecdex *x = (t_vecdex *)pd_new(vecdex_class); 41 | outlet_new(&x->obj, gensym("signal")); 42 | return x; 43 | } 44 | 45 | /* The free memory function*/ 46 | 47 | 48 | /* The perform routine */ 49 | 50 | t_int *vecdex_perform(t_int *w) 51 | { 52 | // t_float *input = (t_float *) (w[2]); 53 | t_float *output = (t_float *) (w[3]); 54 | int n = (int) w[4]; 55 | int i; 56 | 57 | for(i=0; i < n; i++) { 58 | output[i] = i; 59 | } 60 | return w + 5; 61 | } 62 | 63 | void vecdex_dsp(t_vecdex *x, t_signal **sp) 64 | { 65 | dsp_add(vecdex_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, (t_int)sp[0]->s_n); 66 | } 67 | -------------------------------------------------------------------------------- /vdp~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 634 555 12; 2 | #N canvas 600 60 458 308 input-sound 0; 3 | #X obj 130 125 phasor~ 96; 4 | #X obj 130 158 -~ 0.5; 5 | #X obj 130 190 outlet~; 6 | #X connect 0 0 1 0; 7 | #X connect 1 0 2 0; 8 | #X restore 126 143 pd input-sound; 9 | #X floatatom 343 200 5 0 0 0 - - -; 10 | #N canvas 600 60 454 304 delaytime 0; 11 | #X obj 177 107 osc~ 0.1; 12 | #X obj 177 140 *~ 9.9; 13 | #X obj 177 169 +~ 10; 14 | #X obj 177 198 outlet~; 15 | #X connect 0 0 1 0; 16 | #X connect 1 0 2 0; 17 | #X connect 2 0 3 0; 18 | #X restore 250 143 pd delaytime; 19 | #X obj 346 174 hsl 120 20 -0.99 0.99 0 0 empty \$0-feedback feedback_amount 20 | -2 -8 1 10 -76846 -1 -1 1503 1; 21 | #X obj 35 143 r vdp-msgs; 22 | #X obj 157 299 lpp-meters; 23 | #X obj 157 228 lyonpotpourri/vdp~ 20 0 0.5; 24 | #N canvas 600 60 450 300 init 0; 25 | #X obj 38 72 s \$0-feedback; 26 | #X msg 38 44 -0.74; 27 | #X obj 38 17 loadbang; 28 | #X connect 1 0 0 0; 29 | #X connect 2 0 1 0; 30 | #X restore 328 392 pd init; 31 | #N canvas 467 74 774 403 capture-to-array 0; 32 | #N canvas 0 22 450 300 (subpatch) 0; 33 | #X array vdp-catch 882 float 2; 34 | #X coords 0 1 882 -1 200 140 1; 35 | #X restore 35 85 graph; 36 | #X obj 263 152 s vdp-msgs; 37 | #X msg 263 117 copy_to_buffer vdp-catch; 38 | #X text 259 84 copy whatever is in the delay line to an external array 39 | ; 40 | #X connect 2 0 1 0; 41 | #X restore 328 419 pd capture-to-array; 42 | #X obj 29 20 lpp-icon vdp~; 43 | #X text 249 52 - a simple \, self-contained delay unit with feedback 44 | ; 45 | #X connect 0 0 6 0; 46 | #X connect 1 0 6 2; 47 | #X connect 2 0 6 1; 48 | #X connect 3 0 1 0; 49 | #X connect 4 0 6 0; 50 | #X connect 6 0 5 1; 51 | #X connect 6 0 5 0; 52 | -------------------------------------------------------------------------------- /MSPd.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | #ifndef LPP_VERSION 10 | # define LPP_VERSION "3.0" 11 | #endif 12 | #ifndef LPP_COMPILE_DATE 13 | # define LPP_COMPILE_DATE __DATE__ 14 | #endif 15 | #define LPP_ANNOUNCEMENT "-< LyonPotpourri "LPP_VERSION " >- | " 16 | #define LPP_VERSION4PD "LyonPotpourri " LPP_VERSION " for Pd" 17 | 18 | 19 | #define lpp_version(objectname) post("%s: version %s compiled %s",objectname,LPP_VERSION4PDLPP_COMPILE_DATE); 20 | 21 | // #define LYONPOTPOURRI_MSG "--" 22 | 23 | #define NO_FREE_FUNCTION 0 24 | 25 | 26 | /* because Max and Pd have different ideas of what A_FLOAT is, use t_floatarg 27 | to force consistency. Otherwise functions that look good will fail on some 28 | hardware. Also note that Pd messages cannot accept arguments of type A_LONG. */ 29 | 30 | 31 | #include "m_pd.h" 32 | // #define t_floatarg t_float 33 | #define t_double double 34 | 35 | #define atom_getsymarg atom_getsymbolarg 36 | 37 | 38 | #ifndef PIOVERTWO 39 | #define PIOVERTWO 1.5707963268 40 | #endif 41 | #ifndef TWOPI 42 | #define TWOPI 6.2831853072 43 | #endif 44 | #ifndef PI 45 | #define PI 3.14159265358979 46 | #endif 47 | 48 | /*** MSP helper functions **/ 49 | void atom_arg_getfloat(t_float *c, long idx, long ac, t_atom *av); 50 | void atom_arg_getsym(t_symbol **c, long idx, long ac, t_atom *av); 51 | 52 | // #define potpourri_announce(objname) post("( %s )\t%s",objname,LYONPOTPOURRI_MSG) 53 | 54 | // #define potpourri_announce(objname) post("%s ( %s )",LYONPOTPOURRI_MSG,objname) 55 | #define potpourri_announce(objname) post("%s ( %s )",LPP_ANNOUNCEMENT,objname) 56 | -------------------------------------------------------------------------------- /epluribus~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 571 697 12; 2 | #X obj 39 179 phasor~ 620; 3 | #X obj 128 258 phasor~ 620.77; 4 | #X floatatom 218 458 5 0 0 0 - - -; 5 | #X text 262 455 selected channel; 6 | #X obj 218 337 phasor~ 600.9; 7 | #X obj 39 390 lyonpotpourri/epluribus~ 3; 8 | #X obj 218 425 lyonpotpourri/click2float~; 9 | #X obj 39 202 lyonpotpourri/killdc~; 10 | #X obj 218 360 lyonpotpourri/killdc~; 11 | #X obj 128 281 lyonpotpourri/killdc~; 12 | #X obj 39 477 lpp-meters; 13 | #X obj 22 17 lpp-icon epluribus~; 14 | #X text 253 44 - waveform combiner; 15 | #X text 236 389 arg: number of input signals to combine; 16 | #X floatatom 39 151 5 0 0 0 - #0-f1 -; 17 | #X floatatom 128 233 5 0 0 0 - #0-f2 -; 18 | #X floatatom 218 313 5 0 0 0 - #0-f3 -; 19 | #N canvas 0 23 385 386 try-different-frequency-combos 0; 20 | #X obj 48 166 unpack f f f; 21 | #X msg 133 97 620 620.77 600.9; 22 | #X msg 169 122 60 439 1953; 23 | #X obj 48 251 s \$0-f1; 24 | #X obj 88 227 s \$0-f2; 25 | #X obj 129 197 s \$0-f3; 26 | #X msg 94 70 149 300.11 300.328; 27 | #X msg 48 39 200 225 253.125; 28 | #X connect 0 0 3 0; 29 | #X connect 0 1 4 0; 30 | #X connect 0 2 5 0; 31 | #X connect 1 0 0 0; 32 | #X connect 2 0 0 0; 33 | #X connect 6 0 0 0; 34 | #X connect 7 0 0 0; 35 | #X restore 197 613 pd try-different-frequency-combos; 36 | #X text 25 112 [epluribus~] selects the highest absolute-valued sample 37 | from all its inputs \, on a per-sample basis; 38 | #X connect 0 0 7 0; 39 | #X connect 1 0 9 0; 40 | #X connect 4 0 8 0; 41 | #X connect 5 0 10 0; 42 | #X connect 5 0 10 1; 43 | #X connect 5 1 6 0; 44 | #X connect 6 0 2 0; 45 | #X connect 7 0 5 0; 46 | #X connect 8 0 5 2; 47 | #X connect 9 0 5 1; 48 | #X connect 14 0 0 0; 49 | #X connect 15 0 1 0; 50 | #X connect 16 0 4 0; 51 | -------------------------------------------------------------------------------- /cartopol~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 525 503 12; 2 | #N canvas 91 32 1073 583 basic-fft 0; 3 | #X obj 225 66 inlet~; 4 | #X obj 225 341 outlet~; 5 | #X obj 225 136 rfft~; 6 | #X obj 94 403 block~ 1024 8; 7 | #X obj 225 245 rifft~; 8 | #X obj 225 275 *~ 0; 9 | #X obj 719 178 *; 10 | #X msg 671 100 1 1024 8; 11 | #X obj 671 131 unpack f f f; 12 | #X obj 671 210 /; 13 | #X floatatom 671 242 12 0 0 0 - - -; 14 | #X text 757 243 rescale factor; 15 | #X obj 671 69 loadbang; 16 | #X text 11 179 Any processing would go here ->; 17 | #X text 208 407 sets FFT size and overlap; 18 | #X obj 225 179 lyonpotpourri/cartopol~; 19 | #X obj 225 215 lyonpotpourri/poltocar~; 20 | #X obj 225 98 lyonpotpourri/windowvec~; 21 | #X obj 225 308 lyonpotpourri/windowvec~; 22 | #X connect 0 0 17 0; 23 | #X connect 2 0 15 0; 24 | #X connect 2 1 15 1; 25 | #X connect 4 0 5 0; 26 | #X connect 5 0 18 0; 27 | #X connect 6 0 9 1; 28 | #X connect 7 0 8 0; 29 | #X connect 8 0 9 0; 30 | #X connect 8 1 6 0; 31 | #X connect 8 2 6 1; 32 | #X connect 9 0 10 0; 33 | #X connect 10 0 5 1; 34 | #X connect 12 0 7 0; 35 | #X connect 15 0 16 0; 36 | #X connect 15 1 16 1; 37 | #X connect 16 0 4 0; 38 | #X connect 16 1 4 1; 39 | #X connect 17 0 2 0; 40 | #X connect 18 0 1 0; 41 | #X restore 38 241 pd basic-fft; 42 | #X obj 38 214 osc~ 440; 43 | #X floatatom 38 191 5 0 0 0 - - -; 44 | #X text 136 241 <- look here; 45 | #X obj 42 21 lpp-icon cartopol~; 46 | #X text 39 135 [cartopol~] converts Pd-style [rfft~] frames to polar 47 | form. This help file demonstrates the structure of Max pfft~-style 48 | FFT processing for Pd.; 49 | #X obj 38 272 lpp-meters; 50 | #X text 262 53 - Cartesian to polar conversion; 51 | #X connect 0 0 6 0; 52 | #X connect 0 0 6 1; 53 | #X connect 1 0 0 0; 54 | #X connect 2 0 1 0; 55 | -------------------------------------------------------------------------------- /sel~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 489 119 694 490 12; 2 | #X obj 65 186 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 3 | -1; 4 | #X obj 65 367 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 5 | -1; 6 | #X obj 158 390 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 7 | -1 -1; 8 | #X obj 251 415 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 9 | -1 -1; 10 | #X obj 218 186 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 11 | -1 -1; 12 | #X obj 376 187 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 13 | -1 -1; 14 | #X text 39 101 impulses are numerically matched by sending a click 15 | (impulse with value 1.0) to the appropriate outlet, f 56; 16 | #X msg 422 182 set 5.5; 17 | #X obj 422 153 loadbang; 18 | #X obj 65 283 lyonpotpourri/sel~ 1 2 5.5, f 27; 19 | #X obj 218 211 lyonpotpourri/click~; 20 | #X obj 65 211 lyonpotpourri/click~; 21 | #X obj 376 211 lyonpotpourri/click~; 22 | #X obj 251 374 lyonpotpourri/click2bang~; 23 | #X obj 158 349 lyonpotpourri/click2bang~; 24 | #X obj 65 325 lyonpotpourri/click2bang~; 25 | #X obj 256 152 loadbang; 26 | #X msg 256 181 set 2; 27 | #X obj 35 7 lpp-icon sel~; 28 | #X msg 487 377 \; pd dsp \$1; 29 | #X obj 487 348 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 30 | 1; 31 | #X text 508 347 turn on DACs; 32 | #X text 255 33 - sample-accurate implementation of the sel algorithm 33 | ; 34 | #X connect 0 0 11 0; 35 | #X connect 4 0 10 0; 36 | #X connect 5 0 12 0; 37 | #X connect 7 0 12 0; 38 | #X connect 8 0 7 0; 39 | #X connect 9 0 15 0; 40 | #X connect 9 1 14 0; 41 | #X connect 9 2 13 0; 42 | #X connect 10 0 9 0; 43 | #X connect 11 0 9 0; 44 | #X connect 12 0 9 0; 45 | #X connect 13 0 3 0; 46 | #X connect 14 0 2 0; 47 | #X connect 15 0 1 0; 48 | #X connect 16 0 17 0; 49 | #X connect 17 0 10 0; 50 | #X connect 20 0 19 0; 51 | -------------------------------------------------------------------------------- /click2bang~.c: -------------------------------------------------------------------------------- 1 | #include "MSPd.h" 2 | 3 | #define OBJECT_NAME "click2bang~" 4 | 5 | static t_class *click2bang_class; 6 | 7 | typedef struct _click2bang 8 | { 9 | t_object x_obj; 10 | t_float x_f; 11 | void *bang; 12 | void *clock; 13 | } t_click2bang; 14 | 15 | static void *click2bang_new(void); 16 | static t_int *click2bang_perform(t_int *w); 17 | static void click2bang_dsp(t_click2bang *x, t_signal **sp); 18 | static void click2bang_tick(t_click2bang *x) ; 19 | static void click2bang_free(t_click2bang *x); 20 | 21 | void click2bang_tilde_setup(void) 22 | { 23 | click2bang_class = class_new(gensym("click2bang~"), (t_newmethod)click2bang_new,(t_method)click2bang_free, 24 | sizeof(t_click2bang), 0,0); 25 | CLASS_MAINSIGNALIN(click2bang_class, t_click2bang, x_f); 26 | class_addmethod(click2bang_class, (t_method)click2bang_dsp, gensym("dsp"), A_CANT, 0); 27 | potpourri_announce(OBJECT_NAME); 28 | } 29 | 30 | void click2bang_free(t_click2bang *x) 31 | { 32 | clock_free(x->clock); 33 | } 34 | 35 | void click2bang_tick(t_click2bang *x) 36 | { 37 | outlet_bang(x->bang); 38 | } 39 | 40 | void *click2bang_new(void) 41 | { 42 | 43 | t_click2bang *x = (t_click2bang *)pd_new(click2bang_class); 44 | x->bang = outlet_new(&x->x_obj, gensym("bang")); 45 | x->clock = clock_new(x,(void *)click2bang_tick); 46 | return x; 47 | } 48 | 49 | t_int *click2bang_perform(t_int *w) 50 | { 51 | t_click2bang *x = (t_click2bang *) (w[1]); 52 | t_float *in_vec = (t_float *)(w[2]); 53 | int n = (int) w[3]; 54 | 55 | while( n-- ) { 56 | if(*in_vec++) 57 | clock_delay(x->clock, 0); 58 | } 59 | return (w+4); 60 | } 61 | 62 | void click2bang_dsp(t_click2bang *x, t_signal **sp) 63 | { 64 | dsp_add(click2bang_perform, 3, x, sp[0]->s_vec,(t_int)sp[0]->s_n); 65 | } 66 | -------------------------------------------------------------------------------- /cartopol~.c: -------------------------------------------------------------------------------- 1 | #include "MSPd.h" 2 | 3 | static t_class *cartopol_class; 4 | 5 | /* Pd version of cartopol~ */ 6 | 7 | #define OBJECT_NAME "cartopol~" 8 | typedef struct _cartopol 9 | { 10 | t_object x_obj; 11 | t_float x_f; 12 | } t_cartopol; 13 | 14 | static void *cartopol_new(t_symbol *msg, int argc, t_atom *argv); 15 | //static void cartopol_free(t_cartopol *x); 16 | static void cartopol_dsp(t_cartopol *x, t_signal **sp); 17 | 18 | 19 | void cartopol_tilde_setup(void) { 20 | cartopol_class = class_new(gensym("cartopol~"), (t_newmethod)cartopol_new, 21 | 0, sizeof(t_cartopol),0,A_GIMME,0); 22 | CLASS_MAINSIGNALIN(cartopol_class, t_cartopol, x_f); 23 | class_addmethod(cartopol_class, (t_method)cartopol_dsp, gensym("dsp"), A_CANT, 0); 24 | potpourri_announce(OBJECT_NAME); 25 | } 26 | 27 | void *cartopol_new(t_symbol *msg, int argc, t_atom *argv) 28 | { 29 | t_cartopol *x = (t_cartopol *)pd_new(cartopol_class); 30 | inlet_new(&x->x_obj, &x->x_obj.ob_pd,gensym("signal"), gensym("signal")); 31 | outlet_new(&x->x_obj, gensym("signal")); 32 | outlet_new(&x->x_obj, gensym("signal")); 33 | return x; 34 | } 35 | 36 | t_int *cartopol_perform(t_int *w) 37 | { 38 | int i; 39 | t_float *real_in = (t_float *) w[2]; 40 | t_float *imag_in = (t_float *) w[3]; 41 | t_float *mag_out = (t_float *) w[4]; 42 | t_float *phase_out = (t_float *) w[5]; 43 | t_float imag, real; 44 | 45 | int n = (int) w[6]; // obj, func, 1 inlet 46 | int N2 = n/2; 47 | 48 | for(i = 0; i < N2 + 1; i++) { 49 | real = (i == N2 ? real_in[1] : real_in[i]); 50 | imag = (i == 0 || i == N2 ? 0.0 : imag_in[i]); 51 | mag_out[i] = hypot(real,imag); 52 | phase_out[i] = -atan2(imag,real); 53 | } 54 | 55 | return (w + 7); 56 | } 57 | 58 | void cartopol_dsp(t_cartopol *x, t_signal **sp) 59 | { 60 | dsp_add(cartopol_perform,6, x, 61 | sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec, (t_int)sp[0]->s_n); 62 | } 63 | -------------------------------------------------------------------------------- /click2float~.c: -------------------------------------------------------------------------------- 1 | #include "MSPd.h" 2 | 3 | 4 | static t_class *click2float_class; 5 | 6 | 7 | typedef struct _click2float 8 | { 9 | 10 | t_object x_obj; 11 | t_float x_f; 12 | void *float_outlet; 13 | void *clock; 14 | double float_value; 15 | } t_click2float; 16 | 17 | #define OBJECT_NAME "click2float~" 18 | 19 | static void *click2float_new(void); 20 | static t_int *click2float_perform(t_int *w); 21 | static void click2float_dsp(t_click2float *x, t_signal **sp); 22 | static void click2float_tick(t_click2float *x) ; 23 | static void click2float_free(t_click2float *x); 24 | 25 | void click2float_tilde_setup(void) 26 | { 27 | click2float_class = class_new(gensym("click2float~"), (t_newmethod)click2float_new, (t_method)click2float_free,sizeof(t_click2float), 0,0); 28 | CLASS_MAINSIGNALIN(click2float_class, t_click2float, x_f); 29 | class_addmethod(click2float_class, (t_method)click2float_dsp, gensym("dsp"), A_CANT, 0); 30 | potpourri_announce(OBJECT_NAME); 31 | } 32 | 33 | void click2float_tick(t_click2float *x) 34 | { 35 | outlet_float(x->float_outlet,x->float_value); 36 | } 37 | 38 | 39 | void *click2float_new(void) 40 | { 41 | t_click2float *x = (t_click2float *)pd_new(click2float_class); 42 | x->float_outlet = outlet_new(&x->x_obj, gensym("float")); 43 | x->clock = clock_new(x,(void *)click2float_tick); 44 | return x; 45 | } 46 | 47 | t_int *click2float_perform(t_int *w) 48 | { 49 | t_click2float *x = (t_click2float *) (w[1]); 50 | t_float *in_vec = (t_float *)(w[2]); 51 | int n = (int) w[3]; 52 | 53 | while( n-- ) { 54 | if(*in_vec) { 55 | x->float_value = *in_vec; 56 | clock_delay(x->clock, 0); 57 | } 58 | in_vec++; 59 | } 60 | return (w+4); 61 | } 62 | 63 | void click2float_free(t_click2float *x) 64 | { 65 | clock_free(x->clock); 66 | } 67 | 68 | void click2float_dsp(t_click2float *x, t_signal **sp) 69 | { 70 | dsp_add(click2float_perform, 3, x, sp[0]->s_vec,(t_int)sp[0]->s_n); 71 | } 72 | -------------------------------------------------------------------------------- /poltocar~.c: -------------------------------------------------------------------------------- 1 | #include "MSPd.h" 2 | 3 | static t_class *poltocar_class; 4 | 5 | /* Pd version of poltocar~ */ 6 | 7 | #define OBJECT_NAME "poltocar~" 8 | typedef struct _poltocar 9 | { 10 | t_object x_obj; 11 | t_float x_f; 12 | } t_poltocar; 13 | 14 | static void *poltocar_new(t_symbol *msg, int argc, t_atom *argv); 15 | static void poltocar_free(t_poltocar *x); 16 | static void poltocar_dsp(t_poltocar *x, t_signal **sp); 17 | 18 | 19 | void poltocar_tilde_setup(void) { 20 | poltocar_class = class_new(gensym("poltocar~"), (t_newmethod)poltocar_new, 21 | 0, sizeof(t_poltocar),0,A_GIMME,0); 22 | CLASS_MAINSIGNALIN(poltocar_class, t_poltocar, x_f); 23 | class_addmethod(poltocar_class, (t_method)poltocar_dsp, gensym("dsp"), A_CANT, 0); 24 | potpourri_announce(OBJECT_NAME); 25 | } 26 | 27 | void *poltocar_new(t_symbol *msg, int argc, t_atom *argv) 28 | { 29 | t_poltocar *x = (t_poltocar *)pd_new(poltocar_class); 30 | inlet_new(&x->x_obj, &x->x_obj.ob_pd,gensym("signal"), gensym("signal")); 31 | outlet_new(&x->x_obj, gensym("signal")); 32 | outlet_new(&x->x_obj, gensym("signal")); 33 | return x; 34 | } 35 | 36 | t_int *poltocar_perform(t_int *w) 37 | { 38 | int i; 39 | t_float *mag_in = (t_float *) w[2]; 40 | t_float *phase_in = (t_float *) w[3]; 41 | t_float *real_out = (t_float *) w[4]; 42 | t_float *imag_out = (t_float *) w[5]; 43 | t_float real, imag; 44 | 45 | int n = (int) w[6]; // obj, func, 1 inlet 46 | int N2 = n/2; 47 | 48 | for(i = 0; i < N2 + 1; i++) { 49 | real = mag_in[i] * cos( phase_in[i] ); 50 | if(i == N2) { 51 | imag = 0; 52 | } else{ 53 | imag = -mag_in[i] * sin( phase_in[i] ); 54 | } 55 | real_out[i] = real; 56 | imag_out[i] = imag; 57 | } 58 | 59 | return (w + 7); 60 | } 61 | 62 | void poltocar_dsp(t_poltocar *x, t_signal **sp) 63 | { 64 | dsp_add(poltocar_perform,6, x, 65 | sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec, (t_int)sp[0]->s_n); 66 | } 67 | -------------------------------------------------------------------------------- /flanjah~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 618 59 492 674 12; 2 | #X obj 48 218 phasor~ 350; 3 | #X obj 146 180 tgl 15 0 empty \$0-protect empty 0 -6 0 8 -262144 -1 4 | -1 1 1; 5 | #X floatatom 183 248 5 -0.5 0.5 2 feedback feedback -; 6 | #X floatatom 221 287 5 0 0 2 speed1 speed1 -; 7 | #X floatatom 259 319 5 0 0 2 speed2 speed2 -; 8 | #X floatatom 297 349 5 0 1 2 depth depth -; 9 | #X msg 146 207 protect \$1; 10 | #X obj 312 425 hsl 128 15 -0.5 0.5 0 0 feedback feedback-in feedback 11 | -2 -6 0 8 -167887 -1 -1 889 1; 12 | #X obj 312 454 hsl 128 15 0 4 0 0 speed1 speed1-in speed1 -2 -6 0 8 13 | -167887 -1 -1 1048 1; 14 | #X obj 312 483 hsl 128 15 0 4 0 0 speed2 speed2-in speed2 -2 -6 0 8 15 | -167887 -1 -1 794 1; 16 | #X obj 312 511 hsl 128 15 0 1 0 0 depth depth-in depth -2 -6 0 8 -167887 17 | -1 -1 190 1; 18 | #X text 167 177 protect from dangerous feedback; 19 | #X floatatom 48 196 5 0 0 0 - - -; 20 | #X obj 146 373 lyonpotpourri/flanjah~; 21 | #X obj 48 243 -~ 0.5; 22 | #X obj 146 417 lpp-meters; 23 | #X obj 41 14 lpp-icon flanjah~; 24 | #X text 266 42 - A simple flanger; 25 | #X text 43 113 flanger with two recirculating delays; 26 | #N canvas 339 464 462 269 init 0; 27 | #X msg 172 66 0.33; 28 | #X msg 187 87 0.25; 29 | #X obj 207 22 loadbang; 30 | #X obj 37 62 s feedback-in; 31 | #X obj 37 82 s speed1-in; 32 | #X obj 37 102 s speed2-in; 33 | #X obj 37 122 s depth-in; 34 | #X msg 207 108 0.015; 35 | #X msg 163 46 -0.43; 36 | #X obj 272 77 symbol \$0-protect; 37 | #X msg 272 109 \; \$1 1; 38 | #X connect 0 0 4 0; 39 | #X connect 1 0 5 0; 40 | #X connect 2 0 8 0; 41 | #X connect 2 0 0 0; 42 | #X connect 2 0 1 0; 43 | #X connect 2 0 7 0; 44 | #X connect 2 0 9 0; 45 | #X connect 7 0 6 0; 46 | #X connect 8 0 3 0; 47 | #X connect 9 0 10 0; 48 | #X restore 299 585 pd init; 49 | #X connect 0 0 14 0; 50 | #X connect 1 0 6 0; 51 | #X connect 2 0 13 1; 52 | #X connect 3 0 13 2; 53 | #X connect 4 0 13 3; 54 | #X connect 5 0 13 4; 55 | #X connect 6 0 13 0; 56 | #X connect 12 0 0 0; 57 | #X connect 13 0 15 0; 58 | #X connect 13 0 15 1; 59 | #X connect 14 0 13 0; 60 | -------------------------------------------------------------------------------- /windowvec~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 668 440 12; 2 | #N canvas 600 60 662 420 basic-fft 0; 3 | #X obj 246 48 inlet~; 4 | #X obj 246 323 outlet~; 5 | #X obj 246 118 rfft~, f 6; 6 | #X obj 90 323 block~ 1024 8; 7 | #X obj 246 227 rifft~; 8 | #X obj 246 257 *~ 0; 9 | #X obj 480 163 *; 10 | #X msg 432 85 1 1024 8; 11 | #X obj 432 116 unpack f f f; 12 | #X obj 432 195 /; 13 | #X floatatom 432 227 12 0 0 0 - - -; 14 | #X text 426 244 rescale factor; 15 | #X obj 432 54 loadbang; 16 | #X text 59 303 sets FFT size and overlap; 17 | #X obj 246 80 lyonpotpourri/windowvec~; 18 | #X obj 246 290 lyonpotpourri/windowvec~; 19 | #X obj 246 197 lyonpotpourri/poltocar~; 20 | #X obj 246 153 lyonpotpourri/cartopol~; 21 | #X text 30 176 Any processing would go here =>; 22 | #X connect 0 0 14 0; 23 | #X connect 2 0 17 0; 24 | #X connect 2 1 17 1; 25 | #X connect 4 0 5 0; 26 | #X connect 5 0 15 0; 27 | #X connect 6 0 9 1; 28 | #X connect 7 0 8 0; 29 | #X connect 8 0 9 0; 30 | #X connect 8 1 6 0; 31 | #X connect 8 2 6 1; 32 | #X connect 9 0 10 0; 33 | #X connect 10 0 5 1; 34 | #X connect 12 0 7 0; 35 | #X connect 14 0 2 0; 36 | #X connect 15 0 1 0; 37 | #X connect 16 0 4 0; 38 | #X connect 16 1 4 1; 39 | #X connect 17 0 16 0; 40 | #X connect 17 1 16 1; 41 | #X restore 32 156 pd basic-fft; 42 | #X obj 32 129 osc~ 440; 43 | #X text 35 94 windowvec~ - applies a Hann window to each incoming signal 44 | vector. Useful for the the windowing portion of an overlap-add process. 45 | , f 66; 46 | #X obj 32 197 lpp-meters; 47 | #X obj 27 9 lpp-icon windowvec~; 48 | #X text 253 39 - signal vector windowing; 49 | #X obj 201 341 pdcontrol; 50 | #X msg 201 277 browse https://www.areditions.com/lyon-designing-audio-objects-for-max-msp-and-pd-das025.html 51 | ; 52 | #X obj 201 239 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 53 | -1 -1; 54 | #X text 227 236 For more information on what this external is useful 55 | for \, see Chapter 8 of my book on designing audio objects.; 56 | #X connect 0 0 3 0; 57 | #X connect 0 0 3 1; 58 | #X connect 1 0 0 0; 59 | #X connect 7 0 6 0; 60 | #X connect 8 0 7 0; 61 | -------------------------------------------------------------------------------- /bvplay~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 673 608 12; 2 | #N canvas 348 477 724 547 load-a-sound 0; 3 | #X obj 49 245 soundfiler; 4 | #X obj 49 119 openpanel; 5 | #X obj 49 92 inlet; 6 | #X msg 49 142 read -resize \$1 bvplay-demo-array; 7 | #X obj 307 107 loadbang; 8 | #X msg 307 143 read -resize sound/voice.wav bvplay-demo-array; 9 | #X connect 1 0 3 0; 10 | #X connect 2 0 1 0; 11 | #X connect 3 0 0 0; 12 | #X connect 4 0 5 0; 13 | #X connect 5 0 0 0; 14 | #X restore 219 425 pd load-a-sound; 15 | #X obj 219 396 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 16 | -1; 17 | #N canvas 0 22 450 300 (subpatch) 0; 18 | #X array bvplay-demo-array 62079 float 2; 19 | #X coords 0 1 62079 -1 100 70 1 0 0; 20 | #X restore 210 502 graph; 21 | #X text 371 344 args: name \, chans \, taper; 22 | #X msg 42 232 taper \$1; 23 | #X floatatom 42 211 5 5 250 0 - #0-bvplay-taper -; 24 | #X text 107 231 set fadein/fadeout for each note; 25 | #X text 185 264 example notes; 26 | #X msg 67 264 0 500 1.2 1; 27 | #X msg 88 284 900 1000 -0.5 1; 28 | #X text 238 397 <- first load in a sound (recommend at least 5 secs) 29 | or use default sound loaded if you prefer; 30 | #X obj 42 387 lpp-meters; 31 | #X obj 39 28 lpp-icon bvplay~; 32 | #X text 262 56 - enveloped array playback; 33 | #X obj 42 348 lyonpotpourri/bvplay~ bvplay-demo-array 1 30; 34 | #X text 39 130 Send note statements to [bvplay~] in list format: [skip 35 | duration increment amplitude]. [bvplay~] will omit overlapped notes 36 | \, but multiple units can be used for polyphony., f 52; 37 | #X text 211 288 negative increments ok; 38 | #N canvas 155 117 450 300 init 0; 39 | #X obj 41 42 loadbang; 40 | #X msg 41 138 \; \$1 100; 41 | #X obj 41 105 symbol \$0-bvplay-taper; 42 | #X obj 41 75 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 43 | -1; 44 | #X connect 0 0 3 0; 45 | #X connect 2 0 1 0; 46 | #X connect 3 0 2 0; 47 | #X restore 219 451 pd init; 48 | #X connect 1 0 0 0; 49 | #X connect 4 0 14 0; 50 | #X connect 5 0 4 0; 51 | #X connect 8 0 14 0; 52 | #X connect 9 0 14 0; 53 | #X connect 14 0 11 0; 54 | #X connect 14 0 11 1; 55 | -------------------------------------------------------------------------------- /click~.c: -------------------------------------------------------------------------------- 1 | #include "MSPd.h" 2 | 3 | static t_class *click_class; 4 | 5 | typedef struct _click 6 | { 7 | t_object x_obj; 8 | t_float x_f; 9 | void *float_outlet; 10 | t_float float_value; 11 | long status; 12 | } t_click; 13 | 14 | #define OBJECT_NAME "click~" 15 | 16 | static void *click_new(t_symbol *s, int argc, t_atom *argv); 17 | static void click_bang(t_click *x); 18 | static t_int *click_perform(t_int *w); 19 | static void click_dsp(t_click *x, t_signal **sp); 20 | static void click_set(t_click *x, t_floatarg f); 21 | 22 | #define NO_FREE_FUNCTION 0 23 | void click_tilde_setup(void) 24 | { 25 | click_class = class_new(gensym("click~"), (t_newmethod)click_new, 26 | NO_FREE_FUNCTION,sizeof(t_click), 0,A_GIMME,0); 27 | CLASS_MAINSIGNALIN(click_class, t_click, x_f); 28 | class_addmethod(click_class, (t_method)click_dsp, gensym("dsp"), A_CANT, 0); 29 | class_addmethod(click_class, (t_method)click_bang, gensym("bang"), 0); 30 | class_addmethod(click_class, (t_method)click_set, gensym("set"), A_FLOAT, 0); 31 | potpourri_announce(OBJECT_NAME); 32 | } 33 | 34 | void click_bang(t_click *x) 35 | { 36 | x->status = 1; 37 | } 38 | 39 | void click_set(t_click *x, t_floatarg f) 40 | { 41 | x->float_value = f; 42 | } 43 | 44 | void *click_new(t_symbol *s, int argc, t_atom *argv) 45 | { 46 | t_click *x = (t_click *)pd_new(click_class); 47 | x->float_outlet = outlet_new(&x->x_obj, gensym("signal")); 48 | x->float_value = 1.0; 49 | x->status = 0; 50 | return x; 51 | } 52 | 53 | t_int *click_perform(t_int *w) 54 | { 55 | t_click *x = (t_click *) (w[1]); 56 | t_float *output = (t_float *)(w[2]); 57 | int n = (int) w[3]; 58 | int i; 59 | if(x->status) { 60 | x->status = 0; 61 | output[0] = x->float_value; 62 | for(i = 1; i < n; i++) { 63 | output[i] = 0.0; 64 | } 65 | } 66 | else { 67 | for(i = 0; i < n; i++) { 68 | output[i] = 0.0; 69 | } 70 | } 71 | return w+4; 72 | } 73 | 74 | void click_dsp(t_click *x, t_signal **sp) 75 | { 76 | dsp_add(click_perform, 3, x, sp[0]->s_vec, (t_int)sp[0]->s_n); 77 | } 78 | -------------------------------------------------------------------------------- /channel~.c: -------------------------------------------------------------------------------- 1 | #include "MSPd.h" 2 | 3 | static t_class *channel_class; 4 | 5 | 6 | typedef struct _channel 7 | { 8 | 9 | t_object x_obj; 10 | t_float x_f; 11 | void *float_outlet; 12 | int channel; 13 | } t_channel; 14 | 15 | #define OBJECT_NAME "channel~" 16 | 17 | static void *channel_new(t_symbol *s, int argc, t_atom *argv); 18 | static t_int *channel_perform(t_int *w); 19 | static void channel_dsp(t_channel *x, t_signal **sp); 20 | static void channel_channel(t_channel *x, t_floatarg chan) ; 21 | //static void channel_int(t_channel *x, long chan) ; 22 | 23 | #define NO_FREE_FUNCTION 0 24 | void channel_tilde_setup(void) 25 | { 26 | channel_class = class_new(gensym("channel~"), (t_newmethod)channel_new, 27 | NO_FREE_FUNCTION,sizeof(t_channel), 0,A_GIMME,0); 28 | CLASS_MAINSIGNALIN(channel_class, t_channel, x_f); 29 | class_addmethod(channel_class, (t_method)channel_dsp, gensym("dsp"), A_CANT, 0); 30 | class_addmethod(channel_class,(t_method)channel_channel,gensym("channel"),A_FLOAT,0); 31 | potpourri_announce(OBJECT_NAME); 32 | } 33 | 34 | void channel_channel(t_channel *x, t_floatarg chan) 35 | { 36 | if(chan >= 0) 37 | x->channel = (int) chan; 38 | } 39 | 40 | 41 | void channel_int(t_channel *x, long chan) 42 | { 43 | if(chan >= 0) 44 | x->channel = (int) chan; 45 | } 46 | 47 | void *channel_new(t_symbol *s, int argc, t_atom *argv) 48 | { 49 | 50 | t_channel *x = (t_channel *)pd_new(channel_class); 51 | outlet_new(&x->x_obj, gensym("signal")); 52 | 53 | x->channel = (int)atom_getfloatarg(0,argc,argv); 54 | return (x); 55 | } 56 | 57 | t_int *channel_perform(t_int *w) 58 | { 59 | t_channel *x = (t_channel *) (w[1]); 60 | t_float *in_vec = (t_float *)(w[2]); 61 | t_float *out_vec = (t_float *)(w[3]); 62 | int n = (int) w[4]; 63 | int channel = x->channel; 64 | t_float value; 65 | 66 | if(channel < 0 || channel > n) { 67 | return w + 5; 68 | } 69 | value = in_vec[channel]; 70 | 71 | while( n-- ) { 72 | *out_vec++ = value; 73 | } 74 | return w + 5; 75 | } 76 | 77 | void channel_dsp(t_channel *x, t_signal **sp) 78 | { 79 | dsp_add(channel_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, (t_int)sp[0]->s_n); 80 | } 81 | -------------------------------------------------------------------------------- /kbuffer~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 637 711 12; 2 | #X text 302 301 args: ksampling rate \, storage time (in ms.); 3 | #N canvas 600 60 466 316 more-messages 0; 4 | #X msg 238 89 size 4000; 5 | #X obj 173 154 outlet; 6 | #X msg 275 124 info; 7 | #X msg 137 91 ksrate 1024; 8 | #X text 134 55 reset size or krate; 9 | #X connect 0 0 1 0; 10 | #X connect 2 0 1 0; 11 | #X connect 3 0 1 0; 12 | #X restore 332 264 pd more-messages; 13 | #X msg 73 259 record; 14 | #X msg 128 260 play; 15 | #X msg 173 261 stop; 16 | #X msg 216 261 speed \$1; 17 | #X msg 291 261 loop; 18 | #X obj 74 367 phasor~; 19 | #X floatatom 288 356 5 0 0 0 - - -; 20 | #X floatatom 56 230 5 0 0 2 kb-input kb-input -; 21 | #X obj 205 447 hsl 128 15 300 1000 0 0 kb-input empty empty -2 -6 0 22 | 8 -261119 -1 -1 0 1; 23 | #X floatatom 216 219 5 0 0 0 - - -; 24 | #X msg 216 196 1; 25 | #X obj 216 175 loadbang; 26 | #X text 262 214 try different playback speed \, negative OK; 27 | #X text 203 419 hit record \; then perform some wiggles here:; 28 | #X text 256 239 after done recording \, hit loop or play; 29 | #N canvas 0 22 222 238 monitor-phase 0; 30 | #X obj 101 116 metro 100; 31 | #X obj 101 97 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 32 | ; 33 | #X obj 101 144 snapshot~; 34 | #X obj 101 42 loadbang; 35 | #X msg 101 67 1; 36 | #X obj 101 179 outlet; 37 | #X obj 15 48 inlet~; 38 | #X connect 0 0 2 0; 39 | #X connect 1 0 0 0; 40 | #X connect 2 0 5 0; 41 | #X connect 3 0 4 0; 42 | #X connect 4 0 1 0; 43 | #X connect 6 0 2 0; 44 | #X restore 288 332 pd monitor-phase; 45 | #X text 51 139 kbuffer~ lets you sample gestures with a lower sampling 46 | rate than the audio rate., f 68; 47 | #X obj 74 484 lpp-meters; 48 | #X obj 74 402 lyonpotpourri/killdc~; 49 | #X obj 74 304 lyonpotpourri/kbuffer~ 512 8000; 50 | #X obj 41 37 lpp-icon kbuffer~; 51 | #X text 262 61 - control-rate sampling of gestural input; 52 | #X connect 1 0 21 0; 53 | #X connect 2 0 21 0; 54 | #X connect 3 0 21 0; 55 | #X connect 4 0 21 0; 56 | #X connect 5 0 21 0; 57 | #X connect 6 0 21 0; 58 | #X connect 7 0 20 0; 59 | #X connect 9 0 21 0; 60 | #X connect 11 0 5 0; 61 | #X connect 12 0 11 0; 62 | #X connect 13 0 12 0; 63 | #X connect 17 0 8 0; 64 | #X connect 20 0 19 0; 65 | #X connect 20 0 19 1; 66 | #X connect 21 0 7 0; 67 | #X connect 21 1 17 0; 68 | -------------------------------------------------------------------------------- /channel~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 641 760 12; 2 | #X floatatom 37 714 5 0 0 0 - - -; 3 | #X obj 37 684 snapshot~; 4 | #X obj 37 275 / 64; 5 | #X floatatom 37 300 5 0 0 0 - - -; 6 | #X obj 37 453 osc~; 7 | #X obj 37 564 sqrt~; 8 | #X obj 37 527 *~; 9 | #X obj 87 527 *~; 10 | #X msg 204 542 channel \$1; 11 | #X floatatom 204 518 5 0 0 0 - - -; 12 | #X obj 37 478 rfft~; 13 | #X obj 130 678 metro 250; 14 | #X floatatom 62 339 5 0 0 0 - - -; 15 | #X text 106 337 harmonic to synthesize; 16 | #X msg 204 245 2; 17 | #X obj 172 167 loadbang; 18 | #X text 247 516 index to monitor; 19 | #X obj 130 625 loadbang; 20 | #X msg 130 649 1; 21 | #X text 248 501 signal vector; 22 | #X obj 38 18 lpp-icon channel~; 23 | #X text 34 122 [channel~] - utility to probe a specific position within 24 | a signal vector. Useful for examining FFT data.; 25 | #X obj 37 591 lyonpotpourri/channel~ 1; 26 | #X obj 37 222 samplerate~; 27 | #X floatatom 37 253 5 0 0 0 - - -; 28 | #X obj 172 190 t b b; 29 | #X msg 349 659 \; pd dsp \$1; 30 | #X obj 349 631 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 31 | 1; 32 | #X text 81 275 assume vector size of 64 samples; 33 | #X floatatom 37 420 5 0 0 0 - - -; 34 | #X obj 37 386 * 1; 35 | #X obj 62 361 t b f; 36 | #X text 76 301 FFT fundantal frequency of analysis; 37 | #X text 218 588 arg: initial vector index to probe; 38 | #X text 263 49 - probe a fixed index within a signal vector; 39 | #X text 78 423 manually change this to see what happens when the frequency 40 | does not exactly match a harmonic of the analysis frequency; 41 | #X connect 1 0 0 0; 42 | #X connect 2 0 3 0; 43 | #X connect 3 0 30 0; 44 | #X connect 4 0 10 0; 45 | #X connect 5 0 22 0; 46 | #X connect 6 0 5 0; 47 | #X connect 7 0 5 0; 48 | #X connect 8 0 22 0; 49 | #X connect 9 0 8 0; 50 | #X connect 10 0 6 0; 51 | #X connect 10 0 6 1; 52 | #X connect 10 1 7 1; 53 | #X connect 10 1 7 0; 54 | #X connect 11 0 1 0; 55 | #X connect 12 0 31 0; 56 | #X connect 14 0 12 0; 57 | #X connect 14 0 9 0; 58 | #X connect 15 0 25 0; 59 | #X connect 17 0 18 0; 60 | #X connect 18 0 11 0; 61 | #X connect 22 0 1 0; 62 | #X connect 23 0 24 0; 63 | #X connect 24 0 2 0; 64 | #X connect 25 0 23 0; 65 | #X connect 25 1 14 0; 66 | #X connect 27 0 26 0; 67 | #X connect 29 0 4 0; 68 | #X connect 30 0 29 0; 69 | #X connect 31 0 30 0; 70 | #X connect 31 1 30 1; 71 | -------------------------------------------------------------------------------- /vecdex~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 641 539 12; 2 | #X obj 43 199 noise~; 3 | #N canvas 600 60 601 529 fft-hipass 0; 4 | #X obj 86 50 inlet~; 5 | #X obj 225 472 outlet~; 6 | #X obj 225 136 rfft~, f 6; 7 | #X obj 225 376 rifft~; 8 | #X obj 225 406 *~ 0; 9 | #X obj 441 302 *; 10 | #X msg 393 224 1 1024 8; 11 | #X obj 393 255 unpack f f f; 12 | #X obj 393 334 /; 13 | #X floatatom 393 366 12 0 0 0 - - -; 14 | #X text 474 367 rescale factor; 15 | #X obj 393 193 loadbang; 16 | #X obj 210 314 *~; 17 | #X obj 170 51 inlet; 18 | #X obj 79 484 block~ 1024 8; 19 | #X obj 225 97 lyonpotpourri/windowvec~; 20 | #X obj 225 171 lyonpotpourri/cartopol~; 21 | #X obj 225 346 lyonpotpourri/poltocar~; 22 | #X obj 225 439 lyonpotpourri/windowvec~; 23 | #X obj 38 147 lyonpotpourri/vecdex~; 24 | #X obj 83 285 expr~ $v1 > $f2; 25 | #X obj 103 185 loadbang; 26 | #X msg 103 211 20; 27 | #X text 165 24 only pass through bin magnitudes for bin numbers greater 28 | than right operand of the [expr~] comparison; 29 | #X connect 0 0 15 0; 30 | #X connect 2 0 16 0; 31 | #X connect 2 1 16 1; 32 | #X connect 3 0 4 0; 33 | #X connect 4 0 18 0; 34 | #X connect 5 0 8 1; 35 | #X connect 6 0 7 0; 36 | #X connect 7 0 8 0; 37 | #X connect 7 1 5 0; 38 | #X connect 7 2 5 1; 39 | #X connect 8 0 9 0; 40 | #X connect 9 0 4 1; 41 | #X connect 11 0 6 0; 42 | #X connect 12 0 17 0; 43 | #X connect 13 0 20 1; 44 | #X connect 15 0 2 0; 45 | #X connect 16 0 12 1; 46 | #X connect 16 1 17 1; 47 | #X connect 17 0 3 0; 48 | #X connect 17 1 3 1; 49 | #X connect 18 0 1 0; 50 | #X connect 19 0 20 0; 51 | #X connect 20 0 12 0; 52 | #X connect 21 0 22 0; 53 | #X connect 22 0 20 1; 54 | #X restore 43 238 pd fft-hipass; 55 | #X obj 134 149 hsl 128 15 0 100 0 0 empty empty empty -2 -8 0 10 -262144 56 | -1 -1 0 1; 57 | #X floatatom 131 202 5 0 0 0 - - -; 58 | #X obj 43 318 lpp-meters; 59 | #X text 149 237 <= open to see workings of this hipass filter; 60 | #X obj 31 13 lpp-icon vecdex~; 61 | #X text 255 41 - ramp through indices of a signal vector; 62 | #X text 35 103 outputs the current index within a signal vector. It 63 | can be useful for spectral processing \, as demonstrated here., f 64 | 64; 65 | #X obj 131 174 expr rint($f1); 66 | #X text 266 147 set rollup bin for hipass filter; 67 | #X connect 0 0 1 0; 68 | #X connect 1 0 4 0; 69 | #X connect 1 0 4 1; 70 | #X connect 2 0 9 0; 71 | #X connect 3 0 1 1; 72 | #X connect 9 0 3 0; 73 | -------------------------------------------------------------------------------- /magfreq_analysis~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 511 74 783 622 12; 2 | #X obj 207 247 osc~ 440; 3 | #X msg 108 319 channel \$1; 4 | #X floatatom 108 294 5 0 0 0 - #0-channel -; 5 | #X obj 207 468 snapshot~; 6 | #X obj 256 442 metro 100; 7 | #X obj 256 421 tgl 15 0 empty \$0-metrotog empty 17 7 0 10 -262144 8 | -1 -1 1 1; 9 | #X floatatom 128 541 5 0 0 0 - - -; 10 | #X obj 403 468 snapshot~; 11 | #X floatatom 403 541 8 0 0 0 - - -; 12 | #X floatatom 176 209 5 0 0 0 - #0-frequency -; 13 | #X msg 308 247 fftinfo; 14 | #X obj 32 14 lpp-icon magfreq_analysis~; 15 | #X text 465 540 <= estimated frequency for selected bin; 16 | #X text 173 540 <= amplitude for selected bin; 17 | #X text 21 292 select bin to inspect, f 10; 18 | #X text 255 42 - estimate of instantaneous amplitude/frequency spectrum 19 | ; 20 | #X text 465 280 args: overlap factor \, window factor; 21 | #X text 34 109 Analyze input as amplitude/frequency spectra. Optional 22 | arguments are overlap factor and window factor \, which must both be 23 | a factor of 2, f 71; 24 | #X text 367 249 <= show analysis constants; 25 | #X text 216 207 <= try different frequencies \, then see what bins 26 | they show up in, f 86; 27 | #N canvas 600 60 609 371 init 0; 28 | #X obj 39 117 symbol \$0-frequency; 29 | #X obj 187 117 symbol \$0-metrotog; 30 | #X obj 39 45 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 31 | -1; 32 | #X obj 332 117 symbol \$0-channel; 33 | #X obj 39 70 t b b b; 34 | #X msg 39 233 \; \$1 440 \; \$2 1 \; \$3 5; 35 | #X obj 39 189 pack s s s; 36 | #X obj 39 9 loadbang; 37 | #X connect 0 0 6 0; 38 | #X connect 1 0 6 1; 39 | #X connect 2 0 4 0; 40 | #X connect 3 0 6 2; 41 | #X connect 4 0 0 0; 42 | #X connect 4 1 1 0; 43 | #X connect 4 2 3 0; 44 | #X connect 6 0 5 0; 45 | #X connect 7 0 2 0; 46 | #X restore 547 500 pd init; 47 | #X obj 207 281 lyonpotpourri/magfreq_analysis~ 8 2; 48 | #X obj 403 372 lyonpotpourri/channel~; 49 | #X obj 207 372 lyonpotpourri/channel~; 50 | #X msg 547 464 \; pd dsp \$1; 51 | #X obj 547 438 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 52 | 1; 53 | #X text 570 440 turn on DACs; 54 | #X connect 0 0 21 0; 55 | #X connect 1 0 22 0; 56 | #X connect 1 0 23 0; 57 | #X connect 2 0 1 0; 58 | #X connect 3 0 6 0; 59 | #X connect 4 0 3 0; 60 | #X connect 4 0 7 0; 61 | #X connect 5 0 4 0; 62 | #X connect 7 0 8 0; 63 | #X connect 9 0 0 0; 64 | #X connect 10 0 21 0; 65 | #X connect 21 0 23 0; 66 | #X connect 21 1 22 0; 67 | #X connect 22 0 7 0; 68 | #X connect 23 0 3 0; 69 | #X connect 25 0 24 0; 70 | -------------------------------------------------------------------------------- /fftease.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #ifdef PD 6 | # include 7 | #else 8 | # define t_float float 9 | #endif 10 | 11 | 12 | /* 13 | The new improved fftease.h 14 | */ 15 | 16 | #define getbytes t_getbytes 17 | #define freebytes t_freebytes 18 | #define resizebytes t_resizebytes 19 | 20 | #define FFTEASE_ANNOUNCEMENT "- a member of FFTease 2.52" 21 | 22 | #ifndef PI 23 | #define PI 3.141592653589793115997963468544185161590576171875 24 | #endif 25 | 26 | #ifndef TWOPI 27 | #define TWOPI 6.28318530717958623199592693708837032318115234375 28 | #endif 29 | 30 | #define MAX_N (1073741824) 31 | #define MAX_N2 (MAX_N/2) 32 | #define MAX_Nw (MAX_N * 4) 33 | 34 | void lpp_convert(t_float *S, t_float *C, int N2, t_float *lastphase, t_float fundamental, t_float factor ); 35 | void lpp_unconvert( t_float *C, t_float *S, int N2, t_float *lastphase, t_float fundamental, t_float factor ); 36 | void lpp_rfft( t_float *x, int N, int forward ); 37 | void lpp_cfft( t_float *x, int NC, int forward ); 38 | void lpp_bitreverse( t_float *x, int N ); 39 | void lpp_fold( t_float *I, t_float *W, int Nw, t_float *O, int N, int n ); 40 | void lpp_init_rdft(int n, int *ip, t_float *w); 41 | void lpp_rdft(int n, int isgn, t_float *a, int *ip, t_float *w); 42 | void lpp_bitrv2(int n, int *ip, t_float *a); 43 | void lpp_cftsub(int n, t_float *a, t_float *w); 44 | void lpp_rftsub(int n, t_float *a, int nc, t_float *c); 45 | void lpp_makewt(int nw, int *ip, t_float *w); 46 | void lpp_makect(int nc, int *ip, t_float *c); 47 | void lpp_leanconvert( t_float *S, t_float *C, int N2 ); 48 | void lpp_leanunconvert( t_float *C, t_float *S, int N2 ); 49 | void lpp_makewindows( t_float *H, t_float *A, t_float *S, int Nw, int N, int I ); 50 | void lpp_makehamming( t_float *H, t_float *A, t_float *S, int Nw, int N, int I,int odd ); 51 | void lpp_makehanning( t_float *H, t_float *A, t_float *S, int Nw, int N, int I,int odd ); 52 | void lpp_overlapadd( t_float *I, int N, t_float *W, t_float *O, int Nw, int n ); 53 | void lpp_bloscbank( t_float *S, t_float *O, int D, t_float iD, t_float *lf, t_float *la, 54 | t_float *bindex, t_float *tab, int len, t_float synt, int lo, int hi ); 55 | 56 | t_float lpp_randf( t_float min, t_float max ); 57 | int lpp_randi( int min, int max ); 58 | int lpp_power_of_two(int test); 59 | 60 | 61 | //void freebytes2(void *fatso, size_t nbytes); 62 | //void *getbytes2(size_t nbytes); 63 | //void *resizebytes2(void *old, size_t oldsize, size_t newsize); 64 | void lpp_limit_fftsize(int *N, int *Nw, char *OBJECT_NAME); 65 | 66 | /* THE FUNCTIONS */ 67 | -------------------------------------------------------------------------------- /windowvec~.c: -------------------------------------------------------------------------------- 1 | /* Required Header Files */ 2 | 3 | #include "MSPd.h" 4 | 5 | /* The class pointer */ 6 | 7 | static t_class *windowvec_class; 8 | 9 | /* The object structure */ 10 | 11 | typedef struct _windowvec { 12 | t_object obj; 13 | t_float x_f; 14 | t_float *envelope; 15 | long vecsize; 16 | long oldbytes; 17 | } t_windowvec; 18 | 19 | #define OBJECT_NAME "windowvec~" 20 | 21 | /* Function prototypes */ 22 | 23 | static void *windowvec_new(void); 24 | static void windowvec_dsp(t_windowvec *x, t_signal **sp, short *count); 25 | static t_int *windowvec_perform(t_int *w); 26 | 27 | /* The object setup function */ 28 | 29 | void windowvec_tilde_setup(void) 30 | { 31 | windowvec_class = class_new(gensym("windowvec~"), (t_newmethod)windowvec_new, 0, sizeof(t_windowvec), 0,0); 32 | CLASS_MAINSIGNALIN(windowvec_class, t_windowvec, x_f); 33 | class_addmethod(windowvec_class, (t_method)windowvec_dsp, gensym("dsp"), A_CANT, 0); 34 | potpourri_announce(OBJECT_NAME); 35 | } 36 | 37 | /* The new instance routine */ 38 | 39 | void *windowvec_new(void) 40 | { 41 | t_windowvec *x = (t_windowvec *)pd_new(windowvec_class); 42 | outlet_new(&x->obj, gensym("signal")); 43 | x->vecsize = 0; 44 | x->envelope = NULL; 45 | return x; 46 | } 47 | 48 | /* The free memory function*/ 49 | 50 | void windowvec_free(t_windowvec *x, t_signal **sp, short *count) 51 | { 52 | freebytes(x->envelope, x->oldbytes); 53 | } 54 | 55 | /* The perform routine */ 56 | 57 | t_int *windowvec_perform(t_int *w) 58 | { 59 | t_windowvec *x = (t_windowvec *) (w[1]); 60 | t_float *input = (t_float *) (w[2]); 61 | t_float *output = (t_float *) (w[3]); 62 | int n = (int) w[4]; 63 | int i; 64 | t_float *envelope = x->envelope; 65 | 66 | /* Apply a Hann window to the input vector */ 67 | 68 | for(i=0; i < n; i++) { 69 | output[i] = input[i] * envelope[i]; 70 | } 71 | return w + 5; 72 | } 73 | 74 | void windowvec_dsp(t_windowvec *x, t_signal **sp, short *count) 75 | { 76 | int i; 77 | t_float twopi = 8. * atan(1); 78 | if(x->vecsize != sp[0]->s_n) { 79 | x->vecsize = sp[0]->s_n; 80 | 81 | /* Allocate memory */ 82 | 83 | if(x->envelope == NULL) { 84 | x->envelope = (t_float *) getbytes(x->vecsize * sizeof(t_float)); 85 | } else { 86 | x->envelope = (t_float *) resizebytes(x->envelope, x->oldbytes, x->vecsize * sizeof(t_float)); 87 | } 88 | x->oldbytes = x->vecsize * sizeof(t_float); 89 | 90 | /* Generate a Hann window */ 91 | 92 | for(i = 0 ; i < x->vecsize; i++) { 93 | x->envelope[i] = - 0.5 * cos(twopi * (i / (t_float)x->vecsize)) + 0.5; 94 | } 95 | } 96 | dsp_add(windowvec_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, (t_int)sp[0]->s_n); 97 | } 98 | -------------------------------------------------------------------------------- /arrayfilt~.c: -------------------------------------------------------------------------------- 1 | #include "MSPd.h" 2 | 3 | static t_class *arrayfilt_class; 4 | 5 | #define OBJECT_NAME "arrayfilt~" 6 | typedef struct _arrayfilt 7 | { 8 | t_object x_obj; 9 | t_float x_f; 10 | t_word *a_samples; 11 | int a_frames; 12 | t_symbol *arrayname; 13 | } t_arrayfilt; 14 | 15 | static void *arrayfilt_new(t_symbol *msg, int argc, t_atom *argv); 16 | static void arrayfilt_dsp(t_arrayfilt *x, t_signal **sp); 17 | static void arrayfilt_setarray(t_arrayfilt *x); 18 | 19 | void arrayfilt_tilde_setup(void) { 20 | arrayfilt_class = class_new(gensym("arrayfilt~"), (t_newmethod)arrayfilt_new, 21 | 0, sizeof(t_arrayfilt),0,A_GIMME,0); 22 | CLASS_MAINSIGNALIN(arrayfilt_class, t_arrayfilt, x_f); 23 | class_addmethod(arrayfilt_class, (t_method)arrayfilt_dsp, gensym("dsp"), A_CANT, 0); 24 | potpourri_announce(OBJECT_NAME); 25 | } 26 | 27 | void *arrayfilt_new(t_symbol *msg, int argc, t_atom *argv) 28 | { 29 | t_arrayfilt *x = (t_arrayfilt *)pd_new(arrayfilt_class); 30 | // t_symbol *arrayname; 31 | inlet_new(&x->x_obj, &x->x_obj.ob_pd,gensym("signal"), gensym("signal")); 32 | outlet_new(&x->x_obj, gensym("signal")); 33 | outlet_new(&x->x_obj, gensym("signal")); 34 | x->arrayname = atom_getsymbolarg(0, argc, argv); 35 | arrayfilt_setarray(x); 36 | return x; 37 | } 38 | 39 | void arrayfilt_setarray(t_arrayfilt *x) 40 | { 41 | t_garray *a; 42 | t_symbol *arrayname = x->arrayname; 43 | if (!(a = (t_garray *)pd_findbyclass(arrayname, garray_class))) { 44 | if (*arrayname->s_name) pd_error(x, "arrayflt~: %s: no such array", arrayname->s_name); 45 | } 46 | else { 47 | garray_usedindsp(a); 48 | if (!garray_getfloatwords(a, &x->a_frames, &x->a_samples)) 49 | { 50 | pd_error(x, "%s: bad template for player~", arrayname->s_name); 51 | } 52 | } 53 | } 54 | 55 | t_int *arrayfilt_perform(t_int *w) 56 | { 57 | int i; 58 | t_arrayfilt *x = (t_arrayfilt *) w[1]; 59 | t_float *mag_in = (t_float *) w[2]; 60 | t_float *phase_in = (t_float *) w[3]; 61 | t_float *mag_out = (t_float *) w[4]; 62 | t_float *phase_out = (t_float *) w[5]; 63 | t_float mag, phase; 64 | t_word *a_samples = x->a_samples; 65 | int a_frames = x->a_frames; 66 | int n = (int) w[6]; 67 | int N2 = n / 2; 68 | 69 | arrayfilt_setarray(x); 70 | 71 | if(a_frames < N2+1) { 72 | goto exit; 73 | } 74 | for(i = 0; i < N2 + 1; i++) { 75 | mag = mag_in[i]; 76 | phase = phase_in[i]; 77 | mag_out[i] = mag * a_samples[i].w_float; 78 | phase_out[i] = phase; 79 | } 80 | exit: 81 | return (w + 7); 82 | } 83 | 84 | void arrayfilt_dsp(t_arrayfilt *x, t_signal **sp) 85 | { 86 | dsp_add(arrayfilt_perform,6, x, 87 | sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec, (t_int)sp[0]->s_n); 88 | } 89 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Makefile to build the 'lyonpotpourri' library for Pure Data. 2 | # Needs Makefile.pdlibbuilder as helper makefile for platform-dependent build 3 | # settings and rules. 4 | 5 | # library name 6 | lib.name = lyonpotpourri 7 | 8 | # sources for the objectclasses 9 | class.sources = \ 10 | adsr~.c \ 11 | buffet~.c \ 12 | bvplay~.c \ 13 | chameleon~.c \ 14 | channel~.c \ 15 | chopper~.c \ 16 | clean_selector~.c \ 17 | click~.c \ 18 | click2bang~.c \ 19 | click2float~.c \ 20 | clickhold~.c \ 21 | distortion~.c \ 22 | dmach~.c \ 23 | expflam~.c \ 24 | flanjah~.c \ 25 | function~.c \ 26 | granola~.c \ 27 | granulesf~.c \ 28 | granule~.c \ 29 | kbuffer~.c \ 30 | killdc~.c \ 31 | magfreq_analysis~.c \ 32 | markov~.c \ 33 | mask~.c \ 34 | oscil~.c \ 35 | phasemod~.c \ 36 | player~.c \ 37 | pulser~.c \ 38 | rtrig~.c \ 39 | samm~.c \ 40 | sigseq~.c \ 41 | vdb~.c \ 42 | vdp~.c \ 43 | waveshape~.c \ 44 | epluribus~.c \ 45 | dynss~.c \ 46 | counter~.c \ 47 | latch~.c \ 48 | sarec~.c \ 49 | convolver~.c \ 50 | npan~.c \ 51 | shoehorn~.c \ 52 | rotapan~.c \ 53 | sel~.c \ 54 | squash~.c \ 55 | windowvec~.c \ 56 | cartopol~.c \ 57 | poltocar~.c \ 58 | arrayfilt~.c \ 59 | splitspec~.c \ 60 | stutter~.c \ 61 | vecdex~.c \ 62 | quadpan~.c \ 63 | splitbank~.c \ 64 | $(empty) 65 | 66 | bashfest~.class.sources = \ 67 | bashfest~.c \ 68 | bashfest_dsp.c \ 69 | bashfest_helper.c \ 70 | ellipse.c \ 71 | $(empty) 72 | 73 | ## sources for the shared library 74 | # fft.c :?: convert.c convolver~.c leanunconvert.c splitbank~.c 75 | # fft4.c :?: buffet~.c convolver~.c magfreq_analysis~.c splitbank~.c 76 | # fold.c : buffet~.c magfreq_analysis~.c splitbank~.c !squash~.c 77 | # convert.c : buffet~.c magfreq_analysis~.c !splitbank~.c 78 | # makewindows.c : buffet~.c magfreq_analysis~.c splitbank~.c !squash~.c 79 | # power_of_two.c: magfreq_analysis~.c 80 | # from_msp.c: adsr~.c bashfest~.c buffet~.c counter~.c stutter~.c vdp~.c 81 | 82 | shared.sources = \ 83 | convert.c \ 84 | fft.c \ 85 | fft4.c \ 86 | fold.c \ 87 | makewindows.c \ 88 | power_of_two.c \ 89 | from_msp.c \ 90 | $(empty) 91 | 92 | unused_shared_sources = \ 93 | PenroseRand.c \ 94 | PenroseOscil.c \ 95 | bloscbank.c \ 96 | overlapadd.c \ 97 | leanconvert.c \ 98 | leanunconvert.c \ 99 | unconvert.c \ 100 | $(empty) 101 | 102 | # extra files 103 | datafiles = \ 104 | $(wildcard *.pd) \ 105 | CHANGELOG.txt \ 106 | LICENSE.txt \ 107 | README.txt \ 108 | sfplay~.pd \ 109 | lyonpotpourri-meta.pd \ 110 | $(empty) 111 | # extra dirs 112 | datadirs = sound \ 113 | $(empty) 114 | 115 | ############################################################################################## 116 | # include the actual build-system 117 | PDLIBBUILDER_DIR=pd-lib-builder 118 | include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder 119 | -------------------------------------------------------------------------------- /sigseq~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 540 602 12; 2 | #X obj 173 217 bng 30 550 50 0 empty empty empty 0 -6 0 8 -260679 -51584 3 | -1; 4 | #X obj 29 285 *~; 5 | #X obj 29 237 osc~; 6 | #N canvas 600 60 474 324 messages 0; 7 | #X obj 133 195 outlet; 8 | #N canvas 40 386 462 312 clock 0; 9 | #X obj 141 124 outlet; 10 | #X obj 45 212 send~ external_clock; 11 | #X msg 45 148 tempo \$1; 12 | #X floatatom 45 122 5 0 0 0 - - -; 13 | #X msg 141 98 external_clock \$1; 14 | #X obj 141 51 tgl 40 0 empty empty empty 0 -6 0 8 -4061 -1 -1 0 1; 15 | #X text 139 30 must toggle DACs before switch takes effect; 16 | #X obj 45 173 lyonpotpourri/samm~ 60 0.25; 17 | #X connect 2 0 7 0; 18 | #X connect 3 0 2 0; 19 | #X connect 4 0 0 0; 20 | #X connect 5 0 4 0; 21 | #X connect 7 0 1 0; 22 | #X restore 207 159 pd clock; 23 | #X obj 205 234 outlet~; 24 | #X obj 205 198 receive~ external_clock; 25 | #N canvas 0 23 474 324 other-controls 0; 26 | #X obj 28 244 outlet; 27 | #X msg 28 128 banggate \$1; 28 | #X obj 28 77 tgl 40 0 empty empty empty 0 -6 0 8 -4061 -1 -1 1 1; 29 | #X msg 163 204 adsrgate \$1; 30 | #X obj 163 157 tgl 40 0 empty empty empty 0 -6 0 8 -4061 -1 -1 0 1 31 | ; 32 | #X text 209 177 on by default \, zero turns off ADSR; 33 | #X text 70 90 open gate for outlet bang on sequence start; 34 | #X obj 28 21 loadbang; 35 | #X msg 28 45 1; 36 | #X connect 1 0 0 0; 37 | #X connect 2 0 1 0; 38 | #X connect 3 0 0 0; 39 | #X connect 4 0 3 0; 40 | #X connect 7 0 8 0; 41 | #X connect 8 0 2 0; 42 | #X restore 133 64 pd other-controls; 43 | #N canvas 600 60 673 475 sequences 0; 44 | #X obj 72 368 outlet; 45 | #X msg 196 213 440 469.333 605 660 704; 46 | #X msg 169 312 500 600 700 1300 888 340 3000 773 773; 47 | #X obj 223 270 loadbang; 48 | #X msg 72 109 rand \$1; 49 | #X obj 72 55 tgl 40 0 empty empty empty 0 -6 0 8 -4061 -1 -1 0 1; 50 | #X obj 125 152 tgl 40 0 empty empty empty 0 -6 0 8 -4061 -1 -1 0 1 51 | ; 52 | #X msg 125 206 retro \$1; 53 | #X text 169 157 play sequence in reverse; 54 | #X text 368 216 load a different sequence; 55 | #X text 131 73 randomize playback order of sequence; 56 | #X connect 1 0 0 0; 57 | #X connect 2 0 0 0; 58 | #X connect 3 0 2 0; 59 | #X connect 4 0 0 0; 60 | #X connect 5 0 4 0; 61 | #X connect 6 0 7 0; 62 | #X connect 7 0 0 0; 63 | #X restore 176 98 pd sequences; 64 | #X connect 1 0 0 0; 65 | #X connect 3 0 2 0; 66 | #X connect 4 0 0 0; 67 | #X connect 5 0 0 0; 68 | #X restore 29 158 pd messages; 69 | #X obj 29 188 lyonpotpourri/sigseq~; 70 | #X obj 29 365 lpp-meters; 71 | #X obj 21 17 lpp-icon sigseq~; 72 | #X text 120 163 <= controls here; 73 | #X text 66 288 output from second outlet is an ADSR envelope; 74 | #X text 212 223 indicate start of sequence; 75 | #X text 27 110 a simple sample-accurate sequencer with a synchronized 76 | adsr envelope., f 69; 77 | #X text 247 45 - sample-accurate number sequencer; 78 | #X connect 1 0 5 0; 79 | #X connect 1 0 5 1; 80 | #X connect 2 0 1 0; 81 | #X connect 3 0 4 0; 82 | #X connect 3 1 4 0; 83 | #X connect 4 0 2 0; 84 | #X connect 4 1 1 1; 85 | #X connect 4 2 0 0; 86 | -------------------------------------------------------------------------------- /adsr~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 623 641 12; 2 | #X msg 56 204 bang; 3 | #X obj 38 165 osc~ 400; 4 | #X obj 38 390 *~; 5 | #X msg 153 228 10 50 50 50; 6 | #X msg 160 253 100 50 100 500; 7 | #X obj 153 206 loadbang; 8 | #N canvas 600 60 673 325 individual-adsr-elements 0; 9 | #X obj 62 244 outlet; 10 | #X msg 62 158 set_a \$1; 11 | #X msg 135 159 set_d \$1; 12 | #X msg 210 158 set_s \$1; 13 | #X msg 283 159 set_r \$1; 14 | #X msg 353 159 set_gain1 \$1; 15 | #X msg 451 160 set_gain2 \$1; 16 | #X obj 353 110 vsl 15 30 0 1 0 0 empty empty empty 0 -8 0 8 -242048 17 | -1 -1 2900 1; 18 | #X obj 451 109 vsl 15 30 0 1 0 0 empty empty empty 0 -8 0 8 -242048 19 | -1 -1 2030 1; 20 | #X obj 62 106 vsl 15 30 1 100 0 0 empty empty empty 0 -8 0 8 -242048 21 | -1 -1 1435 1; 22 | #X obj 135 110 vsl 15 30 10 100 0 0 empty empty empty 0 -8 0 8 -242048 23 | -1 -1 1289 1; 24 | #X obj 210 107 vsl 15 30 50 500 0 0 empty empty empty 0 -8 0 8 -242048 25 | -1 -1 967 1; 26 | #X obj 283 109 vsl 15 30 50 1000 0 0 empty empty empty 0 -8 0 8 -242048 27 | -1 -1 458 1; 28 | #X msg 62 40 50 50 200 200 1 0.7; 29 | #X obj 62 64 unpack f f f f f f; 30 | #X obj 62 16 loadbang; 31 | #X connect 1 0 0 0; 32 | #X connect 2 0 0 0; 33 | #X connect 3 0 0 0; 34 | #X connect 4 0 0 0; 35 | #X connect 5 0 0 0; 36 | #X connect 6 0 0 0; 37 | #X connect 7 0 5 0; 38 | #X connect 8 0 6 0; 39 | #X connect 9 0 1 0; 40 | #X connect 10 0 2 0; 41 | #X connect 11 0 3 0; 42 | #X connect 12 0 4 0; 43 | #X connect 13 0 14 0; 44 | #X connect 14 0 9 0; 45 | #X connect 14 1 10 0; 46 | #X connect 14 2 11 0; 47 | #X connect 14 3 12 0; 48 | #X connect 14 4 7 0; 49 | #X connect 14 5 8 0; 50 | #X connect 15 0 13 0; 51 | #X restore 178 280 pd individual-adsr-elements; 52 | #X text 51 185 trigger ADSR; 53 | #X obj 29 9 lpp-icon adsr~; 54 | #X text 245 231 ADSR data as list; 55 | #X obj 38 416 lpp-meters; 56 | #X obj 56 365 lyonpotpourri/adsr~; 57 | #X text 266 252 softer envelope; 58 | #X text 247 40 - ADSR envelope triggered by signal clicks or bangs 59 | ; 60 | #N canvas 600 60 893 602 click-trigger 0; 61 | #X text 236 120 slow click metronome; 62 | #X obj 56 126 lyonpotpourri/samm~ 40 1; 63 | #X obj 56 184 *~; 64 | #X obj 56 257 outlet~; 65 | #X obj 112 84 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 66 | 1; 67 | #X text 135 81 gate sample-accurate metronome; 68 | #X obj 112 51 inlet; 69 | #X connect 1 0 2 0; 70 | #X connect 2 0 3 0; 71 | #X connect 4 0 2 1; 72 | #X connect 6 0 4 0; 73 | #X restore 271 328 pd click-trigger; 74 | #X obj 271 302 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 75 | 1; 76 | #X text 35 111 An ADSR envelope with the capability for sample-accurate 77 | timing.; 78 | #X text 256 464 see also:; 79 | #X obj 236 481 cnv 15 100 20 empty empty lyonpotpourri/samm~ 20 12 80 | 0 14 -262144 -1 0; 81 | #X connect 0 0 11 0; 82 | #X connect 1 0 2 0; 83 | #X connect 2 0 10 0; 84 | #X connect 2 0 10 1; 85 | #X connect 3 0 11 0; 86 | #X connect 4 0 11 0; 87 | #X connect 5 0 3 0; 88 | #X connect 6 0 11 0; 89 | #X connect 11 0 2 1; 90 | #X connect 14 0 11 0; 91 | #X connect 15 0 14 0; 92 | -------------------------------------------------------------------------------- /latch~.c: -------------------------------------------------------------------------------- 1 | #include "MSPd.h" 2 | 3 | static t_class *latch_class; 4 | 5 | #define OBJECT_NAME "latch~" 6 | #define LATCH_WAITING 0 7 | #define LATCH_RUNNING 1 8 | 9 | typedef struct _latch 10 | { 11 | t_object x_obj; 12 | t_float x_f; 13 | t_float current; 14 | long latch; 15 | long dsamps; 16 | long sr; 17 | t_float duration; 18 | long status; 19 | long connected; 20 | } t_latch; 21 | 22 | static void *latch_new(t_float duration); 23 | static t_int *latch_perform(t_int *w); 24 | static void latch_dsp(t_latch *x, t_signal **sp); 25 | 26 | void latch_tilde_setup(void) 27 | { 28 | latch_class = class_new(gensym("latch~"), (t_newmethod)latch_new, 0, sizeof(t_latch), 0,A_FLOAT, 0); 29 | CLASS_MAINSIGNALIN(latch_class, t_latch, x_f); 30 | class_addmethod(latch_class, (t_method)latch_dsp, gensym("dsp"), A_CANT, 0); 31 | potpourri_announce(OBJECT_NAME); 32 | } 33 | 34 | static void *latch_new(t_float duration) 35 | { 36 | 37 | t_latch *x = (t_latch *)pd_new(latch_class); 38 | inlet_new(&x->x_obj, &x->x_obj.ob_pd,gensym("signal"), gensym("signal")); 39 | outlet_new(&x->x_obj, gensym("signal")); 40 | 41 | x->status = LATCH_WAITING; 42 | x->duration = duration; 43 | x->sr = sys_getsr(); 44 | if(x->duration <= 1.0) 45 | x->duration = 1.0; 46 | x->duration *= 0.001; 47 | x->dsamps = x->sr ? x->sr * x->duration : 44100; 48 | 49 | return x; 50 | } 51 | 52 | static t_int *latch_perform(t_int *w) 53 | { 54 | t_latch *x = (t_latch *) (w[1]); 55 | t_float *trigger = (t_float *)(w[2]); 56 | t_float *vec_duration = (t_float *)(w[3]); 57 | t_float *output = (t_float *)(w[4]); 58 | int n = (int) w[5]; 59 | int next_pointer = 6; 60 | long latch = x->latch; 61 | long dsamps = x->dsamps; 62 | long status = x->status; 63 | t_float current = x->current; 64 | t_float duration = x->duration; 65 | long sr = x->sr; 66 | long connected = x->connected; 67 | int i = 0; 68 | 69 | 70 | 71 | for(i = 0; i < n; i++) { 72 | 73 | if(connected) { 74 | duration = vec_duration[i]; 75 | if( duration > 0.0 ){ // dummy proof 76 | dsamps = sr * duration * 0.001; 77 | } 78 | } 79 | 80 | if(trigger[i]) { 81 | latch = 0; 82 | status = LATCH_RUNNING; 83 | current = trigger[i]; 84 | } else { 85 | latch++; 86 | if(latch >= dsamps) { 87 | status = LATCH_WAITING; 88 | current = 0.0; 89 | } 90 | } 91 | output[i] = current; 92 | 93 | } 94 | 95 | 96 | x->current = current; 97 | x->status = status; 98 | x->latch = latch; 99 | x->dsamps = dsamps; 100 | return w + next_pointer; 101 | } 102 | 103 | static void latch_dsp(t_latch *x, t_signal **sp) 104 | { 105 | x->connected = 1; 106 | if(x->sr != sp[0]->s_sr) { 107 | x->sr = sp[0]->s_sr; 108 | x->dsamps = x->duration * x->sr; 109 | } 110 | dsp_add(latch_perform, 5, x, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, (t_int)sp[0]->s_n); 111 | } 112 | -------------------------------------------------------------------------------- /dynss~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 595 639 12; 2 | #X msg 96 288 devx \$1; 3 | #X obj 273 321 hsl 70 12 0 1 0 0 dynss-devx dynss-devx-in devx -2 -8 4 | 0 10 -261682 -1 -1 0 1; 5 | #X floatatom 96 264 5 0 0 0 - dynss-devx -; 6 | #X obj 273 346 hsl 70 12 0 1 0 0 dynss-devy dynss-devy-in devy -2 -8 7 | 0 10 -261682 -1 -1 0 1; 8 | #X floatatom 157 263 5 0 0 0 - dynss-devy -; 9 | #X msg 157 287 devy \$1; 10 | #X msg 37 287 freq \$1; 11 | #X obj 273 296 hsl 70 12 50 600 0 0 dynss-freq dynss-freq-in frequency 12 | -2 -8 0 10 -261682 -1 -1 0 1; 13 | #X floatatom 37 264 5 0 0 0 - dynss-freq -; 14 | #X obj 123 325 r dynss.messages; 15 | #X obj 36 352 lyonpotpourri/dynss~; 16 | #X obj 36 405 lpp-meters; 17 | #X obj 22 19 lpp-icon dynss~; 18 | #X text 247 45 - dynamic stochastic synthesis (after Xenakis); 19 | #N canvas 0 23 643 365 learn 0; 20 | #X obj 54 201 pdcontrol; 21 | #X msg 54 139 browse https://www.gold.ac.uk/media/documents-by-section/departments/music/09.2-Sergio-Luque.pdf 22 | ; 23 | #X obj 54 96 inlet; 24 | #X connect 1 0 0 0; 25 | #X connect 2 0 1 0; 26 | #X restore 186 516 pd learn; 27 | #X obj 186 486 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 28 | -1 -1; 29 | #X text 18 110 dynss~ - dynamic stochastic synthesis as described by 30 | Iannis Xenakis in "Formalized Music." A waveform is generated by linearly 31 | connecting breakpoints randomly generated respecting amplitude (y) 32 | and distance between points (x). The dynamic aspect results from deviating 33 | the random points on each iteration of the waveform \, with the amount 34 | of deviation in both directions subject to parametric control. In this 35 | model \, the frequency stays constant \, but the timbre varies constantly 36 | \, and usually noisily.; 37 | #X text 207 483 <= learn more about dynamic stochastic synthesis here 38 | ; 39 | #X text 340 448 <= more info here; 40 | #N canvas 444 109 686 335 waveform-settings 0; 41 | #X msg 135 112 new_wave; 42 | #X msg 162 149 new_amps; 43 | #X msg 239 183 printwave; 44 | #X obj 107 225 s dynss.messages; 45 | #X msg 107 73 pointcount \$1; 46 | #X msg 107 36 4; 47 | #X msg 147 38 15; 48 | #X text 309 184 print the breakpoints to the Pd window; 49 | #X text 201 113 generate a new waveform; 50 | #X text 228 150 generate new amplitudes \, but keep the y-values; 51 | #X msg 189 39 30; 52 | #X text 214 74 set the number of breakpoints in the waveform. More 53 | breakpoints usually results in a brighter spectrum; 54 | #X msg 109 292 \; dynss-devx-in bang \; dynss-devy-in bang; 55 | #X text 104 259 The waveform will be static after generation. To restore 56 | the deviation settings \, click below:; 57 | #X connect 0 0 3 0; 58 | #X connect 1 0 3 0; 59 | #X connect 2 0 3 0; 60 | #X connect 4 0 3 0; 61 | #X connect 5 0 4 0; 62 | #X connect 6 0 4 0; 63 | #X connect 10 0 4 0; 64 | #X restore 186 448 pd waveform-settings; 65 | #X connect 0 0 10 0; 66 | #X connect 2 0 0 0; 67 | #X connect 4 0 5 0; 68 | #X connect 5 0 10 0; 69 | #X connect 6 0 10 0; 70 | #X connect 8 0 6 0; 71 | #X connect 9 0 10 0; 72 | #X connect 10 0 11 0; 73 | #X connect 10 0 11 1; 74 | #X connect 15 0 14 0; 75 | -------------------------------------------------------------------------------- /killdc~.c: -------------------------------------------------------------------------------- 1 | #include "MSPd.h" 2 | 3 | #define OBJECT_NAME "killdc~" 4 | #define FUNC_LEN (512) 5 | #define MAXSECTS 20 6 | 7 | static t_class *killdc_class; 8 | 9 | typedef struct { 10 | t_float ps[4][MAXSECTS]; 11 | t_float c[4][MAXSECTS]; 12 | int nsects ; 13 | t_float xnorm; 14 | } COEFS ; 15 | 16 | typedef struct _killdc 17 | { 18 | t_object x_obj; 19 | t_float x_f; 20 | 21 | COEFS fdata; 22 | } t_killdc; 23 | 24 | static void *killdc_new(t_symbol *s); 25 | static t_int *offset_perform(t_int *w); 26 | static t_int *killdc_perform(t_int *w); 27 | static void killdc_dsp(t_killdc *x, t_signal **sp); 28 | 29 | 30 | 31 | void killdc_tilde_setup(void) 32 | { 33 | killdc_class = class_new(gensym("killdc~"),(t_newmethod)killdc_new,0, 34 | sizeof(t_killdc), 0, A_DEFSYMBOL,0); 35 | CLASS_MAINSIGNALIN(killdc_class,t_killdc, x_f ); 36 | class_addmethod(killdc_class,(t_method)killdc_dsp,gensym("dsp"),A_CANT,0); 37 | potpourri_announce(OBJECT_NAME); 38 | 39 | } 40 | 41 | void *killdc_new(t_symbol *s) 42 | { 43 | int i, j; 44 | 45 | t_killdc *x = (t_killdc *)pd_new(killdc_class); 46 | outlet_new(&x->x_obj, gensym("signal")); 47 | 48 | /**************/ 49 | 50 | 51 | x->fdata.nsects = 3; 52 | x->fdata.c[0][0] = -1.9999995 ; 53 | x->fdata.c[1][0] = -1.9997407 ; 54 | x->fdata.c[2][0] = 1.0000000 ; 55 | x->fdata.c[3][0] = 0.99974253 ; 56 | x->fdata.c[0][1] = -1.9999997 ; 57 | x->fdata.c[1][1] = -1.9988353 ; 58 | x->fdata.c[2][1] = 1.0000000 ; 59 | x->fdata.c[3][1] = 0.99883796 ; 60 | x->fdata.c[0][2] = -2.0000000 ; 61 | x->fdata.c[1][2] = -1.9959218 ; 62 | x->fdata.c[2][2] = 1.0000000 ; 63 | x->fdata.c[3][2] = 0.99592773 ; 64 | 65 | for(i=0; i< x->fdata.nsects; i++) { 66 | for(j=0;j<4;j++) { 67 | x->fdata.ps[j][i] = 0.0; 68 | } 69 | } 70 | 71 | x->fdata.xnorm = 0.99725327e+00 ; 72 | 73 | 74 | 75 | 76 | // INITIALIZATIONS 77 | 78 | 79 | return (x); 80 | } 81 | // method from Paul Lansky's cmix implementation 82 | t_int *killdc_perform(t_int *w) 83 | { 84 | t_float *in1,*out; 85 | t_float sample ; 86 | int n; 87 | int m; 88 | t_float op; 89 | // int lcount = 0; 90 | /********/ 91 | t_killdc *x = (t_killdc *) (w[1]); 92 | in1 = (t_float *)(w[2]); 93 | out = (t_float *)(w[3]); 94 | n = (int)(w[4]); 95 | 96 | while (n--) { 97 | sample = *in1++; 98 | for(m=0; m< x->fdata.nsects;m++) { 99 | op = sample + x->fdata.c[0][m] * x->fdata.ps[0][m] + 100 | x->fdata.c[2][m] * x->fdata.ps[1][m] 101 | - x->fdata.c[1][m] * x->fdata.ps[2][m] 102 | - x->fdata.c[3][m] * x->fdata.ps[3][m]; 103 | 104 | x->fdata.ps[1][m] = x->fdata.ps[0][m]; 105 | x->fdata.ps[0][m] = sample; 106 | x->fdata.ps[3][m] = x->fdata.ps[2][m]; 107 | x->fdata.ps[2][m] = op; 108 | sample = op; 109 | } 110 | *out++ = sample * x->fdata.xnorm ; 111 | } 112 | return (w+5); 113 | } 114 | 115 | void killdc_dsp(t_killdc *x, t_signal **sp) 116 | { 117 | dsp_add(killdc_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, (t_int)sp[0]->s_n); 118 | } 119 | -------------------------------------------------------------------------------- /squash~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 585 609 12; 2 | #N canvas 565 63 450 300 taps 0; 3 | #X obj 43 111 noise~; 4 | #X obj 118 79 metro 1000; 5 | #X msg 118 56 1; 6 | #X obj 118 33 loadbang; 7 | #X obj 168 201 line~; 8 | #X obj 63 226 *~; 9 | #X obj 63 260 outlet~; 10 | #X msg 118 155 1; 11 | #X msg 209 176 0.05 50; 12 | #X msg 271 176 0.01 900; 13 | #X msg 340 177 0 50; 14 | #X obj 209 149 delay 1; 15 | #X obj 271 149 delay 50; 16 | #X obj 339 149 delay 900; 17 | #X connect 0 0 5 0; 18 | #X connect 1 0 7 0; 19 | #X connect 1 0 11 0; 20 | #X connect 2 0 1 0; 21 | #X connect 3 0 2 0; 22 | #X connect 4 0 5 1; 23 | #X connect 5 0 6 0; 24 | #X connect 7 0 4 0; 25 | #X connect 8 0 4 0; 26 | #X connect 9 0 4 0; 27 | #X connect 10 0 4 0; 28 | #X connect 11 0 8 0; 29 | #X connect 11 0 12 0; 30 | #X connect 12 0 9 0; 31 | #X connect 12 0 13 0; 32 | #X connect 13 0 10 0; 33 | #X restore 28 253 pd taps; 34 | #X obj 57 279 r squash.messages; 35 | #X obj 28 312 lyonpotpourri/squash~; 36 | #X obj 28 369 lpp-meters; 37 | #X obj 22 24 lpp-icon squash~; 38 | #X text 24 132 [squash~] is based on a compression algorithm by Christopher 39 | Penrose. It can be useful for extreme effects \, and is notable for 40 | employing the overlap-add system found in FFTease externals \, though 41 | all processing is done in the time domain here. This processor is capable 42 | of generating extreme amplitude ranges. Use with caution \, with a 43 | low playback gain \, and do not use this external in performance until 44 | you are very familiar with its operation., f 77; 45 | #N canvas 600 60 450 300 init 0; 46 | #X obj 54 114 symbol \$0-ratio; 47 | #X msg 54 172 \; \$1 0.75 \; \$2 0.4; 48 | #X obj 166 114 symbol \$0-threshold; 49 | #X obj 54 143 pack s s; 50 | #X obj 54 85 t b b; 51 | #X obj 54 27 loadbang; 52 | #X obj 54 56 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 53 | -1; 54 | #X connect 0 0 3 0; 55 | #X connect 2 0 3 1; 56 | #X connect 3 0 1 0; 57 | #X connect 4 0 0 0; 58 | #X connect 4 1 2 0; 59 | #X connect 5 0 6 0; 60 | #X connect 6 0 4 0; 61 | #X restore 210 504 pd init; 62 | #N canvas 741 67 528 412 controls 0; 63 | #X obj 31 139 s squash.messages; 64 | #X msg 31 115 ratio \$1; 65 | #X obj 34 71 hsl 128 15 0.5 1 0 0 empty \$0-ratio ratio -2 -8 0 10 66 | -204786 -1 -1 6350 1; 67 | #X floatatom 31 95 5 0.5 1.5 0 - - -; 68 | #X obj 29 243 s squash.messages; 69 | #X obj 32 175 hsl 128 15 0 0.001 0 0 empty empty noise_threshold -2 70 | -8 0 10 -204786 -1 -1 0 1; 71 | #X floatatom 29 199 7 0 0 0 - - -; 72 | #X msg 29 219 nt \$1; 73 | #X text 171 174 set noise floor; 74 | #X obj 28 356 s squash.messages; 75 | #X obj 31 288 hsl 128 15 0 1 0 0 empty \$0-threshold compression_threshold 76 | -2 -8 0 10 -204786 -1 -1 5080 1; 77 | #X floatatom 28 312 7 0 0 0 - - -; 78 | #X msg 28 332 thresh \$1; 79 | #X text 170 287 set compression threshold; 80 | #X text 29 18 lower ratio values give higher compression \, values 81 | greater than 1 result in expansion. (warning - low values can make 82 | output VERY loud., f 71; 83 | #X connect 1 0 0 0; 84 | #X connect 2 0 3 0; 85 | #X connect 3 0 1 0; 86 | #X connect 5 0 6 0; 87 | #X connect 6 0 7 0; 88 | #X connect 7 0 4 0; 89 | #X connect 10 0 11 0; 90 | #X connect 11 0 12 0; 91 | #X connect 12 0 9 0; 92 | #X restore 210 474 pd controls; 93 | #X text 247 48 - an extreme compressor; 94 | #X connect 0 0 2 0; 95 | #X connect 1 0 2 0; 96 | #X connect 2 0 3 0; 97 | #X connect 2 0 3 1; 98 | -------------------------------------------------------------------------------- /makewindows.c: -------------------------------------------------------------------------------- 1 | #include "fftease.h" 2 | 3 | void lpp_makewindows( t_float *H, t_float *A, t_float *S, int Nw, int N, int I ) 4 | 5 | { 6 | int i ; 7 | t_float sum ; 8 | 9 | for ( i = 0 ; i < Nw ; i++ ) 10 | H[i] = A[i] = S[i] = 0.54 - 0.46*cos( TWOPI*i/(Nw - 1) ) ; 11 | 12 | if ( Nw > N ) { 13 | t_float x ; 14 | 15 | x = -(Nw - 1)/2. ; 16 | for ( i = 0 ; i < Nw ; i++, x += 1. ) 17 | if ( x != 0. ) { 18 | A[i] *= N*sin( PI*x/N )/(PI*x) ; 19 | if ( I ) 20 | S[i] *= I*sin( PI*x/I )/(PI*x) ; 21 | } 22 | } 23 | 24 | for ( sum = i = 0 ; i < Nw ; i++ ) 25 | sum += A[i] ; 26 | 27 | for ( i = 0 ; i < Nw ; i++ ) { 28 | t_float afac = 2./sum ; 29 | t_float sfac = Nw > N ? 1./afac : afac ; 30 | A[i] *= afac ; 31 | S[i] *= sfac ; 32 | } 33 | 34 | if ( Nw <= N && I ) { 35 | for ( sum = i = 0 ; i < Nw ; i += I ) 36 | sum += S[i]*S[i] ; 37 | for ( sum = 1./sum, i = 0 ; i < Nw ; i++ ) 38 | S[i] *= sum ; 39 | } 40 | } 41 | 42 | void lpp_makehamming( t_float *H, t_float *A, t_float *S, int Nw, int N, int I, int odd ) 43 | 44 | { 45 | int i; 46 | t_float sum ; 47 | 48 | 49 | 50 | if (odd) { 51 | for ( i = 0 ; i < Nw ; i++ ) 52 | H[i] = A[i] = S[i] = sqrt(0.54 - 0.46*cos( TWOPI*i/(Nw - 1) )); 53 | } 54 | 55 | else { 56 | 57 | for ( i = 0 ; i < Nw ; i++ ) 58 | H[i] = A[i] = S[i] = 0.54 - 0.46*cos( TWOPI*i/(Nw - 1) ); 59 | 60 | } 61 | 62 | if ( Nw > N ) { 63 | t_float x ; 64 | 65 | x = -(Nw - 1)/2. ; 66 | for ( i = 0 ; i < Nw ; i++, x += 1. ) 67 | if ( x != 0. ) { 68 | A[i] *= N*sin( PI*x/N )/(PI*x) ; 69 | if ( I ) 70 | S[i] *= I*sin( PI*x/I )/(PI*x) ; 71 | } 72 | } 73 | for ( sum = i = 0 ; i < Nw ; i++ ) 74 | sum += A[i] ; 75 | 76 | for ( i = 0 ; i < Nw ; i++ ) { 77 | t_float afac = 2./sum ; 78 | t_float sfac = Nw > N ? 1./afac : afac ; 79 | A[i] *= afac ; 80 | S[i] *= sfac ; 81 | } 82 | 83 | if ( Nw <= N && I ) { 84 | for ( sum = i = 0 ; i < Nw ; i += I ) 85 | sum += S[i]*S[i] ; 86 | for ( sum = 1./sum, i = 0 ; i < Nw ; i++ ) 87 | S[i] *= sum ; 88 | } 89 | } 90 | 91 | 92 | void lpp_makehanning( t_float *H, t_float *A, t_float *S, int Nw, int N, int I, int odd ) 93 | { 94 | int i; 95 | t_float sum ; 96 | 97 | 98 | if (odd) { 99 | for ( i = 0 ; i < Nw ; i++ ) 100 | H[i] = A[i] = S[i] = sqrt(0.5 * (1. + cos(PI + TWOPI * i / (Nw - 1)))); 101 | } 102 | 103 | else { 104 | 105 | for ( i = 0 ; i < Nw ; i++ ) 106 | H[i] = A[i] = S[i] = 0.5 * (1. + cos(PI + TWOPI * i / (Nw - 1))); 107 | 108 | } 109 | 110 | if ( Nw > N ) { 111 | t_float x ; 112 | 113 | x = -(Nw - 1)/2. ; 114 | for ( i = 0 ; i < Nw ; i++, x += 1. ) 115 | if ( x != 0. ) { 116 | A[i] *= N*sin( PI*x/N )/(PI*x) ; 117 | if ( I ) 118 | S[i] *= I*sin( PI*x/I )/(PI*x) ; 119 | } 120 | } 121 | for ( sum = i = 0 ; i < Nw ; i++ ) 122 | sum += A[i] ; 123 | 124 | for ( i = 0 ; i < Nw ; i++ ) { 125 | t_float afac = 2./sum ; 126 | t_float sfac = Nw > N ? 1./afac : afac ; 127 | A[i] *= afac ; 128 | S[i] *= sfac ; 129 | } 130 | 131 | if ( Nw <= N && I ) { 132 | for ( sum = i = 0 ; i < Nw ; i += I ) 133 | sum += S[i]*S[i] ; 134 | for ( sum = 1./sum, i = 0 ; i < Nw ; i++ ) 135 | S[i] *= sum ; 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /counter~.c: -------------------------------------------------------------------------------- 1 | #include "MSPd.h" 2 | 3 | static t_class *counter_class; 4 | 5 | #define OBJECT_NAME "counter~" 6 | 7 | #define COUNTER_UP (1) 8 | #define COUNTER_DOWN (-1) 9 | 10 | typedef struct _counter 11 | { 12 | t_object x_obj; 13 | t_float x_f; 14 | long current; 15 | long min; 16 | long max; 17 | short direction; 18 | } t_counter; 19 | 20 | static void *counter_new(t_symbol *s, int argc, t_atom *argv); 21 | static t_int *counter_perform(t_int *w); 22 | static void counter_dsp(t_counter *x, t_signal **sp); 23 | static void counter_setnext(t_counter *x, t_floatarg val); 24 | static void counter_direction(t_counter *x, t_floatarg d); 25 | static void counter_minmax(t_counter *x, t_floatarg min, t_floatarg max); 26 | static void counter_version(t_counter *x); 27 | 28 | void counter_tilde_setup(void) 29 | { 30 | t_class *c; 31 | c = class_new(gensym("counter~"), (t_newmethod)counter_new,0,sizeof(t_counter), 0,A_GIMME,0); 32 | CLASS_MAINSIGNALIN(c, t_counter, x_f); 33 | class_addmethod(c, (t_method)counter_minmax,gensym("minmax"),A_FLOAT,A_FLOAT,0); 34 | class_addmethod(c, (t_method)counter_direction,gensym("direction"),A_FLOAT,0); 35 | class_addmethod(c, (t_method)counter_setnext,gensym("setnext"),A_FLOAT,0); 36 | class_addmethod(c, (t_method)counter_dsp, gensym("dsp"), A_CANT, 0); 37 | counter_class = c; 38 | potpourri_announce(OBJECT_NAME); 39 | } 40 | 41 | void counter_setnext(t_counter *x, t_floatarg val) 42 | { 43 | if( val < x->min || val > x->max) 44 | return; 45 | x->current = (long) val; 46 | } 47 | 48 | void counter_direction(t_counter *x, t_floatarg d) 49 | { 50 | if( (d != COUNTER_UP) && (d != COUNTER_DOWN) ) 51 | return; 52 | x->direction = (short) d; 53 | } 54 | 55 | void counter_minmax(t_counter *x, t_floatarg min, t_floatarg max) 56 | { 57 | if(min < 1) { 58 | return; 59 | } 60 | if(min >= max) { 61 | return; 62 | } 63 | x->min = min; 64 | x->max = max; 65 | } 66 | 67 | void *counter_new(t_symbol *s, int argc, t_atom *argv) 68 | { 69 | t_float farg; 70 | t_counter *x = (t_counter *)pd_new(counter_class); 71 | (void)s; 72 | outlet_new(&x->x_obj, gensym("signal")); 73 | x->direction = COUNTER_UP; 74 | farg = 1.0; 75 | atom_arg_getfloat(&farg,0,argc,argv); 76 | x->min = farg; 77 | farg = 10.0; 78 | atom_arg_getfloat(&farg,1,argc,argv); 79 | x->max = farg; 80 | if(x->min <= 1) 81 | x->min = 1; 82 | if(x->max <= x->min) 83 | x->max = 10; 84 | 85 | return x; 86 | } 87 | 88 | t_int *counter_perform(t_int *w) 89 | { 90 | t_counter *x = (t_counter *) (w[1]); 91 | t_float *in_vec = (t_float *)(w[2]); 92 | t_float *out_vec = (t_float *)(w[3]); 93 | int n = (int) w[4]; 94 | 95 | int i; 96 | long min = x->min; 97 | long max = x->max; 98 | long current = x->current; 99 | short direction = x->direction; 100 | 101 | for(i = 0; i < n; i++) { 102 | if(in_vec[i]) { 103 | out_vec[i] = current; 104 | current = current + direction; 105 | if( direction == COUNTER_UP ) { 106 | if( current > max ) { 107 | current = min; 108 | } 109 | } else if( direction == COUNTER_DOWN ) { 110 | if( current < min ) { 111 | current = max; 112 | } 113 | } 114 | } else { 115 | out_vec[i] = 0.0; 116 | } 117 | } 118 | 119 | x->current = current; 120 | return w + 5; 121 | } 122 | 123 | void counter_dsp(t_counter *x, t_signal **sp) 124 | { 125 | dsp_add(counter_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); 126 | } 127 | -------------------------------------------------------------------------------- /npan~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 472 54 747 552 12; 2 | #X obj 169 162 phasor~ 0.2; 3 | #X obj 25 162 noise~; 4 | #X obj 26 359 vu 15 120 empty empty -1 -8 0 10 -66577 -1 1 0; 5 | #N canvas 0 22 450 300 meter 0; 6 | #X obj 110 164 snapshot~; 7 | #X obj 126 114 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 8 | 1; 9 | #X floatatom 110 187 5 0 0 0 - - -; 10 | #X obj 110 91 env~ 1024; 11 | #X obj 126 140 metro 100; 12 | #X obj 109 211 - 100; 13 | #X obj 231 46 loadbang; 14 | #X msg 231 71 1; 15 | #X obj 109 246 outlet; 16 | #X obj 110 51 inlet~; 17 | #X connect 0 0 2 0; 18 | #X connect 1 0 4 0; 19 | #X connect 2 0 5 0; 20 | #X connect 3 0 0 0; 21 | #X connect 4 0 0 0; 22 | #X connect 5 0 8 0; 23 | #X connect 6 0 7 0; 24 | #X connect 7 0 1 0; 25 | #X connect 9 0 3 0; 26 | #X restore 25 316 pd meter; 27 | #X obj 90 359 vu 15 120 empty empty -1 -8 0 10 -66577 -1 1 0; 28 | #N canvas 0 22 450 300 meter 0; 29 | #X obj 110 164 snapshot~; 30 | #X obj 126 114 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 31 | 1; 32 | #X floatatom 110 187 5 0 0 0 - - -; 33 | #X obj 110 91 env~ 1024; 34 | #X obj 126 140 metro 100; 35 | #X obj 109 211 - 100; 36 | #X obj 231 46 loadbang; 37 | #X msg 231 71 1; 38 | #X obj 109 246 outlet; 39 | #X obj 110 51 inlet~; 40 | #X connect 0 0 2 0; 41 | #X connect 1 0 4 0; 42 | #X connect 2 0 5 0; 43 | #X connect 3 0 0 0; 44 | #X connect 4 0 0 0; 45 | #X connect 5 0 8 0; 46 | #X connect 6 0 7 0; 47 | #X connect 7 0 1 0; 48 | #X connect 9 0 3 0; 49 | #X restore 89 316 pd meter; 50 | #X obj 155 359 vu 15 120 empty empty -1 -8 0 10 -66577 -1 1 0; 51 | #N canvas 0 22 450 300 meter 0; 52 | #X obj 110 164 snapshot~; 53 | #X obj 126 114 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 54 | 1; 55 | #X floatatom 110 187 5 0 0 0 - - -; 56 | #X obj 110 91 env~ 1024; 57 | #X obj 126 140 metro 100; 58 | #X obj 109 211 - 100; 59 | #X obj 231 46 loadbang; 60 | #X msg 231 71 1; 61 | #X obj 109 246 outlet; 62 | #X obj 110 51 inlet~; 63 | #X connect 0 0 2 0; 64 | #X connect 1 0 4 0; 65 | #X connect 2 0 5 0; 66 | #X connect 3 0 0 0; 67 | #X connect 4 0 0 0; 68 | #X connect 5 0 8 0; 69 | #X connect 6 0 7 0; 70 | #X connect 7 0 1 0; 71 | #X connect 9 0 3 0; 72 | #X restore 154 316 pd meter; 73 | #X obj 221 359 vu 15 120 empty empty -1 -8 0 10 -66577 -1 1 0; 74 | #N canvas 0 23 450 300 meter 0; 75 | #X obj 110 164 snapshot~; 76 | #X obj 126 114 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 77 | 1; 78 | #X floatatom 110 187 5 0 0 0 - - -; 79 | #X obj 110 91 env~ 1024; 80 | #X obj 126 140 metro 100; 81 | #X obj 109 211 - 100; 82 | #X obj 231 46 loadbang; 83 | #X msg 231 71 1; 84 | #X obj 109 246 outlet; 85 | #X obj 110 51 inlet~; 86 | #X connect 0 0 2 0; 87 | #X connect 1 0 4 0; 88 | #X connect 2 0 5 0; 89 | #X connect 3 0 0 0; 90 | #X connect 4 0 0 0; 91 | #X connect 5 0 8 0; 92 | #X connect 6 0 7 0; 93 | #X connect 7 0 1 0; 94 | #X connect 9 0 3 0; 95 | #X restore 220 316 pd meter; 96 | #X text 197 215 arg: number of outlets; 97 | #X obj 27 19 lpp-icon npan~; 98 | #X msg 329 435 \; pd dsp \$1; 99 | #X obj 329 397 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 100 | 1; 101 | #X text 349 398 turn on DACs; 102 | #X text 252 44 - perimeter panning for an arbitrary number of channel 103 | outputs, f 69; 104 | #X text 27 110 Left inlet is signal to pan. Right inlet (ranging from 105 | 0-1) determines perimeter pan location.; 106 | #X obj 25 218 lyonpotpourri/npan~ 4; 107 | #X connect 0 0 17 1; 108 | #X connect 1 0 17 0; 109 | #X connect 3 0 2 0; 110 | #X connect 5 0 4 0; 111 | #X connect 7 0 6 0; 112 | #X connect 9 0 8 0; 113 | #X connect 13 0 12 0; 114 | #X connect 17 0 3 0; 115 | #X connect 17 1 5 0; 116 | #X connect 17 2 7 0; 117 | #X connect 17 3 9 0; 118 | -------------------------------------------------------------------------------- /markov~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 617 549 12; 2 | #X obj 159 265 phasor~; 3 | #X obj 159 295 lop~ 3000; 4 | #N canvas 447 119 831 684 bach 0; 5 | #X obj 153 44 inlet; 6 | #X obj 135 415 outlet; 7 | #X obj 153 73 t b b; 8 | #X msg 183 107 set_length 9; 9 | #X obj 15 107 t b b b b b b b b b b; 10 | #X msg 15 360 values 261.626 293.665 329.628 391.995 440 523.251 587.33 11 | 659.255 698.456; 12 | #X text 11 340 the notes in first 2 bars of JS Bach WTC 1 no. 1 prelude 13 | ; 14 | #X msg 280 152 event_odds 0 0 1 1 0 0 0 0 0 0; 15 | #X msg 280 172 event_odds 1 0 0 0 0 1 0 0 0 0; 16 | #X msg 280 192 event_odds 2 0 0 0 1 0 0 0 0 0; 17 | #X msg 280 212 event_odds 3 0 0 0 0 0 1 0 0 0; 18 | #X msg 280 232 event_odds 4 0 0 0 0 0 0 1 0 0; 19 | #X msg 280 254 event_odds 5 0 0 0 0 0 0 0 1 0; 20 | #X msg 280 276 event_odds 6 0 0 0 0 0 0 0 0 1; 21 | #X msg 281 297 event_odds 7 1 0 0 1 0 0 0 0 0; 22 | #X msg 281 317 event_odds 8 1 0 0 0 1 0 0 0 0; 23 | #X text 189 398 If you do not know about transition matrices please 24 | see Xenakis's Formalized Music or whatever Web info you can find on 25 | first order Markov chains.; 26 | #X connect 0 0 2 0; 27 | #X connect 2 0 4 0; 28 | #X connect 2 1 3 0; 29 | #X connect 3 0 1 0; 30 | #X connect 4 0 5 0; 31 | #X connect 4 1 15 0; 32 | #X connect 4 2 14 0; 33 | #X connect 4 3 13 0; 34 | #X connect 4 4 12 0; 35 | #X connect 4 5 11 0; 36 | #X connect 4 6 10 0; 37 | #X connect 4 7 9 0; 38 | #X connect 4 8 8 0; 39 | #X connect 4 9 7 0; 40 | #X connect 5 0 1 0; 41 | #X connect 7 0 1 0; 42 | #X connect 8 0 1 0; 43 | #X connect 9 0 1 0; 44 | #X connect 10 0 1 0; 45 | #X connect 11 0 1 0; 46 | #X connect 12 0 1 0; 47 | #X connect 13 0 1 0; 48 | #X connect 14 0 1 0; 49 | #X connect 15 0 1 0; 50 | #X restore 159 187 pd bach; 51 | #X obj 159 162 loadbang; 52 | #N canvas 0 23 458 308 tempo-control 0; 53 | #X obj 138 45 loadbang; 54 | #X msg 138 69 120 4; 55 | #X obj 138 101 unpack f f; 56 | #X floatatom 138 127 5 0 0 0 - - -; 57 | #X floatatom 205 130 5 0 0 0 - - -; 58 | #X msg 138 157 tempo \$1; 59 | #X msg 205 157 subdiv \$1; 60 | #X obj 138 207 outlet; 61 | #X connect 0 0 1 0; 62 | #X connect 1 0 2 0; 63 | #X connect 2 0 3 0; 64 | #X connect 2 1 4 0; 65 | #X connect 3 0 5 0; 66 | #X connect 4 0 6 0; 67 | #X connect 5 0 7 0; 68 | #X connect 6 0 7 0; 69 | #X restore 27 132 pd tempo-control; 70 | #X obj 132 162 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 71 | -1; 72 | #X obj 344 278 snapshot~; 73 | #X floatatom 344 299 5 0 0 0 - - -; 74 | #X obj 344 234 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 75 | 1; 76 | #X obj 344 255 metro 50; 77 | #N canvas 0 23 646 348 override 0; 78 | #X obj 36 125 outlet; 79 | #X msg 36 74 manual_override \$1; 80 | #X obj 36 41 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 81 | ; 82 | #X obj 238 89 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 83 | -1; 84 | #X text 62 44 turn off internal clock; 85 | #X text 259 89 manually trigger the next event; 86 | #X connect 1 0 0 0; 87 | #X connect 2 0 1 0; 88 | #X connect 3 0 0 0; 89 | #X restore 23 203 pd override; 90 | #X text 218 184 is there a pdq external?; 91 | #X obj 159 333 lpp-meters; 92 | #X obj 9 5 lpp-icon markov~; 93 | #X text 228 30 - 1st order Markov chains for basic melodic coherence 94 | , f 67; 95 | #X text 376 222 see phase of each individual note (useful for post 96 | processing), f 35; 97 | #X obj 159 231 lyonpotpourri/markov~ 10; 98 | #X connect 0 0 1 0; 99 | #X connect 1 0 12 0; 100 | #X connect 1 0 12 1; 101 | #X connect 2 0 16 0; 102 | #X connect 3 0 2 0; 103 | #X connect 4 0 16 0; 104 | #X connect 5 0 2 0; 105 | #X connect 6 0 7 0; 106 | #X connect 8 0 9 0; 107 | #X connect 9 0 6 0; 108 | #X connect 10 0 16 0; 109 | #X connect 16 0 0 0; 110 | #X connect 16 1 6 0; 111 | -------------------------------------------------------------------------------- /rtrig~.c: -------------------------------------------------------------------------------- 1 | #include "MSPd.h" 2 | 3 | static t_class *rtrig_class; 4 | 5 | #define OBJECT_NAME "rtrig~" 6 | 7 | #define MAXFLAMS (16) 8 | #define MAXATTACKS (128) 9 | #define STOPGAIN (.001) 10 | 11 | #define RAND_MAX2 (0x7fffffff) 12 | 13 | typedef struct 14 | { 15 | int attack_count; // number of triggers per flam event 16 | t_float *attack_times; // trigger times in seconds 17 | int *attack_points; // trigger times in samples 18 | int fdex; // current flam 19 | t_float gainatten; // attenuation factor 20 | t_float amp; // current amp 21 | int atks;// number of attacks per flam 22 | long counter; // internal clock 23 | short active; // flag that flam is turned on 24 | 25 | 26 | } t_flam; 27 | 28 | typedef struct _rtrig 29 | { 30 | 31 | t_object x_obj; 32 | t_float x_f; 33 | short mute; 34 | t_float min; 35 | t_float max; 36 | t_float odds; 37 | 38 | } t_rtrig; 39 | 40 | 41 | static void *rtrig_new(t_symbol *s, int argc, t_atom *argv); 42 | static t_int *rtrig_perform(t_int *w); 43 | static void rtrig_dsp(t_rtrig *x, t_signal **sp); 44 | static void rtrig_free(t_rtrig *x); 45 | static void rtrig_mute(t_rtrig *x, t_floatarg tog); 46 | static void rtrig_min(t_rtrig *x, t_floatarg v); 47 | static void rtrig_max(t_rtrig *x, t_floatarg v); 48 | static void rtrig_odds(t_rtrig *x, t_floatarg v); 49 | 50 | 51 | void rtrig_tilde_setup(void) 52 | { 53 | rtrig_class = class_new(gensym("rtrig~"),(t_newmethod)rtrig_new,(t_method)rtrig_free, sizeof(t_rtrig), 0, A_GIMME,0); 54 | CLASS_MAINSIGNALIN(rtrig_class,t_rtrig, x_f ); 55 | 56 | class_addmethod(rtrig_class,(t_method)rtrig_dsp,gensym("dsp"),A_CANT,0); 57 | class_addmethod(rtrig_class,(t_method)rtrig_mute,gensym("mute"),A_FLOAT,0); 58 | class_addmethod(rtrig_class,(t_method)rtrig_min,gensym("min"),A_FLOAT,0); 59 | class_addmethod(rtrig_class,(t_method)rtrig_max,gensym("max"),A_FLOAT,0); 60 | class_addmethod(rtrig_class,(t_method)rtrig_odds,gensym("odds"),A_FLOAT,0); 61 | potpourri_announce(OBJECT_NAME); 62 | } 63 | 64 | void rtrig_mute(t_rtrig *x, t_floatarg tog) 65 | { 66 | x->mute = (short) tog; 67 | } 68 | 69 | void rtrig_min(t_rtrig *x, t_floatarg v) 70 | { 71 | x->min = (t_float) v; 72 | } 73 | 74 | void rtrig_max(t_rtrig *x, t_floatarg v) 75 | { 76 | x->max = (t_float) v; 77 | } 78 | 79 | void rtrig_odds(t_rtrig *x, t_floatarg v) 80 | { 81 | x->odds = (t_float) v; 82 | } 83 | 84 | 85 | void *rtrig_new(t_symbol *s, int argc, t_atom *argv) 86 | { 87 | 88 | t_rtrig *x = (t_rtrig *)pd_new(rtrig_class); 89 | outlet_new(&x->x_obj, gensym("signal")); 90 | x->mute = 0; 91 | x->min = atom_getfloatarg(0,argc,argv); 92 | x->max = atom_getfloatarg(1,argc,argv); 93 | x->odds = atom_getfloatarg(2,argc,argv); 94 | 95 | srand(time(0)); 96 | return (x); 97 | } 98 | 99 | 100 | 101 | void rtrig_free(t_rtrig *x) 102 | { 103 | } 104 | 105 | t_int *rtrig_perform(t_int *w) 106 | { 107 | 108 | t_rtrig *x = (t_rtrig *) (w[1]); 109 | t_float *out_vec = (t_float *)(w[2]); 110 | int n = (int) w[3]; 111 | 112 | t_float rval; 113 | t_float min = x->min; 114 | t_float max = x->max; 115 | t_float odds = x->odds; 116 | 117 | if(x->mute) { 118 | memset( (void *)out_vec, 0, n * sizeof(t_float) ); 119 | return (w+4); 120 | } 121 | 122 | while( n-- ) { 123 | rval = (t_float) rand() / (t_float) RAND_MAX2; 124 | if(rval < odds) { 125 | rval = min + (max-min) * ((t_float) rand() / (t_float) RAND_MAX2); 126 | *out_vec++ = rval; 127 | } else { 128 | *out_vec++ = 0.0; 129 | } 130 | } 131 | 132 | 133 | return (w+4); 134 | } 135 | 136 | void rtrig_dsp(t_rtrig *x, t_signal **sp) 137 | { 138 | dsp_add(rtrig_perform, 3, x, sp[1]->s_vec, (t_int)sp[0]->s_n); 139 | } 140 | -------------------------------------------------------------------------------- /quadpan~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 646 534 12; 2 | #X obj 51 372 vu 15 120 empty empty -1 -8 0 10 -66577 -1 1 0; 3 | #N canvas 0 22 450 300 meter 0; 4 | #X obj 110 164 snapshot~; 5 | #X obj 126 114 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 6 | 1; 7 | #X floatatom 110 187 5 0 0 0 - - -; 8 | #X obj 110 91 env~ 1024; 9 | #X obj 126 140 metro 100; 10 | #X obj 109 211 - 100; 11 | #X obj 231 46 loadbang; 12 | #X msg 231 71 1; 13 | #X obj 109 246 outlet; 14 | #X obj 110 51 inlet~; 15 | #X connect 0 0 2 0; 16 | #X connect 1 0 4 0; 17 | #X connect 2 0 5 0; 18 | #X connect 3 0 0 0; 19 | #X connect 4 0 0 0; 20 | #X connect 5 0 8 0; 21 | #X connect 6 0 7 0; 22 | #X connect 7 0 1 0; 23 | #X connect 9 0 3 0; 24 | #X restore 50 329 pd meter; 25 | #X obj 117 373 vu 15 120 empty empty -1 -8 0 10 -66577 -1 1 0; 26 | #N canvas 0 22 450 300 meter 0; 27 | #X obj 110 164 snapshot~; 28 | #X obj 126 114 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 29 | 1; 30 | #X floatatom 110 187 5 0 0 0 - - -; 31 | #X obj 110 91 env~ 1024; 32 | #X obj 126 140 metro 100; 33 | #X obj 109 211 - 100; 34 | #X obj 231 46 loadbang; 35 | #X msg 231 71 1; 36 | #X obj 109 246 outlet; 37 | #X obj 110 51 inlet~; 38 | #X connect 0 0 2 0; 39 | #X connect 1 0 4 0; 40 | #X connect 2 0 5 0; 41 | #X connect 3 0 0 0; 42 | #X connect 4 0 0 0; 43 | #X connect 5 0 8 0; 44 | #X connect 6 0 7 0; 45 | #X connect 7 0 1 0; 46 | #X connect 9 0 3 0; 47 | #X restore 116 329 pd meter; 48 | #X obj 184 373 vu 15 120 empty empty -1 -8 0 10 -66577 -1 1 0; 49 | #N canvas 0 22 450 300 meter 0; 50 | #X obj 110 164 snapshot~; 51 | #X obj 126 114 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 52 | 1; 53 | #X floatatom 110 187 5 0 0 0 - - -; 54 | #X obj 110 91 env~ 1024; 55 | #X obj 126 140 metro 100; 56 | #X obj 109 211 - 100; 57 | #X obj 231 46 loadbang; 58 | #X msg 231 71 1; 59 | #X obj 109 246 outlet; 60 | #X obj 110 51 inlet~; 61 | #X connect 0 0 2 0; 62 | #X connect 1 0 4 0; 63 | #X connect 2 0 5 0; 64 | #X connect 3 0 0 0; 65 | #X connect 4 0 0 0; 66 | #X connect 5 0 8 0; 67 | #X connect 6 0 7 0; 68 | #X connect 7 0 1 0; 69 | #X connect 9 0 3 0; 70 | #X restore 183 329 pd meter; 71 | #X obj 251 374 vu 15 120 empty empty -1 -8 0 10 -66577 -1 1 0; 72 | #N canvas 0 22 450 300 meter 0; 73 | #X obj 110 164 snapshot~; 74 | #X obj 126 114 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 75 | 1; 76 | #X floatatom 110 187 5 0 0 0 - - -; 77 | #X obj 110 91 env~ 1024; 78 | #X obj 126 140 metro 100; 79 | #X obj 109 211 - 100; 80 | #X obj 231 46 loadbang; 81 | #X msg 231 71 1; 82 | #X obj 109 246 outlet; 83 | #X obj 110 51 inlet~; 84 | #X connect 0 0 2 0; 85 | #X connect 1 0 4 0; 86 | #X connect 2 0 5 0; 87 | #X connect 3 0 0 0; 88 | #X connect 4 0 0 0; 89 | #X connect 5 0 8 0; 90 | #X connect 6 0 7 0; 91 | #X connect 7 0 1 0; 92 | #X connect 9 0 3 0; 93 | #X restore 250 329 pd meter; 94 | #X obj 153 185 hsl 128 15 0 1 0 0 empty empty X-coordinate -2 -8 0 95 | 10 -262144 -1 -1 3700 1; 96 | #X obj 253 227 hsl 128 15 0 1 0 0 empty empty Y-coordinate -2 -8 0 97 | 10 -262144 -1 -1 7200 1; 98 | #X obj 50 210 osc~ 440; 99 | #X text 339 263 Spatial positioning of output channels; 100 | #X text 339 281 is as follows:; 101 | #X text 504 317 3; 102 | #X text 436 317 4; 103 | #X text 506 369 1; 104 | #X text 435 369 2; 105 | #X obj 50 262 lyonpotpourri/quadpan~, f 29; 106 | #X obj 28 19 lpp-icon quadpan~; 107 | #X msg 365 471 \; pd dsp \$1; 108 | #X obj 365 435 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 109 | 1; 110 | #X text 385 439 turn DACs on; 111 | #X text 244 60 - X/Y panning within a plane for joystick-style control 112 | ; 113 | #X text 48 117 [quadpan~] takes in X/Y cordinates (as signal or float) 114 | to position an input signal within a quadraphonic plane.; 115 | #X connect 1 0 0 0; 116 | #X connect 3 0 2 0; 117 | #X connect 5 0 4 0; 118 | #X connect 7 0 6 0; 119 | #X connect 8 0 17 1; 120 | #X connect 9 0 17 2; 121 | #X connect 10 0 17 0; 122 | #X connect 17 0 1 0; 123 | #X connect 17 1 3 0; 124 | #X connect 17 2 5 0; 125 | #X connect 17 3 7 0; 126 | #X connect 20 0 19 0; 127 | -------------------------------------------------------------------------------- /stutter~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 510 90 545 456 12; 2 | #N canvas 0 22 450 300 (subpatch) 0; 3 | #X array sound1 62079 float 2; 4 | #X coords 0 1 62079 -1 100 70 1; 5 | #X restore 205 266 graph; 6 | #N canvas 600 60 502 352 messages 0; 7 | #X obj 22 122 s stutter.messages; 8 | #X text 20 15 extrema for echo count; 9 | #X text 23 148 extrema for loop duration; 10 | #N canvas 586 175 450 300 pattern-storage 0; 11 | #X obj 29 46 s stutter.messages; 12 | #X msg 29 13 show_loop; 13 | #X text 118 15 print current loop; 14 | #X text 169 83 setloop (start sample \, sample duration); 15 | #X obj 26 113 s stutter.messages; 16 | #X msg 26 79 set_loop 6951 3000; 17 | #X obj 30 187 s stutter.messages; 18 | #X msg 30 153 store_loop 1; 19 | #X obj 25 249 s stutter.messages; 20 | #X msg 25 215 recall_loop 1; 21 | #X text 128 213 recall loop 1; 22 | #X text 127 154 store current loop in location 1; 23 | #X text 25 277 you can store up to 1024 different loops in locations 24 | 0-1023; 25 | #X connect 1 0 0 0; 26 | #X connect 5 0 4 0; 27 | #X connect 7 0 6 0; 28 | #X connect 9 0 8 0; 29 | #X restore 313 149 pd pattern-storage; 30 | #X obj 43 257 s stutter.messages; 31 | #X obj 43 199 unpack f f; 32 | #X msg 43 172 90 40; 33 | #X msg 108 172 1000 200; 34 | #X msg 43 226 max_looptime \$1; 35 | #X msg 172 226 min_looptime \$1; 36 | #X text 176 173 order: max \, min; 37 | #X obj 320 112 s stutter.messages; 38 | #X msg 320 55 lockme \$1; 39 | #X obj 320 27 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 40 | 1; 41 | #N canvas 564 177 450 300 refinements 0; 42 | #X obj 43 257 s stutter.messages; 43 | #X msg 93 232 taper 5; 44 | #X msg 43 200 taper 50; 45 | #X text 111 199 softer envelope; 46 | #X text 153 235 harder envelope; 47 | #X text 44 183 taper duration in ms.; 48 | #X obj 30 101 s stutter.messages; 49 | #X msg 30 75 randomize_dur \$1; 50 | #X floatatom 30 51 5 0 0 0 - - -; 51 | #X obj 33 26 hsl 128 15 0 0.2 0 0 empty empty empty -2 -8 0 10 -129795 52 | -1 -1 0 1; 53 | #X obj 193 104 s stutter.messages; 54 | #X floatatom 193 54 5 0 0 0 - - -; 55 | #X obj 196 29 hsl 128 15 0 0.2 0 0 empty empty empty -2 -8 0 10 -129795 56 | -1 -1 0 1; 57 | #X msg 193 77 randomize_start \$1; 58 | #X text 25 7 random loop deviations; 59 | #X connect 1 0 0 0; 60 | #X connect 2 0 0 0; 61 | #X connect 7 0 6 0; 62 | #X connect 8 0 7 0; 63 | #X connect 9 0 8 0; 64 | #X connect 11 0 13 0; 65 | #X connect 12 0 11 0; 66 | #X connect 13 0 10 0; 67 | #X restore 313 179 pd refinements; 68 | #X msg 328 76 new_loop; 69 | #X text 340 29 lock current loop; 70 | #X text 392 76 force new; 71 | #X msg 22 58 minmax_echo 2 4; 72 | #X msg 52 87 minmax_echo 5 20; 73 | #X msg 190 89 minmax_echo 1 2; 74 | #X msg 153 38 min_echo 1; 75 | #X msg 172 61 max_echo 2; 76 | #X connect 5 0 8 0; 77 | #X connect 5 1 9 0; 78 | #X connect 6 0 5 0; 79 | #X connect 7 0 5 0; 80 | #X connect 8 0 4 0; 81 | #X connect 9 0 4 0; 82 | #X connect 12 0 11 0; 83 | #X connect 13 0 12 0; 84 | #X connect 15 0 11 0; 85 | #X connect 18 0 0 0; 86 | #X connect 19 0 0 0; 87 | #X connect 20 0 0 0; 88 | #X connect 21 0 0 0; 89 | #X connect 22 0 0 0; 90 | #X restore 201 396 pd messages; 91 | #X text 198 369 use a fairly long and varied sound here; 92 | #N canvas 600 60 466 316 load-soundfile 0; 93 | #X obj 31 177 soundfiler; 94 | #X msg 30 103 bang; 95 | #X obj 30 129 openpanel; 96 | #X msg 30 151 read -resize \$1 sound1; 97 | #X obj 11 57 loadbang; 98 | #X obj 105 40 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 99 | -1; 100 | #X msg 10 82 read -resize sound/voice.wav sound1; 101 | #X connect 1 0 2 0; 102 | #X connect 2 0 3 0; 103 | #X connect 3 0 0 0; 104 | #X connect 4 0 6 0; 105 | #X connect 5 0 6 0; 106 | #X connect 6 0 0 0; 107 | #X restore 201 351 pd load-soundfile; 108 | #X obj 38 171 r stutter.messages; 109 | #X obj 38 196 lyonpotpourri/stutter~ sound1 500 1000 30; 110 | #X obj 38 256 lpp-meters; 111 | #X obj 26 22 lpp-icon stutter~; 112 | #X text 291 396 <= open this for more info; 113 | #X text 243 58 - stuttering playback from an array; 114 | #X text 31 126 [stutter~] is a sample stutterer and precursor to [chopper~] 115 | just different enough to perhaps remain worthwhile., f 61; 116 | #X connect 4 0 5 0; 117 | #X connect 5 0 6 0; 118 | #X connect 5 0 6 1; 119 | -------------------------------------------------------------------------------- /oscil~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 600 60 790 526 12; 2 | #X floatatom 43 173 5 0 0 2 frequency oscil-frequency-in -; 3 | #N canvas 450 214 639 421 built-in-waveforms 0; 4 | #X msg 135 88 square; 5 | #X msg 186 89 triangle; 6 | #X msg 254 89 buzz; 7 | #X msg 299 89 sine; 8 | #X msg 26 43 harmcount \$1; 9 | #X floatatom 26 23 5 1 128 0 - - -; 10 | #X msg 343 88 sawtooth; 11 | #X msg 374 221 harmcount \$1; 12 | #X floatatom 324 175 5 0 0 0 - - -; 13 | #X obj 324 195 t b f; 14 | #X msg 324 219 buzz; 15 | #X obj 327 154 hsl 40 15 1 40 0 0 empty empty empty -2 -6 0 8 -36928 16 | -1 -1 0 1; 17 | #X text 131 69 band-limited waveforms; 18 | #X text 325 133 or do it dynamically; 19 | #X msg 272 312 fadetime 50; 20 | #X text 236 295 make sure your fade time is short for fast changes 21 | ; 22 | #X text 118 45 set how many harmonics in bl waveforms; 23 | #X obj 121 344 s \$0-oscil-msgs; 24 | #X connect 0 0 17 0; 25 | #X connect 1 0 17 0; 26 | #X connect 2 0 17 0; 27 | #X connect 3 0 17 0; 28 | #X connect 4 0 17 0; 29 | #X connect 5 0 4 0; 30 | #X connect 6 0 17 0; 31 | #X connect 7 0 17 0; 32 | #X connect 8 0 9 0; 33 | #X connect 9 0 10 0; 34 | #X connect 9 1 7 0; 35 | #X connect 10 0 17 0; 36 | #X connect 11 0 8 0; 37 | #X connect 14 0 17 0; 38 | #X restore 222 366 pd built-in-waveforms; 39 | #N canvas 371 122 880 507 user-waveforms 0; 40 | #X msg 105 81 0 0 0.1 0 0.25 0.5 0 0 0.3 0.1 0.05; 41 | #X msg 120 107 0 0.1 0.3 0 0 0 0 0.5 0 0 0.7 0 0 0.2 0.1; 42 | #X msg 130 129 0 0.1 0.1 1 1 0.1 0.1; 43 | #X msg 140 151 0 1 0.5 0.25 0.125 0.0625; 44 | #X text 45 33 list relative weights of harmonics \, starting with DC 45 | ; 46 | #X msg 145 198 0 1; 47 | #X text 171 199 this is a sine; 48 | #X obj 105 332 s \$0-oscil-msgs; 49 | #X msg 436 237 amph 0 1 0 0.5 0.5 0.25 0.2; 50 | #X text 447 172 specify both amplitude and phase. The first entry is 51 | for DC \, which has no phase. Following that \, enter [amp \, phase] 52 | pairs \, where phase is specified as a fraction of 2PI. A phase of 53 | 0.5 would be 180 degrees \, or PI radians.; 54 | #X connect 0 0 7 0; 55 | #X connect 1 0 7 0; 56 | #X connect 2 0 7 0; 57 | #X connect 3 0 7 0; 58 | #X connect 5 0 7 0; 59 | #X connect 8 0 7 0; 60 | #X restore 222 392 pd user-waveforms; 61 | #X obj 43 231 lyonpotpourri/oscil~ 220 8192 square 16; 62 | #X obj 43 304 lpp-meters; 63 | #X obj 35 17 lpp-icon oscil~; 64 | #X text 328 233 args: freq \, table length \, waveform \, harmonics 65 | available waveforms are: square \, triangle \, buzz \, sine \, and 66 | sawtooth; 67 | #N canvas 0 23 450 300 init 0; 68 | #X obj 78 90 loadbang; 69 | #X msg 78 113 220; 70 | #X obj 78 148 s oscil-frequency-in; 71 | #X connect 0 0 1 0; 72 | #X connect 1 0 2 0; 73 | #X restore 222 418 pd init; 74 | #X text 257 42 - custom oscillator with interpolation between waveforms 75 | ; 76 | #X obj 209 201 r \$0-oscil-msgs; 77 | #N canvas 308 135 823 472 interpolation 0; 78 | #X obj 77 394 s \$0-oscil-msgs; 79 | #X msg 77 79 fadetime 5000; 80 | #X msg 107 109 fadetime 50; 81 | #X text 73 62 waveform interpolation time (ms); 82 | #X msg 134 160 fadetime \$1; 83 | #X floatatom 134 134 5 5 30000 0 - - -; 84 | #X msg 284 175 interpolate \$1; 85 | #X obj 284 143 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 86 | 1; 87 | #X msg 257 319 fadetype \$1; 88 | #X obj 257 263 vradio 15 1 0 3 empty empty empty 0 -8 0 10 -262144 89 | -1 -1 1; 90 | #X text 282 263 no fade; 91 | #X text 283 295 equal power fade; 92 | #X text 283 280 linear fade (default); 93 | #X text 313 130 Turn on linear interpolation for waveform lookup (and 94 | potentially smoother waveforms). With a large table size \, you might 95 | not hear much difference.; 96 | #X text 346 317 select option for interpolating from one waveform to 97 | the next, f 62; 98 | #X connect 1 0 0 0; 99 | #X connect 2 0 0 0; 100 | #X connect 4 0 0 0; 101 | #X connect 5 0 4 0; 102 | #X connect 6 0 0 0; 103 | #X connect 7 0 6 0; 104 | #X connect 8 0 0 0; 105 | #X connect 9 0 8 0; 106 | #X restore 222 340 pd interpolation; 107 | #X text 36 109 An oscillator with arbitrary waveforms \, table length 108 | and crossfade between different waveforms; 109 | #X text 86 171 <= signal input is also fine; 110 | #X connect 0 0 3 0; 111 | #X connect 3 0 4 0; 112 | #X connect 3 0 4 1; 113 | #X connect 9 0 3 0; 114 | -------------------------------------------------------------------------------- /npan~.c: -------------------------------------------------------------------------------- 1 | #include "MSPd.h" 2 | #define OBJECT_NAME "npan~" 3 | 4 | #define SPEAKERMAX (1024) 5 | 6 | static t_class *npan_class; 7 | 8 | typedef struct _npan 9 | { 10 | t_object x_obj; 11 | double pi_over_two; 12 | double twopi; 13 | t_float x_f; 14 | int outcount; 15 | t_float *input_locvec; 16 | t_float *panner_locvec; 17 | } t_npan; 18 | 19 | static void *npan_new(t_symbol *s, int argc, t_atom *argv); 20 | static t_int *npan_perform(t_int *w); 21 | static void npan_dsp(t_npan *x, t_signal **sp); 22 | static void npan_free(t_npan *x); 23 | 24 | void npan_tilde_setup(void) { 25 | npan_class = class_new(gensym("npan~"), (t_newmethod)npan_new, 26 | (t_method)npan_free, sizeof(t_npan),0,A_GIMME,0); 27 | CLASS_MAINSIGNALIN(npan_class, t_npan, x_f); 28 | class_addmethod(npan_class, (t_method)npan_dsp, gensym("dsp"), A_CANT, 0); 29 | potpourri_announce(OBJECT_NAME); 30 | } 31 | 32 | void *npan_new(t_symbol *s, int argc, t_atom *argv) 33 | { 34 | t_npan *x; 35 | x = (t_npan *)pd_new(npan_class); 36 | int i; 37 | x->outcount = (int) atom_getfloatarg(0, argc, argv); 38 | if( x->outcount < 2 || x->outcount > SPEAKERMAX ) { 39 | 40 | pd_error(0, "npan~: output count %d exceeded range limits of 2 to %d",x->outcount, SPEAKERMAX); 41 | x->outcount = SPEAKERMAX; 42 | } 43 | inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("signal"),gensym("signal")); // create 2nd inlet 44 | for(i = 0; i < x->outcount; i++) { 45 | outlet_new(&x->x_obj, gensym("signal")); 46 | } 47 | x->input_locvec = (t_float *) getbytes(8192 * sizeof(t_float)); 48 | x->panner_locvec = (t_float *) getbytes(8192 * sizeof(t_float)); 49 | x->pi_over_two = 1.5707963267948965; 50 | x->twopi = 6.283185307179586; 51 | return x; 52 | } 53 | 54 | void npan_free(t_npan *x) 55 | { 56 | freebytes(x->panner_locvec, 8192 * sizeof(t_float)); 57 | freebytes(x->input_locvec, 8192 * sizeof(t_float)); 58 | } 59 | 60 | t_int *npan_perform(t_int *w) 61 | { 62 | t_npan *x = (t_npan*) w[1]; 63 | int outcount = x->outcount; 64 | t_float *input = (t_float*) w[2]; 65 | t_float *panner = (t_float*) w[3]; 66 | t_float *outlet1, *outlet2, *cleanoutlet; 67 | t_float *input_locvec = x->input_locvec; 68 | t_float *panner_locvec = x->panner_locvec; 69 | 70 | double gain1, gain2; 71 | double insamp; 72 | int chan1, chan2; 73 | double panloc, frak; 74 | int i,j; 75 | 76 | double pi_over_two = x->pi_over_two; 77 | int n = (int) w[4 + outcount]; 78 | // copy inputs 79 | for(i = 0; i < n; i++) { 80 | input_locvec[i] = input[i]; 81 | panner_locvec[i] = panner[i]; 82 | } 83 | // clean all outlets 84 | for( i = 0; i < outcount; i++ ) { 85 | cleanoutlet = (t_float*) w[4 + i]; 86 | for(j = 0; j < n; j++) { 87 | cleanoutlet[j] = 0.0; 88 | } 89 | } 90 | for(i = 0; i < n; i++) { 91 | insamp = input_locvec[i]; 92 | panloc = panner_locvec[i]; 93 | if( panloc < 0 ) 94 | panloc = 0.0; 95 | if( panloc >= 1 ) // wrap around (otherwise crash on outlet out of range) 96 | panloc = 0.0; 97 | panloc *= (double) outcount; 98 | chan1 = floor( panloc ); 99 | chan2 = (chan1 + 1) % outcount; 100 | frak = ( panloc - chan1 ) * pi_over_two; 101 | gain1 = cos( frak ); 102 | gain2 = sin( frak ); 103 | outlet1 = (t_float*) w[chan1 + 4]; // add offset 104 | outlet2 = (t_float*) w[chan2 + 4]; 105 | 106 | outlet1[i] = insamp * gain1; 107 | outlet2[i] = insamp * gain2; 108 | } 109 | return (w + outcount + 5); 110 | } 111 | 112 | void npan_dsp(t_npan *x, t_signal **sp) 113 | { 114 | long i; 115 | t_int **sigvec; 116 | int pointer_count = x->outcount + 4; 117 | sigvec = (t_int **) getbytes(pointer_count * sizeof(t_int *)); 118 | for(i = 0; i < pointer_count; i++) { 119 | sigvec[i] = (t_int *) getbytes(sizeof(t_int) * 1); 120 | } 121 | sigvec[0] = (t_int *)x; // first pointer is to the object 122 | sigvec[pointer_count - 1] = (t_int *)sp[0]->s_n; // last pointer is to vector size (N) 123 | for(i = 1; i < pointer_count - 1; i++){ // now attach the inlet and all outlets 124 | sigvec[i] = (t_int *)sp[i-1]->s_vec; 125 | } 126 | dsp_addv(npan_perform, pointer_count, (t_int *) sigvec); 127 | freebytes(sigvec,sizeof(t_int) * 1); 128 | } 129 | -------------------------------------------------------------------------------- /pd-lib-builder/CHANGELOG.txt: -------------------------------------------------------------------------------- 1 | Changelog for Makefile.pdlibbuilder. 2 | 3 | v0.7.0, dated 2023-07-06 4 | - build double-precision externals with the 'floatsize' variable 5 | - allow building multiple flavours of an external side-by-side (#78) 6 | - facilitate multiple platform co-installation of shared lib (#58) 7 | - fix use of shared.ldflags with helper-library (#64) 8 | - fix broken armv6l platform detection (#71) 9 | - improve documentation 10 | 11 | v0.6.0, dated 2019-12-21 12 | - detect target platform (OS and architecture) rather than build platform (#55) 13 | - introduce optional user variable 'PLATFORM' for cross compilation 14 | - no longer build OSX/MacOS fat binaries by default (#21, #50) 15 | - do build fat binaries when 'extension=d_fat' is specified for OSX/MacOS 16 | - fix bug where minimum OSX/MacOS version wasn't defined, and set it to 10.6 17 | 18 | v0.5.1, dated 2018-03-15 19 | Fixes and improvements for Windows builds: 20 | - properly evaluate variables 'PDDIR' and 'PDBINDIR' to find pd.dll 21 | - define default path of 32 bit Pd on 64 bit Windows 22 | - link C++ externals with standard C libs on Windows, they don't load otherwise 23 | - strip installed Windows binaries by default 24 | (issues #34, #39, #41, #42 respectively) 25 | Warning for all platforms: variable 'PD_PATH' is no longer supported, use the 26 | equivalent 'PDDIR'. 27 | 28 | v0.5.0, dated 2018-01-23 29 | Implement target architecture detection for Windows builds, 30 | and set appropriate options for 32 and 64 bit (used to be for 32 bit only). 31 | (feature, issue #37 #38, merge commit 215bf3e) 32 | 33 | v0.4.4, dated 2016-11-22 34 | Use variable 'system' when evaluating 'for{Linux,Darwin,Windows}' 35 | (bugfix, issue #31, commit 2c14110) 36 | 37 | v0.4.3, dated 2016-11-02 38 | Replace flags '-fpic' by 'fPIC'. 39 | (bugfix, issue #29, commit 426b38b) 40 | 41 | v0.4.2, dated 2016-10-30 42 | Fix issue where incorrect message about m_pd.h is given. 43 | (bugfix, commit 2e13d8f) 44 | 45 | v0.4.1, dated 2016-10-27 46 | Respect cflag for minimum OSX version when defined by lib makefile. 47 | (bugfix, pull request #22, commit 48c4127) 48 | 49 | v0.4.0, dated 2016-10-14 50 | Introduced path variables PDDIR, PDINCLUDEDIR, PDBINDIR, PDLIBDIR which can 51 | also be defined in environment. 52 | (feature, issue #27, commit b0dab72) 53 | 54 | v0.3.1, dated 2016-10-13 55 | Fix bug where pd.dll wouldn't be found. 56 | (bugfix, commit a0c87be) 57 | 58 | v0.3.0, dated 2016-10-09 59 | Variable 'PD_PATH' introduced for pd-extended / pd-l2ork compatibility. 60 | (feature, issue #26, commit 41e9743) 61 | 62 | v0.2.8, dated 2016-10-09 63 | Allow installed files to contain weird characters (notably '$'). 64 | (bugfix, pull request #20, commit 5b920b1) 65 | 66 | v0.2.7, dated 2016-10-04 67 | Remove all default pd search paths except vanilla's. 68 | (discussion, issue #25, commit a6a89dc) 69 | 70 | v0.2.6, dated 2016-09-20 71 | Redefined dependency checking so it won't stall rebuilds on OSX. 72 | (bugfix, issue #16, commit 9fd1795) 73 | 74 | v0.2.5, dated 2016-06-26 75 | Fixed dependency checking for object files in other directories. 76 | (bugfix, commit f06e550) 77 | 78 | v0.2.4, dated 2016-06-25 79 | Fixed regression bug that disabled all dependency checking. 80 | (bugfix, commit 1d7bb5e) 81 | 82 | v0.2.3, dated 2016-03-29 83 | Disabled dependency checking for OSX <= 10.5 because it stalled rebuilds. 84 | (bugfix, issue #16, commit eb614fd) 85 | 86 | v0.2.2, dated 2016-03-28 87 | Removed target 'pre' because it forced rebuild of everything in 'all'. 88 | (bugfix, issue #17, commit c989c8e) 89 | 90 | v0.2.1, dated 2015-12-27 91 | Implement / respect 'CPPFLAGS','CFLAGS'and 'LDFLAGS'. 92 | (bugfix, issue #5, commit 98f3582) 93 | 94 | v0.2.0, dated 2015-12-19 95 | Added per-platform multiline defines 'forLinux', 'forDarwin', 'forWindows'. 96 | (feature, pull request #9, commit 3946ea5) 97 | 98 | v0.1.0, dated 2015-12-08 99 | Added targets 'pre' and 'post' to automatically run before and after 'all'. 100 | (feature, pull request #4, commit a5678ac) 101 | 102 | v0.0.2, dated 2015-12-06 103 | Improved methods for searching pd paths. 104 | (bugfix, commit ed37e6b) 105 | 106 | v0.0.1, dated 2015-10-31 107 | Fixed expansion of variable 'lib.version'. 108 | (bugfix, issue #1, commit 974b617) 109 | 110 | v0.0.0, dated 2015-06-24 111 | Initial version. 112 | (commit 16517a2) 113 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | Welcome to LyonPotpourri, version 3.0 (64-bit version). 2 | 3 | http://disis.music.vt.edu/eric/LyonSoftware/Pd/LyonPotpourri/ 4 | 5 | LyonPotpourri is a collection of externals developed for the creation and performance of computer music. The externals were originally developed for Max/MSP, and then extended into hybrid code that could compile for both Max/MSP and Pd. As of version 3.0, the code bases of Max/MSP and Pd have diverged to such an extent that I decided to split the LyonPotpourri code into separate Pd and Max/MSP versions. 6 | 7 | The Pd platform tends toward minimalism. Therefore, it is particularly advantageous for Pd users to become adept at designing their own externals. It is hoped that in addition to the utility of specific externals in this collection, the source code will be helpful for computer musicians who wish to learn how to write their own externals. For further guidance on that subject, please see my book “Designing Audio Objects for Max/MSP and Pd.” 8 | 9 | LyonPotpourri 3.0 is Copyright Eric Lyon, 2007-2013, and is covered under the MIT license. Please see the accompanying License file for details. 10 | 11 | 12 | Object Listing: 13 | 14 | - adsr~ a simple ADSR envelope that can be click triggered 15 | - arrayfilt~ fft-based filtering by drawing into an array 16 | - bashfest~ a click driven buffer player with randomized DSP 17 | - buffet~ provides operations on a stored buffer 18 | - bvplay~ selective playback from a stored buffer with enveloping and increment control 19 | - cartopol~ convert a spectral frame from cartesian to polar form 20 | - channel~ access to a precise address in the signal vector 21 | - chopper~ munging loop playback from a buffer 22 | - clean_selector~ like selector~ but crossfades when switching channels 23 | - click~ converts a bang to a click 24 | - click2float~ translates a signal click to a float message 25 | - clickhold~ sample and hold a click 26 | - convolver~ non-real-time convolution with impulses of arbitrary size 27 | - distortion~ lookup function distortion 28 | - dmach~ pattern based sample accurate drum machine prototype 29 | - expflam~ converts a click to an exponential flam click pattern 30 | - flanjah~ simple flanger 31 | - function~ write various functions into an array 32 | - granola~ granular pitch scaling 33 | - granulesf~ granular synthesis module reading from a soundfile in a buffer 34 | - granule~ granular synthesis module reading from a stored waveform in a buffer 35 | - kbuffer~ low sampling rate buffer to capture gestures 36 | - killdc~ DC block filter 37 | - latch~ sustain an incoming click with sample-accurate timing 38 | - magfreq_analysis~ transforms a time domain signal to a magnitude/frequency spectrum 39 | - markov~ implements a first order Markov chain 40 | - mask~ a click driven pattern sequencer 41 | - npan~ power-panning to an arbitrary number of output channels 42 | - oscil~ oscillator with flexible waveform specification 43 | - phasemod~ phase modulated waveform 44 | - player~ click driven buffer player that can sustain multiple iterations 45 | - poltocar~ convert spectral frame from polar to complex representation 46 | - pulser~ pulse wave generated by additive synthesis 47 | - quadpan~ pan an incoming sound within a quadraphonic plane 48 | - rotapan~ rotate an array of input channels to the same number of output channels 49 | - rtrig~ generates random click triggers 50 | - samm~ sample accurate multiple metronomes, with click signal articulation 51 | - sarec~ sample accurate recording 52 | - sel~ sample-accurate implementation of the sel algorithm 53 | - shoehorn~ collapse from a larger number to a smaller number of audio channels 54 | - sigseq~ signal level numerical sequencer 55 | - splitbank~ - split an incoming sound into complementary, independently tunable spectra 56 | - splitspec~ split an incoming sound into complementary spectra 57 | - squash~ implementation of a compression algorithm by Chris Penrose 58 | - stutter~ stuttering playback from an array 59 | - vdb~ a delay line using an array for storage (no vector limit on feedback delaytime) 60 | - vdp~ a simple, self-contained delay unit 61 | - vecdex~ outputs the sample index within the current signal vector 62 | - waveshape~ a Chebychev function lookup waveshaper 63 | - windowvec~ apply a Hann window to the input signal vector 64 | 65 | Best wishes for the success of your creative projects and explorations! 66 | 67 | Eric Lyon 68 | ericlyon@vt.edu 69 | Department of Music 70 | Institute for Creativity, Arts, and Technology 71 | Virginia Tech 72 | -------------------------------------------------------------------------------- /quadpan~.c: -------------------------------------------------------------------------------- 1 | #include "MSPd.h" 2 | #define OBJECT_NAME "quadpan~" 3 | /* 4 | 5 | Front 6 | 7 | *out1 *out3 8 | 9 | 10 | 11 | *out2 *out4 12 | 13 | Back 14 | 15 | */ 16 | 17 | static t_class *quadpan_class; 18 | 19 | 20 | typedef struct _quadpan 21 | { 22 | t_object x_obj; 23 | t_float x_f; 24 | t_float *in; 25 | t_float *Xin; 26 | t_float *Yin; 27 | } t_quadpan; 28 | 29 | static void *quadpan_new(t_symbol *s, int argc, t_atom *argv); 30 | //static t_int *offset_perform(t_int *w); 31 | static t_int *quadpan_perform(t_int *w); 32 | static void quadpan_dsp(t_quadpan *x, t_signal **sp); 33 | //static void quadpan_showstate( t_quadpan *x ); 34 | static void quadpan_free(t_quadpan *x); 35 | 36 | void quadpan_tilde_setup(void) 37 | { 38 | quadpan_class = class_new(gensym("quadpan~"), (t_newmethod)quadpan_new, (t_method)quadpan_free,sizeof(t_quadpan),0,A_GIMME,0); 39 | CLASS_MAINSIGNALIN(quadpan_class, t_quadpan, x_f); 40 | class_addmethod(quadpan_class, (t_method)quadpan_dsp, gensym("dsp"), A_CANT, 0); 41 | 42 | potpourri_announce(OBJECT_NAME); 43 | } 44 | 45 | void *quadpan_new(t_symbol *s, int argc, t_atom *argv) 46 | { 47 | int i; 48 | t_quadpan *x = (t_quadpan *)pd_new(quadpan_class); 49 | 50 | 51 | for(i = 0; i < 2; i++) { 52 | inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("signal"),gensym("signal")); 53 | } 54 | for(i = 0; i < 4; i++) { 55 | outlet_new(&x->x_obj, gensym("signal")); 56 | } 57 | x->in = (t_float *) getbytes(8192 * sizeof(t_float)); 58 | x->Xin = (t_float *) getbytes(8192 * sizeof(t_float)); 59 | x->Yin = (t_float *) getbytes(8192 * sizeof(t_float)); 60 | // x->pi_over_two = 1.5707963267948965; 61 | // x->twopi = 6.283185307179586; 62 | 63 | return x; 64 | } 65 | void quadpan_free(t_quadpan *x) 66 | { 67 | freebytes(x->in,8192 * sizeof(t_float)); 68 | freebytes(x->Xin,8192 * sizeof(t_float)); 69 | freebytes(x->Yin,8192 * sizeof(t_float)); 70 | } 71 | 72 | t_int *quadpan_perform(t_int *w) 73 | { 74 | t_float gain1, gain2, gain3, gain4; 75 | t_float xval, yval; 76 | t_float xsquared, ysquared, ix, iy, ixsquared, iysquared; 77 | int i; 78 | 79 | t_quadpan *x = (t_quadpan *) (w[1]); 80 | t_float *in = x->in; 81 | t_float *Xin = x->Xin; 82 | t_float *Yin = x->Yin; 83 | 84 | t_float *in_loc = (t_float *)(w[2]); 85 | t_float *Xin_loc = (t_float *)(w[3]); 86 | t_float *Yin_loc = (t_float *)(w[4]); 87 | 88 | t_float *out1 = (t_float *)(w[5]); 89 | t_float *out2 = (t_float *)(w[6]); 90 | t_float *out3 = (t_float *)(w[7]); 91 | t_float *out4 = (t_float *)(w[8]); 92 | int n = (int)(w[9]); 93 | 94 | // copy buffers to avoid writeovers in shared memory 95 | for(i = 0; i < n; i++) { 96 | in[i] = in_loc[i]; 97 | Xin[i] = Xin_loc[i]; 98 | Yin[i] = Yin_loc[i]; 99 | } 100 | 101 | while( n-- ) { 102 | xval = *Xin++; 103 | yval = *Yin++; 104 | if( xval < 0.0 ) 105 | xval = 0.0; 106 | if( yval > 1.0 ) 107 | yval = 1.0; 108 | if( yval < 0.0 ) 109 | yval = 0.0; 110 | if( yval > 1.0 ) 111 | yval = 1.0; 112 | 113 | xsquared = xval * xval; 114 | ysquared = yval * yval; 115 | ix = 1.0 - xval; 116 | iy = 1.0 - yval; 117 | ixsquared = ix * ix; 118 | iysquared = iy * iy; 119 | 120 | gain1 = sqrt( xsquared + ysquared ); 121 | if( gain1 > 1.0 ) 122 | gain1 = 1.0; 123 | gain1 = 1.0 - gain1; /* Left Rear Gain */ 124 | 125 | 126 | gain2 = sqrt( ixsquared + ysquared ); 127 | if( gain2 > 1.0 ) 128 | gain2 = 1.0; 129 | gain2 = 1.0 - gain2; /* Right Rear Gain */ 130 | 131 | gain3 = sqrt( xsquared + iysquared ); 132 | if( gain3 > 1.0 ) 133 | gain3 = 1.0; 134 | gain3 = 1.0 - gain3; /* Left Front Gain */ 135 | 136 | 137 | gain4 = sqrt( ixsquared + iysquared ) ; 138 | if( gain4 > 1.0 ) 139 | gain4 = 1.0; 140 | gain4 = 1.0 - gain4; /* Right Front Gain*/ 141 | 142 | *out1++ = *in * gain3; 143 | *out2++ = *in * gain4; 144 | *out3++ = *in * gain2; 145 | *out4++ = *in++ * gain1; 146 | } 147 | 148 | return (w+10); 149 | } 150 | 151 | 152 | 153 | void quadpan_dsp(t_quadpan *x, t_signal **sp) 154 | { 155 | if( ! sp[0]->s_sr ) { 156 | return; 157 | } 158 | dsp_add(quadpan_perform, 9, x, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, 159 | sp[3]->s_vec, sp[4]->s_vec, sp[5]->s_vec, sp[6]->s_vec, 160 | (t_int)sp[0]->s_n); 161 | } 162 | -------------------------------------------------------------------------------- /fft.c: -------------------------------------------------------------------------------- 1 | #include "fftease.h" 2 | 3 | 4 | 5 | 6 | /* If forward is true, rfft replaces 2*N real data points in x with 7 | N complex values representing the positive frequency half of their 8 | Fourier spectrum, with x[1] replaced with the real part of the Nyquist 9 | frequency value. If forward is false, rfft expects x to contain a 10 | positive frequency spectrum arranged as before, and replaces it with 11 | 2*N real values. N MUST be a power of 2. */ 12 | 13 | void lpp_rfft( t_float *x, int N, int forward ) 14 | 15 | { 16 | t_float c1,c2, 17 | h1r,h1i, 18 | h2r,h2i, 19 | wr,wi, 20 | wpr,wpi, 21 | temp, 22 | theta; 23 | t_float xr,xi; 24 | int i, 25 | i1,i2,i3,i4, 26 | N2p1; 27 | static int first = 1; 28 | /*t_float PI, TWOPI;*/ 29 | // void cfft(); 30 | 31 | if ( first ) { 32 | 33 | first = 0; 34 | } 35 | theta = PI/N; 36 | wr = 1.; 37 | wi = 0.; 38 | c1 = 0.5; 39 | if ( forward ) { 40 | c2 = -0.5; 41 | lpp_cfft( x, N, forward ); 42 | xr = x[0]; 43 | xi = x[1]; 44 | } else { 45 | c2 = 0.5; 46 | theta = -theta; 47 | xr = x[1]; 48 | xi = 0.; 49 | x[1] = 0.; 50 | } 51 | wpr = -2.*pow( sin( 0.5*theta ), 2. ); 52 | wpi = sin( theta ); 53 | N2p1 = (N<<1) + 1; 54 | for ( i = 0; i <= N>>1; i++ ) { 55 | i1 = i<<1; 56 | i2 = i1 + 1; 57 | i3 = N2p1 - i2; 58 | i4 = i3 + 1; 59 | if ( i == 0 ) { 60 | h1r = c1*(x[i1] + xr ); 61 | h1i = c1*(x[i2] - xi ); 62 | h2r = -c2*(x[i2] + xi ); 63 | h2i = c2*(x[i1] - xr ); 64 | x[i1] = h1r + wr*h2r - wi*h2i; 65 | x[i2] = h1i + wr*h2i + wi*h2r; 66 | xr = h1r - wr*h2r + wi*h2i; 67 | xi = -h1i + wr*h2i + wi*h2r; 68 | } else { 69 | h1r = c1*(x[i1] + x[i3] ); 70 | h1i = c1*(x[i2] - x[i4] ); 71 | h2r = -c2*(x[i2] + x[i4] ); 72 | h2i = c2*(x[i1] - x[i3] ); 73 | x[i1] = h1r + wr*h2r - wi*h2i; 74 | x[i2] = h1i + wr*h2i + wi*h2r; 75 | x[i3] = h1r - wr*h2r + wi*h2i; 76 | x[i4] = -h1i + wr*h2i + wi*h2r; 77 | } 78 | wr = (temp = wr)*wpr - wi*wpi + wr; 79 | wi = wi*wpr + temp*wpi + wi; 80 | } 81 | if ( forward ) 82 | x[1] = xr; 83 | else 84 | lpp_cfft( x, N, forward ); 85 | } 86 | 87 | /* cfft replaces t_float array x containing NC complex values 88 | (2*NC t_float values alternating real, imagininary, etc.) 89 | by its Fourier transform if forward is true, or by its 90 | inverse Fourier transform if forward is false, using a 91 | recursive Fast Fourier transform method due to Danielson 92 | and Lanczos. NC MUST be a power of 2. */ 93 | 94 | void lpp_cfft( t_float *x, int NC, int forward ) 95 | 96 | { 97 | t_float wr,wi, 98 | wpr,wpi, 99 | theta, 100 | scale; 101 | int mmax, 102 | ND, 103 | m, 104 | i,j, 105 | delta; 106 | 107 | // void bitreverse(); 108 | 109 | ND = NC<<1; 110 | lpp_bitreverse( x, ND ); 111 | for ( mmax = 2; mmax < ND; mmax = delta ) { 112 | delta = mmax<<1; 113 | theta = TWOPI/( forward? mmax : -mmax ); 114 | wpr = -2.*pow( sin( 0.5*theta ), 2. ); 115 | wpi = sin( theta ); 116 | wr = 1.; 117 | wi = 0.; 118 | for ( m = 0; m < mmax; m += 2 ) { 119 | register t_float rtemp, itemp; 120 | for ( i = m; i < ND; i += delta ) { 121 | j = i + mmax; 122 | rtemp = wr*x[j] - wi*x[j+1]; 123 | itemp = wr*x[j+1] + wi*x[j]; 124 | x[j] = x[i] - rtemp; 125 | x[j+1] = x[i+1] - itemp; 126 | x[i] += rtemp; 127 | x[i+1] += itemp; 128 | } 129 | wr = (rtemp = wr)*wpr - wi*wpi + wr; 130 | wi = wi*wpr + rtemp*wpi + wi; 131 | } 132 | } 133 | 134 | /* scale output */ 135 | 136 | scale = forward ? 1./ND : 2.; 137 | { register t_float *xi=x, *xe=x+ND; 138 | while ( xi < xe ) 139 | *xi++ *= scale; 140 | } 141 | } 142 | 143 | /* bitreverse places t_float array x containing N/2 complex values 144 | into bit-reversed order */ 145 | 146 | void lpp_bitreverse( t_float *x, int N ) 147 | 148 | { 149 | t_float rtemp,itemp; 150 | int i,j, 151 | m; 152 | 153 | for ( i = j = 0; i < N; i += 2, j += m ) { 154 | if ( j > i ) { 155 | rtemp = x[j]; itemp = x[j+1]; /* complex exchange */ 156 | x[j] = x[i]; x[j+1] = x[i+1]; 157 | x[i] = rtemp; x[i+1] = itemp; 158 | } 159 | for ( m = N>>1; m >= 2 && j >= m; m >>= 1 ) 160 | j -= m; 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /phasemod~.c: -------------------------------------------------------------------------------- 1 | #include "MSPd.h" 2 | #define FUNC_LEN (32768) 3 | #define OBJECT_NAME "phasemod~" 4 | 5 | 6 | static t_class *phasemod_class; 7 | 8 | 9 | typedef struct _phasemod 10 | { 11 | 12 | t_object x_obj; 13 | t_float x_f; 14 | t_float x_val; 15 | t_float mygain; 16 | t_float *wavetab; 17 | t_float phs; 18 | t_float bendphs; 19 | t_float frequency; 20 | t_float alpha; 21 | short mute; 22 | short connections[4]; 23 | t_float si_fac; 24 | t_float sr; 25 | } t_phasemod; 26 | 27 | static void *phasemod_new(t_symbol *s, int argc, t_atom *argv); 28 | static t_int *phasemod_perform(t_int *w); 29 | static void phasemod_mute(t_phasemod *x, t_floatarg toggle); 30 | static void phasemod_dsp(t_phasemod *x, t_signal **sp); 31 | static void phasemod_dsp_free(t_phasemod *x); 32 | 33 | void phasemod_tilde_setup(void) { 34 | phasemod_class = class_new(gensym("phasemod~"), (t_newmethod)phasemod_new, 35 | (t_method)phasemod_dsp_free,sizeof(t_phasemod), 0,A_GIMME,0); 36 | CLASS_MAINSIGNALIN(phasemod_class, t_phasemod, x_f); 37 | class_addmethod(phasemod_class,(t_method)phasemod_dsp, gensym("dsp"), A_CANT, 0); 38 | class_addmethod(phasemod_class,(t_method)phasemod_mute,gensym("mute"),A_FLOAT,0); 39 | potpourri_announce(OBJECT_NAME); 40 | } 41 | 42 | void phasemod_dsp_free( t_phasemod *x ) 43 | { 44 | freebytes(x->wavetab, FUNC_LEN * sizeof(t_float)); 45 | } 46 | 47 | void phasemod_mute(t_phasemod *x, t_floatarg toggle) 48 | { 49 | x->mute = toggle; 50 | } 51 | void phasemod_assist (t_phasemod *x, void *b, long msg, long arg, char *dst) 52 | { 53 | if (msg==1) { 54 | switch (arg) { 55 | case 0: 56 | sprintf(dst,"(signal/t_float) Frequency "); 57 | break; 58 | case 1: 59 | sprintf(dst,"(signal/t_float) Slope Factor "); 60 | break; 61 | } 62 | } else if (msg==2) { 63 | sprintf(dst,"(signal) Output "); 64 | } 65 | } 66 | 67 | void *phasemod_new(t_symbol *s, int argc, t_atom *argv) 68 | { 69 | int i; 70 | t_phasemod *x = (t_phasemod *)pd_new(phasemod_class); 71 | inlet_new(&x->x_obj, &x->x_obj.ob_pd,gensym("signal"), gensym("signal")); 72 | outlet_new(&x->x_obj, gensym("signal")); 73 | x->phs = 0; 74 | x->mute = 0; 75 | x->frequency = 440.0; 76 | 77 | x->wavetab = (t_float *) getbytes(FUNC_LEN * sizeof(t_float)); 78 | for( i = 0 ; i < FUNC_LEN; i++ ) { 79 | x->wavetab[i] = sin( TWOPI * ((t_float)i/(t_float) FUNC_LEN)) ; 80 | } 81 | x->bendphs = 0; 82 | x->sr = sys_getsr(); 83 | if(!x->sr) 84 | x->sr = 44100.0; 85 | x->si_fac = 1.0/x->sr; 86 | return (x); 87 | } 88 | 89 | t_int *phasemod_perform(t_int *w) 90 | { 91 | 92 | t_float phs; 93 | 94 | t_phasemod *x = (t_phasemod *) (w[1]); 95 | t_float *frequency_vec = (t_float *)(w[2]); 96 | t_float *alpha_vec = (t_float *)(w[3]); 97 | t_float *out = (t_float *)(w[4]); 98 | int n = (int) w[5]; 99 | 100 | short *connections = x->connections; 101 | t_float bendphs = x->bendphs; 102 | t_float *wavetab = x->wavetab; 103 | t_float si_fac = x->si_fac; 104 | 105 | t_float incr = x->frequency * si_fac ; 106 | t_float alpha = x->alpha; 107 | 108 | if( x->mute ) { 109 | while(n--) { 110 | *out++ = 0.0; 111 | } 112 | return (w + 6); 113 | } 114 | 115 | while (n--) { 116 | if( connections[1] ) { 117 | alpha = *alpha_vec++; 118 | } 119 | if( alpha == 0 ) { 120 | alpha = .000001; 121 | } 122 | 123 | if( connections[0] ) { 124 | incr = *frequency_vec++ * si_fac ; 125 | } 126 | // NO NEGATIVE FREQUENCIES 127 | if( incr < 0 ) 128 | incr = -incr; 129 | 130 | bendphs += incr ; 131 | while( bendphs > 1.0 ) 132 | bendphs -= 1.0 ; 133 | phs = FUNC_LEN * ( (1 - exp(bendphs * alpha))/(1 - exp(alpha)) ); 134 | 135 | while( phs < 0.0 ) { 136 | phs += FUNC_LEN; 137 | } 138 | while( phs >= FUNC_LEN ) { 139 | phs -= FUNC_LEN; 140 | } 141 | *out++ = wavetab[(int) phs] ; 142 | } 143 | 144 | x->bendphs = bendphs; 145 | return (w+6); 146 | } 147 | 148 | void phasemod_dsp(t_phasemod *x, t_signal **sp) 149 | { 150 | 151 | x->connections[0] = 1; 152 | x->connections[1] = 1; 153 | 154 | if(x->sr != sp[0]->s_sr) { 155 | if(!sp[0]->s_sr) { 156 | pd_error(0, "zero sampling rate"); 157 | return; 158 | } 159 | x->sr = sp[0]->s_sr; 160 | x->si_fac = 1.0/x->sr; 161 | } 162 | dsp_add(phasemod_perform, 5, x, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, (t_int)sp[0]->s_n); 163 | } 164 | -------------------------------------------------------------------------------- /epluribus~.c: -------------------------------------------------------------------------------- 1 | #include "MSPd.h" 2 | 3 | static t_class *epluribus_class; 4 | 5 | #define MAXBEATS (256) 6 | #define OBJECT_NAME "epluribus~" 7 | #define COMPILE_DATE "5.3.08" 8 | #define OBJECT_VERSION "2.0" 9 | 10 | typedef struct _epluribus 11 | { 12 | t_object x_obj; 13 | t_float x_f; 14 | int incount; // how many inlets (must be at least 2) 15 | short inverse; // flag to look for minimum instead 16 | } t_epluribus; 17 | 18 | static void *epluribus_new(t_symbol *msg, int argc, t_atom *argv); 19 | static t_int *epluribus_perform(t_int *w); 20 | static void epluribus_dsp(t_epluribus *x, t_signal **sp); 21 | static void epluribus_inverse(t_epluribus *x, t_floatarg tog); 22 | 23 | void epluribus_tilde_setup(void) 24 | { 25 | t_class *c; 26 | c = class_new(gensym("epluribus~"), (t_newmethod)epluribus_new, 27 | 0,sizeof(t_epluribus), 0,A_GIMME,0); 28 | CLASS_MAINSIGNALIN(c, t_epluribus, x_f); 29 | class_addmethod(c, (t_method)epluribus_dsp, gensym("dsp"), A_CANT, 0); 30 | class_addmethod(c, (t_method)epluribus_inverse, gensym("inverse"),A_FLOAT, 0); 31 | epluribus_class = c; 32 | potpourri_announce(OBJECT_NAME); 33 | } 34 | 35 | void epluribus_inverse(t_epluribus *x, t_floatarg tog) 36 | { 37 | x->inverse = (short) tog; 38 | } 39 | 40 | 41 | void *epluribus_new(t_symbol *msg, int argc, t_atom *argv) 42 | { 43 | t_epluribus *x; 44 | int i; 45 | x = (t_epluribus *)pd_new(epluribus_class); 46 | x->incount = (int) atom_getfloatarg(0,argc,argv); 47 | for(i = 0; i < x->incount - 1; i++) { 48 | inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("signal"),gensym("signal")); 49 | } 50 | outlet_new(&x->x_obj, gensym("signal")); 51 | outlet_new(&x->x_obj, gensym("signal")); 52 | if(x->incount < 2 || x->incount > 256 ) { 53 | pd_error(0, "%s: there must be between 2 and 256 input vectors", OBJECT_NAME); 54 | return (NULL); 55 | } 56 | x->inverse = 0; // by default don't do inverse behaviour 57 | return (x); 58 | } 59 | 60 | 61 | t_int *epluribus_perform(t_int *w) 62 | { 63 | int i,j,k; 64 | t_epluribus *x = (t_epluribus *) (w[1]); 65 | t_float *inlet; 66 | t_float *outlet; 67 | t_float *selection; 68 | int n; 69 | t_float maxamp = 0.0; 70 | t_float maxout = 0.0; 71 | int maxloc; 72 | int incount = x->incount; 73 | int next_pointer = incount + 5; 74 | 75 | outlet = (t_float *) w[incount + 2]; 76 | selection = (t_float *) w[incount + 3]; 77 | n = (int) w[incount + 4]; 78 | 79 | if( x->inverse ) { 80 | for(k = 0; k < n; k ++ ) { 81 | maxamp = 99999999.0; 82 | maxloc = 0; 83 | for(i = 0, j=2; i < incount ; i++, j++) { 84 | inlet = (t_float *) (w[j]); 85 | if( maxamp > fabs( inlet[k] ) ) { 86 | maxamp = fabs( inlet[k] ); 87 | maxout = inlet[k]; // don't actually change signal 88 | maxloc = i + 1; // record location of max amp 89 | } 90 | } 91 | outlet[k] = maxout; 92 | selection[k] = maxloc; 93 | } 94 | } 95 | else { 96 | for(k = 0; k < n; k ++ ) { 97 | maxamp = 0.0; 98 | maxloc = 0; 99 | for(i = 0, j=2; i < incount ; i++, j++) { 100 | inlet = (t_float *) (w[j]); 101 | if( maxamp < fabs( inlet[k] ) ) { 102 | maxamp = fabs( inlet[k] ); 103 | maxout = inlet[k]; // don't actually change signal 104 | maxloc = i + 1; // record location of max amp 105 | } 106 | } 107 | outlet[k] = maxout; 108 | selection[k] = maxloc; 109 | } 110 | } 111 | 112 | return w + next_pointer; 113 | } 114 | 115 | 116 | void epluribus_dsp(t_epluribus *x, t_signal **sp) 117 | { 118 | long i; 119 | t_int **sigvec; 120 | int pointer_count; 121 | 122 | 123 | if( x->incount < 2 || x->incount > 256 ) { 124 | post("bad vector count"); 125 | return; 126 | } 127 | pointer_count = x->incount + 4; // all metros, plus 2 outlets, plus the object pointer, plus N 128 | 129 | sigvec = (t_int **) getbytes(pointer_count * sizeof(t_int *)); 130 | for(i = 0; i < pointer_count; i++) { 131 | sigvec[i] = (t_int *) getbytes(sizeof(t_int) * 1); 132 | } 133 | sigvec[0] = (t_int *)x; // first pointer is to the object 134 | 135 | sigvec[pointer_count - 1] = (t_int *)sp[0]->s_n; // last pointer is to vector size (N) 136 | 137 | for(i = 1; i < pointer_count - 1; i++){ // now attach the inlet and all outlets 138 | sigvec[i] = (t_int *)sp[i-1]->s_vec; 139 | } 140 | 141 | dsp_addv(epluribus_perform, pointer_count, (t_int *) sigvec); 142 | freebytes(sigvec, pointer_count * sizeof(t_int *)); 143 | 144 | } 145 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LyonPotpourri 3.0 2 | 3 | LyonPotpourri is a collection of externals developed for the creation and performance of computer music. The externals were originally developed for Max/MSP, and then extended into hybrid code that could compile for both Max/MSP and Pd. As of version 3.0, the code bases of Max/MSP and Pd have diverged to such an extent that I decided to split the LyonPotpourri code into separate Pd and Max/MSP versions. 4 | 5 | The Pd platform tends toward minimalism. Therefore, it is particularly advantageous for Pd users to become adept at designing their own externals. It is hoped that in addition to the utility of specific externals in this collection, the source code will be helpful for computer musicians who wish to learn how to write their own externals. For further guidance on that subject, please see my book “Designing Audio Objects for Max/MSP and Pd.” 6 | 7 | LyonPotpourri is Copyright Eric Lyon, 1999-2023, and is covered under the MIT license. Please see the accompanying License file for details. 8 | 9 | 10 | **Object Listing** 11 | 12 | - adsr~ a simple ADSR envelope that can be click triggered 13 | - arrayfilt~ fft-based filtering by drawing into an array 14 | - bashfest~ a click driven buffer player with randomized DSP 15 | - buffet~ provides operations on a stored buffer 16 | - bvplay~ selective playback from a stored buffer with enveloping and increment control 17 | - cartopol~ convert a spectral frame from cartesian to polar form 18 | - chameleon~ an oracular sound processor 19 | - channel~ access to a precise address in the signal vector 20 | - chopper~ munging loop playback from a buffer 21 | - clean_selector~ like selector~ but crossfades when switching channels 22 | - click~ converts a bang to a click 23 | - click2bang~ converts a signal click to a bang message 24 | - click2float~ translates a signal click to a float message 25 | - clickhold~ sample and hold a click 26 | - convolver~ non-real-time convolution with impulses of arbitrary size 27 | - distortion~ lookup function distortion 28 | - dmach~ pattern based sample accurate drum machine prototype 29 | - epluribus~ combine several signal inputs to a single output based on min or max sample value 30 | - expflam~ converts a click to an exponential flam click pattern 31 | - flanjah~ simple flanger 32 | - function~ write various functions into an array 33 | - granola~ granular pitch scaling 34 | - granule~ granular synthesis module reading from a stored waveform in a buffer 35 | - granulesf~ granular synthesis module reading from a soundfile in a buffer 36 | - kbuffer~ low sampling rate buffer to capture gestures 37 | - killdc~ DC block filter 38 | - latch~ sustain an incoming click with sample-accurate timing 39 | - magfreq_analysis~ transforms a time domain signal to a magnitude/frequency spectrum 40 | - markov~ implements a first order Markov chain 41 | - mask~ a click driven pattern sequencer 42 | - npan~ power-panning to an arbitrary number of output channels 43 | - oscil~ oscillator with flexible waveform specification 44 | - phasemod~ phase modulated waveform 45 | - player~ click driven buffer player that can sustain multiple iterations 46 | - poltocar~ convert spectral frame from polar to complex representation 47 | - pulser~ pulse wave generated by additive synthesis 48 | - quadpan~ pan an incoming sound within a quadraphonic plane 49 | - rotapan~ rotate an array of input channels to the same number of output channels 50 | - rtrig~ generates random click triggers 51 | - samm~ sample accurate multiple metronomes, with click signal articulation 52 | - sarec~ sample accurate recording 53 | - sel~ sample-accurate implementation of the sel algorithm 54 | - shoehorn~ collapse from a larger number to a smaller number of audio channels 55 | - sigseq~ signal level numerical sequencer 56 | - splitbank~ - split an incoming sound into complementary, independently tunable spectra 57 | - splitspec~ split an incoming sound into complementary spectra 58 | - squash~ implementation of a compression algorithm by Christopher Penrose 59 | - stutter~ stuttering playback from an array 60 | - vdb~ a delay line using an array for storage (no vector limit on feedback delaytime) 61 | - vdp~ a simple, self-contained delay unit 62 | - vecdex~ outputs the sample index within the current signal vector 63 | - waveshape~ a Chebychev function lookup waveshaper 64 | - windowvec~ apply a Hann window to the input signal vector 65 | 66 | This release of LyonPotpourri was updated with assistance in coding, testing, and building from @Lucarda, @porres, and @umlaeute. 67 | 68 | Eric Lyon 69 | ericlyon@vt.edu 70 | School of Performing Arts | Music 71 | Institute for Creativity, Arts, and Technology 72 | Virginia Tech 73 | 74 | March 16, 2021 75 | -------------------------------------------------------------------------------- /rotapan~.c: -------------------------------------------------------------------------------- 1 | #include "MSPd.h" 2 | 3 | static t_class *rotapan_class; 4 | 5 | #define OBJECT_NAME "rotapan~" 6 | 7 | /* Pd version of rotapan~ */ 8 | 9 | typedef struct _rotapan 10 | { 11 | t_object x_obj; 12 | t_float x_f; 13 | t_double sr; 14 | long rchans; 15 | double pio2; 16 | t_float *inarr; 17 | t_float **ins; // array of input signal vectors 18 | t_float **outs; // array of output signal vectors 19 | } t_rotapan; 20 | 21 | 22 | static void *rotapan_new(t_symbol *s, int argc, t_atom *argv); 23 | static void rotapan_free(t_rotapan *x); 24 | //static void rotapan_assist(t_rotapan *x, void *b, long msg, long arg, char *dst); 25 | //static void rotapan_version(t_rotapan *x); 26 | static void rotapan_dsp(t_rotapan *x, t_signal **sp); 27 | static t_int *rotapan_perform(t_int *w); 28 | 29 | void rotapan_tilde_setup(void) { 30 | rotapan_class = class_new(gensym("rotapan~"), (t_newmethod)rotapan_new, 31 | (t_method)rotapan_free, sizeof(t_rotapan),0,A_GIMME,0); 32 | CLASS_MAINSIGNALIN(rotapan_class, t_rotapan, x_f); 33 | class_addmethod(rotapan_class, (t_method)rotapan_dsp, gensym("dsp"), A_CANT, 0); 34 | potpourri_announce(OBJECT_NAME); 35 | } 36 | 37 | void *rotapan_new(t_symbol *s, int argc, t_atom *argv) 38 | { 39 | int i; 40 | 41 | t_rotapan *x = (t_rotapan *)pd_new(rotapan_class); 42 | x->rchans = (long) atom_getfloatarg(0,argc,argv); 43 | if(x->rchans < 2){ 44 | x->rchans = 2; 45 | } 46 | /* allocate in chans plus 1 for controlling the pan */ 47 | for(i = 0; i < x->rchans; i++) { 48 | inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("signal"),gensym("signal")); 49 | } 50 | for(i=0; i < x->rchans; i++) { 51 | outlet_new(&x->x_obj, gensym("signal")); 52 | } 53 | x->pio2 = PI / 2.0; 54 | x->inarr = (t_float *) getbytes((x->rchans + 1) * sizeof(t_float)); 55 | // for better compatibility with Max 6 56 | x->ins = (t_float **) getbytes((x->rchans + 1) * sizeof(t_float *)); 57 | x->outs = (t_float **) getbytes(x->rchans * sizeof(t_float *)); 58 | for(i = 0; i < x->rchans + 1; i++) { 59 | x->ins[i] = (t_float *) getbytes(8192 * sizeof(t_float)); 60 | } 61 | return x; 62 | } 63 | 64 | void rotapan_free(t_rotapan *x) 65 | { 66 | int i; 67 | for(i = 0; i < x->rchans + 1; i++) { 68 | freebytes(x->ins[i],8192 * sizeof(t_float)); 69 | } 70 | freebytes(x->ins,(x->rchans + 1) * sizeof(t_float *)); 71 | freebytes(x->outs,x->rchans * sizeof(t_float *)); 72 | freebytes(x->inarr, (x->rchans + 1) * sizeof(t_float)); 73 | } 74 | 75 | // try copying all vectors first!!! 76 | 77 | t_int *rotapan_perform(t_int *w) 78 | { 79 | t_rotapan *x = (t_rotapan*) w[1]; 80 | t_float *invec; 81 | long rchans = x->rchans; 82 | t_double pio2 = x->pio2; 83 | t_float *inarr = x->inarr; 84 | t_float **ins = x->ins; 85 | t_float **outs = x->outs; 86 | double amp1, amp2; 87 | double panloc; 88 | double scaledIndex; 89 | int chan,i,j; 90 | int offset; 91 | 92 | int n = (int) w[(rchans * 2) + 3]; 93 | 94 | // copy input vectors 95 | for(i = 0; i < rchans + 1; i++) { 96 | invec = (t_float *) w[2 + i]; 97 | for(j = 0; j < n; j++) { 98 | ins[i][j] = invec[j]; 99 | } 100 | } 101 | 102 | // assign output vector pointers 103 | for(i = 0; i < rchans; i++) { 104 | outs[i] = (t_float *) w[3 + rchans + i]; 105 | } 106 | 107 | for( j = 0; j < n; j++) { 108 | for(chan = 0; chan < rchans; chan++) { 109 | inarr[chan] = ins[chan][j]; 110 | outs[chan][j] = 0; 111 | } 112 | scaledIndex = ins[rchans][j] * (double) rchans; 113 | if(scaledIndex < 0.0 || scaledIndex > rchans) 114 | scaledIndex = 0.0; 115 | 116 | offset = (int) floor(scaledIndex) % rchans; 117 | panloc = (scaledIndex - offset) * pio2; 118 | 119 | amp1 = cos( panloc ); 120 | amp2 = sin( panloc ); 121 | 122 | for(chan = 0; chan < rchans; chan++) { 123 | outs[(chan+offset)%rchans][j] += amp1 * inarr[chan]; 124 | outs[(chan+offset+1)%rchans][j] += amp2 * inarr[chan]; 125 | } 126 | } 127 | return (w + (rchans * 2) + 4); 128 | } 129 | 130 | void rotapan_dsp(t_rotapan *x, t_signal **sp) 131 | { 132 | long i; 133 | t_int **sigvec; 134 | int pointer_count = (x->rchans * 2) + 3; // input/output chans + object + panner + vectorsize 135 | sigvec = (t_int **) getbytes(pointer_count * sizeof(t_int *)); 136 | for(i = 0; i < pointer_count; i++) { 137 | sigvec[i] = (t_int *) getbytes(sizeof(t_int) * 1); 138 | } 139 | sigvec[0] = (t_int *)x; // first pointer is to the object 140 | sigvec[pointer_count - 1] = (t_int *)sp[0]->s_n; // last pointer is to vector size (N) 141 | for(i = 1; i < pointer_count - 1; i++){ // now attach the inlet and all outlets 142 | sigvec[i] = (t_int *)sp[i-1]->s_vec; 143 | } 144 | dsp_addv(rotapan_perform, pointer_count, (t_int *)sigvec); 145 | freebytes(sigvec,sizeof(t_int) * 1); 146 | } 147 | -------------------------------------------------------------------------------- /waveshape~.c: -------------------------------------------------------------------------------- 1 | #include "MSPd.h" 2 | 3 | #define OBJECT_NAME "waveshape~" 4 | 5 | #define ws_MAXHARMS (256) 6 | 7 | 8 | static t_class *waveshape_class; 9 | 10 | typedef struct _waveshape 11 | { 12 | 13 | t_object x_obj; 14 | t_float x_f; 15 | int flen; 16 | t_float *wavetab; 17 | t_float *tempeh; // work function 18 | int hcount; 19 | t_float *harms; 20 | short mute; 21 | } t_waveshape; 22 | 23 | static void *waveshape_new(void); 24 | static t_int *waveshape_perform(t_int *w); 25 | static void waveshape_dsp(t_waveshape *x, t_signal **sp); 26 | static void waveshape_list (t_waveshape *x, t_symbol *msg, int argc, t_atom *argv); 27 | static void update_waveshape_function( t_waveshape *x ); 28 | //t_float mapp(); 29 | static void waveshape_mute(t_waveshape *x, t_floatarg tog); 30 | static void waveshape_free(t_waveshape *x); 31 | 32 | 33 | void waveshape_tilde_setup(void) { 34 | waveshape_class = class_new(gensym("waveshape~"), (t_newmethod)waveshape_new, 35 | (t_method)waveshape_free,sizeof(t_waveshape), 0,0); 36 | CLASS_MAINSIGNALIN(waveshape_class, t_waveshape, x_f); 37 | class_addmethod(waveshape_class,(t_method)waveshape_dsp, gensym("dsp"), A_CANT, 0); 38 | class_addmethod(waveshape_class,(t_method)waveshape_mute,gensym("mute"),A_FLOAT,0); 39 | class_addmethod(waveshape_class,(t_method)waveshape_list,gensym("list"),A_GIMME,0); 40 | potpourri_announce(OBJECT_NAME); 41 | } 42 | 43 | 44 | void waveshape_free(t_waveshape *x) 45 | { 46 | freebytes(x->wavetab, x->flen * sizeof(t_float)); 47 | freebytes(x->tempeh, x->flen * sizeof(t_float)); 48 | freebytes(x->harms, ws_MAXHARMS * sizeof(t_float)); 49 | } 50 | 51 | 52 | void waveshape_list (t_waveshape *x, t_symbol *msg, int argc, t_atom *argv) 53 | { 54 | short i; 55 | // t_symbol *fraud; 56 | // fraud = msg; 57 | x->hcount = 0; 58 | for (i=0; i < argc; i++) { 59 | if (argv[i].a_type == A_FLOAT) { 60 | x->harms[ x->hcount ] = argv[i].a_w.w_float; 61 | ++(x->hcount); 62 | } 63 | } 64 | update_waveshape_function( x ); 65 | 66 | } 67 | 68 | void waveshape_mute(t_waveshape *x, t_floatarg tog) 69 | { 70 | x->mute = tog; 71 | } 72 | 73 | void *waveshape_new(void) 74 | { 75 | t_waveshape *x = (t_waveshape *)pd_new(waveshape_class); 76 | long i; 77 | outlet_new(&x->x_obj, gensym("signal")); 78 | 79 | x->flen = 65536; 80 | x->wavetab = (t_float *) getbytes(x->flen * sizeof(t_float)); 81 | x->tempeh = (t_float *) getbytes(x->flen * sizeof(t_float)); 82 | x->harms = (t_float *) getbytes(ws_MAXHARMS * sizeof(t_float)); 83 | 84 | x->hcount = 4; 85 | x->harms[0] = 0; 86 | x->harms[1] = .33; 87 | x->harms[2] = .33; 88 | x->harms[3] = .33; 89 | x->mute = 0; 90 | update_waveshape_function(x); 91 | return x; 92 | } 93 | 94 | void update_waveshape_function( t_waveshape *x ) { 95 | t_float point; 96 | int i, j; 97 | t_float min, max; 98 | for( i = 0; i < x->flen; i++ ) { 99 | x->tempeh[i] = 0; 100 | } 101 | for( i = 0 ; i < x->hcount; i++ ) { 102 | if( x->harms[i] > 0.0 ) { 103 | for( j = 0; j < x->flen; j++ ) { 104 | point = -1.0 + 2.0 * ( (t_float) j / (t_float) x->flen) ; 105 | x->tempeh[j] += x->harms[i] * cos( (t_float) i * acos( point ) ); 106 | } 107 | } 108 | } 109 | min = 1; max = -1; 110 | for( j = 0; j < x->flen; j++ ) { 111 | if( min > x->tempeh[j] ) 112 | min = x->tempeh[j]; 113 | if( max < x->tempeh[j] ) 114 | max = x->tempeh[j]; 115 | } 116 | // post("min:%f, max:%f",min,max); 117 | // normalize from -1 to +1 118 | if( (max - min) == 0 ) { 119 | post("all zero function - watch out!"); 120 | return; 121 | } 122 | for( j = 0; j < x->flen; j++ ) { 123 | x->tempeh[j] = -1.0 + ( (x->tempeh[j] - min) / (max - min) ) * 2.0 ; 124 | } 125 | // put tempeh into waveshape function 126 | for( j = 0; j < x->flen; j++ ) { 127 | x->wavetab[j] = x->tempeh[j]; 128 | } 129 | } 130 | 131 | t_int *waveshape_perform(t_int *w) 132 | { 133 | t_float insamp; // , waveshape, ingain ; 134 | int windex ; 135 | 136 | t_waveshape *x = (t_waveshape *) (w[1]); 137 | t_float *in = (t_float *)(w[2]); 138 | t_float *out = (t_float *)(w[3]); 139 | int n = (int) w[4]; 140 | int flenm1 = x->flen - 1; 141 | t_float *wavetab = x->wavetab; 142 | 143 | if(x->mute) { 144 | while(n--) { 145 | *out++ = 0.0; 146 | } 147 | return w+5; 148 | } 149 | 150 | while (n--) { 151 | insamp = *in++; 152 | if(insamp > 1.0) { 153 | insamp = 1.0; 154 | } 155 | else if(insamp < -1.0) { 156 | insamp = -1.0; 157 | } 158 | windex = ((insamp + 1.0)/2.0) * (t_float)flenm1 ; 159 | *out++ = wavetab[windex] ; 160 | } 161 | 162 | return (w+5); 163 | } 164 | 165 | void waveshape_dsp(t_waveshape *x, t_signal **sp) 166 | { 167 | dsp_add(waveshape_perform, 4, x, sp[0]->s_vec,sp[1]->s_vec,(t_int)sp[0]->s_n); 168 | } 169 | -------------------------------------------------------------------------------- /convolver~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 455 62 802 761 12; 2 | #N canvas 0 22 450 300 (subpatch) 0; 3 | #X array cdemo_impulse 220500 float 2; 4 | #X coords 0 1 220500 -1 200 100 1 0 0; 5 | #X restore 32 134 graph; 6 | #N canvas 0 22 450 300 (subpatch) 0; 7 | #X array cdemo_source 62079 float 2; 8 | #X coords 0 1 62079 -1 200 100 1 0 0; 9 | #X restore 32 253 graph; 10 | #N canvas 0 22 450 300 (subpatch) 0; 11 | #X array cdemo_dest 661500 float 2; 12 | #X coords 0 1 661500 -1 200 100 1 0 0; 13 | #X restore 32 372 graph; 14 | #X obj 280 342 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 15 | -1 -1; 16 | #X obj 280 289 r convo_demo_msg; 17 | #X msg 39 714 convolve; 18 | #X obj 535 449 tabplay~ cdemo_dest; 19 | #X obj 535 425 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 20 | -1 -1; 21 | #X msg 36 495 bang; 22 | #X obj 39 735 s convo_demo_msg; 23 | #X text 299 343 operation completion bang; 24 | #X msg 36 567 bang; 25 | #X text 34 627 ... or build a synthetic impulse; 26 | #N canvas 600 60 450 300 sound-source 0; 27 | #X obj 104 88 soundfiler; 28 | #X obj 104 52 openpanel; 29 | #X msg 104 70 read -resize \$1 cdemo_source; 30 | #X obj 104 34 inlet; 31 | #X connect 1 0 2 0; 32 | #X connect 2 0 0 0; 33 | #X connect 3 0 1 0; 34 | #X restore 36 519 pd sound-source; 35 | #X obj 280 319 lyonpotpourri/convolver~ cdemo_source cdemo_impulse 36 | cdemo_dest, f 62; 37 | #X obj 30 19 lpp-icon convolver~; 38 | #X text 247 46 - non-real-time convolution; 39 | #N canvas 600 60 1141 484 build_synthetic_impulse 0; 40 | #X obj 121 403 s convo_demo_msg; 41 | #X msg 121 142 noiseimp \$1; 42 | #X floatatom 121 94 5 0 0 0 - - -; 43 | #X msg 209 356 spikeimp \$1; 44 | #X floatatom 209 328 5 0 0 0 - - -; 45 | #X obj 735 421 array size cdemo_impulse; 46 | #X obj 735 376 *; 47 | #X obj 825 318 samplerate~; 48 | #X floatatom 826 344 5 0 0 0 - - -; 49 | #X obj 735 216 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 50 | -1 -1; 51 | #X msg 735 322 20; 52 | #X msg 923 318 \; cdemo_impulse const 0; 53 | #X obj 735 266 t b b b; 54 | #X text 579 323 new length in seconds:; 55 | #X text 767 217 resize impulse array length; 56 | #X text 214 120 parameter is slope (negative values produce convex 57 | impulse shapes \; positive slopes produce concave impulse shapes. Larger 58 | values give more extreme results.); 59 | #X text 262 287 parameter is density of spikes per second \; slope 60 | is fixed; 61 | #X text 184 85 produce a smooth \, decaying \, white noise impulse 62 | ; 63 | #X msg 121 55 -3; 64 | #X msg 160 293 50; 65 | #X msg 209 293 6; 66 | #X text 157 248 produce a spiky impulse \, which may sound more like 67 | lots of echos \, rather than reverberation; 68 | #X connect 1 0 0 0; 69 | #X connect 2 0 1 0; 70 | #X connect 3 0 0 0; 71 | #X connect 4 0 3 0; 72 | #X connect 6 0 5 0; 73 | #X connect 7 0 8 0; 74 | #X connect 8 0 6 1; 75 | #X connect 9 0 12 0; 76 | #X connect 10 0 6 0; 77 | #X connect 12 0 10 0; 78 | #X connect 12 1 7 0; 79 | #X connect 12 2 11 0; 80 | #X connect 18 0 2 0; 81 | #X connect 19 0 4 0; 82 | #X connect 20 0 4 0; 83 | #X restore 37 652 pd build_synthetic_impulse; 84 | #X obj 535 567 lpp-meters; 85 | #X text 77 496 1 find a soundfile to convolve (or use pre-loaded default) 86 | ; 87 | #X text 75 568 2 find an impulse response (or use generated default) 88 | ; 89 | #X text 37 694 3 perform convolution; 90 | #X text 554 425 4 play convolution result; 91 | #N canvas 600 60 588 436 init 0; 92 | #X obj 25 68 soundfiler; 93 | #X obj 25 25 loadbang; 94 | #X obj 26 167 s convo_demo_msg; 95 | #X msg 26 143 noiseimp -5; 96 | #X obj 26 118 loadbang; 97 | #X msg 25 46 read -resize sound/voice.wav cdemo_source; 98 | #X text 94 120 generate default impulse; 99 | #X text 96 27 default sound source to reverberate; 100 | #X obj 305 366 array size cdemo_impulse; 101 | #X obj 305 215 loadbang; 102 | #X obj 305 251 t b b; 103 | #X msg 305 287 5; 104 | #X obj 305 330 *; 105 | #X obj 354 277 samplerate~; 106 | #X floatatom 354 306 5 0 0 0 - - -; 107 | #X text 300 180 default to a 5-second impulse; 108 | #X obj 68 223 loadbang; 109 | #X obj 68 259 t b b; 110 | #X obj 68 338 *; 111 | #X obj 117 285 samplerate~; 112 | #X floatatom 117 314 5 0 0 0 - - -; 113 | #X obj 68 374 array size cdemo_dest; 114 | #X msg 68 295 15; 115 | #X text 39 204 allocate space for the reverb; 116 | #X connect 1 0 5 0; 117 | #X connect 3 0 2 0; 118 | #X connect 4 0 3 0; 119 | #X connect 5 0 0 0; 120 | #X connect 9 0 10 0; 121 | #X connect 10 0 11 0; 122 | #X connect 10 1 13 0; 123 | #X connect 11 0 12 0; 124 | #X connect 12 0 8 0; 125 | #X connect 13 0 14 0; 126 | #X connect 14 0 12 1; 127 | #X connect 16 0 17 0; 128 | #X connect 17 0 22 0; 129 | #X connect 17 1 19 0; 130 | #X connect 18 0 21 0; 131 | #X connect 19 0 20 0; 132 | #X connect 20 0 18 1; 133 | #X connect 22 0 18 0; 134 | #X restore 279 378 pd init; 135 | #X obj 535 480 lyonpotpourri/killdc~; 136 | #N canvas 600 60 373 220 impulse-source 0; 137 | #X obj 48 133 soundfiler; 138 | #X obj 48 77 openpanel; 139 | #X msg 48 105 read -resize \$1 cdemo_impulse; 140 | #X obj 48 49 inlet; 141 | #X connect 1 0 2 0; 142 | #X connect 2 0 0 0; 143 | #X connect 3 0 1 0; 144 | #X restore 36 595 pd impulse-source; 145 | #X connect 4 0 14 0; 146 | #X connect 5 0 9 0; 147 | #X connect 6 0 24 0; 148 | #X connect 7 0 6 0; 149 | #X connect 8 0 13 0; 150 | #X connect 11 0 25 0; 151 | #X connect 14 0 3 0; 152 | #X connect 24 0 18 0; 153 | #X connect 24 0 18 1; 154 | -------------------------------------------------------------------------------- /expflam~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 512 30 683 761 12; 2 | #N canvas 600 60 522 372 load-samples 0; 3 | #X obj 41 107 soundfiler; 4 | #X msg 41 39 bang; 5 | #X obj 41 65 openpanel; 6 | #X obj 154 29 loadbang; 7 | #X msg 41 87 read -resize \$1 expflam-drum; 8 | #X msg 154 54 read -resize sound/kick_11d.aiff expflam-drum; 9 | #X connect 1 0 2 0; 10 | #X connect 2 0 4 0; 11 | #X connect 3 0 5 0; 12 | #X connect 4 0 0 0; 13 | #X connect 5 0 0 0; 14 | #X restore 241 656 pd load-samples; 15 | #N canvas 0 22 450 300 (subpatch) 0; 16 | #X array expflam-drum 16884 float 2; 17 | #X coords 0 1 16884 -1 100 70 1; 18 | #X restore 240 540 graph; 19 | #X obj 102 428 loadbang; 20 | #X obj 45 265 r expflam-msg; 21 | #N canvas 461 254 635 324 expflam-controls 0; 22 | #X msg 25 198 bypass \$1; 23 | #X obj 25 173 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 24 | 1; 25 | #X obj 24 281 s expflam-msg; 26 | #X msg 151 264 setflam \$1 \$2 \$3 \$4 \$5; 27 | #X floatatom 150 184 5 0 0 0 - - -; 28 | #X floatatom 190 185 5 0 0 0 - - -; 29 | #X floatatom 231 185 5 0 0 0 - - -; 30 | #X floatatom 271 186 5 0 0 0 - - -; 31 | #X floatatom 312 186 5 0 0 0 - - -; 32 | #N canvas 600 60 454 304 pak 0; 33 | #X obj 63 60 inlet; 34 | #X obj 65 150 pack f f f f f; 35 | #X obj 112 59 inlet; 36 | #X obj 110 85 t b f; 37 | #X obj 167 54 inlet; 38 | #X obj 165 80 t b f; 39 | #X obj 216 53 inlet; 40 | #X obj 214 79 t b f; 41 | #X obj 267 53 inlet; 42 | #X obj 265 79 t b f; 43 | #X obj 68 184 outlet; 44 | #X connect 0 0 1 0; 45 | #X connect 1 0 10 0; 46 | #X connect 2 0 3 0; 47 | #X connect 3 0 1 0; 48 | #X connect 3 1 1 1; 49 | #X connect 4 0 5 0; 50 | #X connect 5 0 1 0; 51 | #X connect 5 1 1 2; 52 | #X connect 6 0 7 0; 53 | #X connect 7 0 1 0; 54 | #X connect 7 1 1 3; 55 | #X connect 8 0 9 0; 56 | #X connect 9 0 1 0; 57 | #X connect 9 1 1 4; 58 | #X restore 151 225 pd pak; 59 | #X obj 370 39 hsl 115 15 20 90 0 0 empty \$0-start-delay start-delay 60 | -2 -8 0 10 -162854 -1 -1 1899 1; 61 | #X obj 370 69 hsl 115 15 50 150 0 0 empty \$0-end-delay end-delay -2 62 | -8 0 10 -162854 -1 -1 8550 1; 63 | #X obj 371 101 hsl 115 15 3 32 0 0 empty \$0-attack-count attack-count 64 | -2 -8 0 10 -162854 -1 -1 6290 1; 65 | #X obj 231 160 int; 66 | #X obj 371 138 hsl 115 15 -6 6 0 0 empty \$0-slope slope -2 -8 0 10 67 | -162854 -1 -1 11400 1; 68 | #X obj 371 171 hsl 115 15 0.05 0.99 0 0 empty \$0-attenuation attenuation 69 | -2 -8 0 10 -162854 -1 -1 11194 1; 70 | #X obj 74 111 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 71 | 1; 72 | #X msg 74 136 flamall \$1; 73 | #X text 95 113 flam everything; 74 | #X text 41 169 flam nothing; 75 | #X connect 0 0 2 0; 76 | #X connect 1 0 0 0; 77 | #X connect 3 0 2 0; 78 | #X connect 4 0 9 0; 79 | #X connect 5 0 9 1; 80 | #X connect 6 0 9 2; 81 | #X connect 7 0 9 3; 82 | #X connect 8 0 9 4; 83 | #X connect 9 0 3 0; 84 | #X connect 10 0 4 0; 85 | #X connect 11 0 5 0; 86 | #X connect 12 0 13 0; 87 | #X connect 13 0 6 0; 88 | #X connect 14 0 7 0; 89 | #X connect 15 0 8 0; 90 | #X connect 16 0 17 0; 91 | #X connect 17 0 2 0; 92 | #X restore 241 631 pd expflam-controls; 93 | #X msg 102 453 static_increment 0; 94 | #X obj 241 430 sig~ 1; 95 | #X floatatom 242 411 5 0 0 0 - - -; 96 | #X obj 245 393 hsl 64 12 0.5 2.5 0 0 empty empty increment -2 -8 0 97 | 10 -244920 -1 -1 0 1; 98 | #X text 198 259 flam gate signal - flams only occur where a 1 in gate 99 | aligns with the attack pattern below; 100 | #X text 242 332 attack pattern; 101 | #X msg 190 205 tempo \$1; 102 | #X floatatom 190 186 5 20 200 0 - #0-tempo -; 103 | #X obj 190 299 lyonpotpourri/mask~ 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 104 | ; 105 | #X obj 76 349 lyonpotpourri/mask~ 1 0.5 0.5 0.5 1 0 0.5 0.5 1 0.5 1 106 | 0 0 0.5 1 0.125, f 70; 107 | #X obj 76 520 lpp-meters; 108 | #X obj 18 28 lpp-icon expflam~; 109 | #X obj 190 228 lyonpotpourri/samm~ 98 4; 110 | #N canvas 186 165 987 380 init 0; 111 | #X obj 19 163 symbol \$0-start-delay; 112 | #X obj 19 30 loadbang; 113 | #X obj 19 63 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 114 | -1; 115 | #X obj 180 163 symbol \$0-end-delay; 116 | #X obj 327 163 symbol \$0-attack-count; 117 | #X obj 497 163 symbol \$0-slope; 118 | #X obj 629 163 symbol \$0-attenuation; 119 | #X obj 793 163 symbol \$0-tempo; 120 | #X obj 19 231 pack s s s s s s; 121 | #X msg 19 274 \; \$1 31.66 \; \$2 125 \; \$3 19 \; \$4 6 \; \$5 0.973 122 | \$6 70; 123 | #X obj 19 87 t b b b b b b; 124 | #X connect 0 0 8 0; 125 | #X connect 1 0 2 0; 126 | #X connect 2 0 10 0; 127 | #X connect 3 0 8 1; 128 | #X connect 4 0 8 2; 129 | #X connect 5 0 8 3; 130 | #X connect 6 0 8 4; 131 | #X connect 7 0 8 5; 132 | #X connect 8 0 9 0; 133 | #X connect 10 0 0 0; 134 | #X connect 10 1 3 0; 135 | #X connect 10 2 4 0; 136 | #X connect 10 3 5 0; 137 | #X connect 10 4 6 0; 138 | #X connect 10 5 7 0; 139 | #X restore 241 681 pd init; 140 | #X text 238 55 - insert non-linear click attacks into a click attack 141 | stream; 142 | #X text 20 133 [expflam~] replaces a click trigger with a sequence 143 | of triggers to create a flam., f 83; 144 | #X obj 76 482 lyonpotpourri/player~ expflam-drum 1 16; 145 | #X obj 76 383 lyonpotpourri/expflam~; 146 | #X connect 2 0 5 0; 147 | #X connect 3 0 22 0; 148 | #X connect 5 0 21 0; 149 | #X connect 6 0 21 1; 150 | #X connect 7 0 6 0; 151 | #X connect 8 0 7 0; 152 | #X connect 11 0 17 0; 153 | #X connect 12 0 11 0; 154 | #X connect 13 0 22 1; 155 | #X connect 14 0 22 0; 156 | #X connect 17 0 13 0; 157 | #X connect 17 0 14 0; 158 | #X connect 21 0 15 1; 159 | #X connect 21 0 15 0; 160 | #X connect 22 0 21 0; 161 | -------------------------------------------------------------------------------- /player~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 417 25 664 741 12; 2 | #N canvas 0 22 450 300 (subpatch) 0; 3 | #X array sf4player 155944 float 2; 4 | #X coords 0 1 155944 -1 100 70 1 0 0; 5 | #X restore 482 138 graph; 6 | #N canvas 113 308 911 309 load-a-sound 0; 7 | #X obj 377 132 soundfiler; 8 | #X obj 377 81 openpanel; 9 | #X msg 377 104 read -resize \$1 sf4player; 10 | #X msg 70 48 read -resize sound/bell.aiff sf4player; 11 | #X obj 70 14 loadbang; 12 | #X obj 377 43 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 13 | #000000; 14 | #X text 460 72 do this before turning on DACs; 15 | #X text 444 54 <- first load in a short sound (recommend 1-5 secs.) 16 | ; 17 | #X connect 1 0 2 0; 18 | #X connect 2 0 0 0; 19 | #X connect 3 0 0 0; 20 | #X connect 4 0 3 0; 21 | #X connect 5 0 1 0; 22 | #X restore 237 579 pd load-a-sound; 23 | #X floatatom 370 310 5 0 0 0 - increment - 0; 24 | #X obj 240 550 hsl 128 15 -2 2 0 0 increment \$0-increment increment 25 | -2 -6 0 10 #88fc08 #000000 #000000 0 1; 26 | #N canvas 600 60 795 628 triggers 0; 27 | #X msg 93 79 mute \$1; 28 | #X obj 93 46 tgl 15 0 empty empty empty 0 -6 0 8 #fcfcfc #000000 #000000 29 | 0 1; 30 | #X obj 71 461 outlet~; 31 | #X msg 205 72 tempo \$1; 32 | #X floatatom 205 52 5 0 0 0 - - - 0; 33 | #X obj 208 25 hsl 128 15 20 200 0 0 empty empty empty -2 -6 0 8 #fcfcfc 34 | #000000 #000000 0 1; 35 | #X obj 391 461 outlet~; 36 | #X obj 75 297 lyonpotpourri/mask~ 1 0.7 0.5 0.3 0.1; 37 | #X obj 391 342 lyonpotpourri/mask~ 1 3 2 4; 38 | #X obj 391 396 lyonpotpourri/clickhold~; 39 | #X obj 93 107 lyonpotpourri/samm~ 60 1; 40 | #X msg 290 135 bang; 41 | #X text 325 134 manual play (when metro is muted); 42 | #X obj 283 236 lyonpotpourri/click~ 0.5; 43 | #X msg 451 183 set 2; 44 | #X msg 400 183 set 0.5; 45 | #X text 72 495 gain value; 46 | #X text 392 495 increment value; 47 | #X text 111 48 mute metro; 48 | #X text 383 161 set manual playback increment; 49 | #X text 427 323 increment sequence; 50 | #X text 126 273 gain sequence; 51 | #X obj 120 236 lyonpotpourri/click~; 52 | #X connect 0 0 10 0; 53 | #X connect 1 0 0 0; 54 | #X connect 3 0 10 0; 55 | #X connect 4 0 3 0; 56 | #X connect 5 0 4 0; 57 | #X connect 7 0 2 0; 58 | #X connect 8 0 9 0; 59 | #X connect 9 0 6 0; 60 | #X connect 10 0 7 0; 61 | #X connect 10 0 8 0; 62 | #X connect 11 0 13 0; 63 | #X connect 11 0 22 0; 64 | #X connect 13 0 6 0; 65 | #X connect 14 0 13 0; 66 | #X connect 15 0 13 0; 67 | #X connect 22 0 2 0; 68 | #X restore 80 331 pd triggers; 69 | #X msg 46 311 static_increment \$1; 70 | #X obj 46 284 tgl 15 0 empty empty empty 0 -6 0 8 #fcfcfc #000000 #000000 71 | 0 1; 72 | #N canvas 184 101 652 543 Learn-About-Me 1; 73 | #X text 30 61 (up to 8 simultaneous plays) so that; 74 | #X text 30 83 if you retrigger before the last play; 75 | #X text 33 104 is done \, the tail of the sound does; 76 | #X text 33 127 not get cut off abruptly.; 77 | #X text 31 41 other players \, player~ allows overlap; 78 | #X text 42 176 By default you have continuous control; 79 | #X text 42 215 the right inlet.) This increment controls; 80 | #X text 42 233 ALL currently active playbacks. If you; 81 | #X text 43 255 want independent playback (say a drum; 82 | #X text 42 277 machine with different increments on; 83 | #X text 45 301 each note) then turn on "static_increment."; 84 | #X text 46 328 Then you lose direct control over increment -; 85 | #X text 45 372 is constant. But then you can have multiple notes; 86 | #X text 45 398 playing at different increments.; 87 | #X text 29 22 player~ plays sound from an array. Unlike; 88 | #X text 40 194 over the sound increment (the input to; 89 | #X text 44 437 player~ is sample-triggered \, which means it can; 90 | #X text 46 461 be controlled with a sample-accurate metronome; 91 | #X text 48 482 such as samm~. This can make for a much more steady 92 | ; 93 | #X text 44 351 whatever increment is set at the onset of each note 94 | ; 95 | #X text 46 504 rhythm than using metro.; 96 | #X restore 237 611 pd Learn-About-Me; 97 | #X obj 46 241 loadbang; 98 | #X obj 192 332 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 99 | #000000 0 1; 100 | #X msg 192 355 channel \$1; 101 | #N canvas 600 60 253 221 initialize 0; 102 | #X obj 30 51 loadbang; 103 | #X msg 30 75 1; 104 | #X obj 30 96 s \$0-increment; 105 | #X connect 0 0 1 0; 106 | #X connect 1 0 2 0; 107 | #X restore 237 643 pd initialize; 108 | #X msg 46 262 1; 109 | #X text 67 287 set this for fixed increments (and polyphony); 110 | #X text 309 439 args: channel count \, overlap count, f 38; 111 | #X obj 46 441 lyonpotpourri/player~ sf4player 1 8; 112 | #X obj 192 385 lyonpotpourri/clean_selector~ 2; 113 | #X obj 46 493 lpp-meters; 114 | #X msg 370 335 \$1 50; 115 | #X obj 370 359 line~; 116 | #X text 411 311 <= manual increments from slider; 117 | #X obj 32 23 lpp-icon player~; 118 | #X text 258 60 - click-driven sample-accurate array playback; 119 | #X text 38 121 [player~] is a reentrant \, click-triggered soundfile 120 | player. A note is triggered by a non-zero click in the left inlet. 121 | There are two modes of play. In static mode \, the increment received 122 | in the right inlet at the time of the click trigger will be the increment 123 | for the duration of the note. In dynamic mode the increment can be 124 | continuously varied in the left inlet. Use the "static_increment" message 125 | to select the playback mode.; 126 | #X connect 2 0 18 0; 127 | #X connect 4 0 15 0; 128 | #X connect 4 1 16 0; 129 | #X connect 5 0 15 0; 130 | #X connect 6 0 5 0; 131 | #X connect 8 0 12 0; 132 | #X connect 9 0 10 0; 133 | #X connect 10 0 16 0; 134 | #X connect 12 0 6 0; 135 | #X connect 15 0 17 0; 136 | #X connect 15 0 17 1; 137 | #X connect 16 0 15 1; 138 | #X connect 18 0 19 0; 139 | #X connect 19 0 16 1; 140 | -------------------------------------------------------------------------------- /sel~.c: -------------------------------------------------------------------------------- 1 | #include "MSPd.h" 2 | 3 | static t_class *sel_class; 4 | 5 | #define MAXBEATS (256) 6 | #define OBJECT_NAME "sel~" 7 | #define COMPILE_DATE "9.02.07" 8 | #define OBJECT_VERSION "2.01" 9 | // #define DATE "prerelease" 10 | 11 | /* Pd version of sel~ */ 12 | 13 | typedef struct _sel 14 | { 15 | t_object x_obj; 16 | t_float x_f; 17 | t_float *matches; // store numbers to match against 18 | t_float *trigger_vec; // copy of input vector 19 | int length; // number of matches to check 20 | t_float **ins; // array of input signal vectors 21 | t_float **outs; // array of output signal vectors 22 | } t_sel; 23 | 24 | static void *sel_new(t_symbol *msg, int argc, t_atom *argv); 25 | static void sel_free(t_sel *x); 26 | static void sel_dsp(t_sel *x, t_signal **sp); 27 | 28 | 29 | void sel_tilde_setup(void) { 30 | sel_class = class_new(gensym("sel~"), (t_newmethod)sel_new, 31 | (t_method)sel_free, sizeof(t_sel),0,A_GIMME,0); 32 | CLASS_MAINSIGNALIN(sel_class, t_sel, x_f); 33 | class_addmethod(sel_class, (t_method)sel_dsp, gensym("dsp"), A_CANT, 0); 34 | potpourri_announce(OBJECT_NAME); 35 | } 36 | 37 | void *sel_new(t_symbol *msg, int argc, t_atom *argv) 38 | { 39 | int i; 40 | 41 | t_sel *x = (t_sel *)pd_new(sel_class); 42 | x->length = (int)argc; 43 | 44 | for(i=0;i< x->length ;i++) { 45 | outlet_new(&x->x_obj, gensym("signal")); 46 | } 47 | 48 | x->matches = (t_float *) getbytes(x->length * sizeof(t_float)); 49 | 50 | for(i = 0; i < argc; i++) { 51 | x->matches[i] = (double)atom_getfloatarg(i,argc,argv); 52 | } 53 | 54 | x->ins = (t_float **) getbytes(1 * sizeof(t_float *)); 55 | x->outs = (t_float **) getbytes(x->length * sizeof(t_float *)); 56 | // only 1 inlet 57 | for(i = 0; i < 1; i++) { 58 | x->ins[i] = (t_float *) getbytes(8192 * sizeof(t_float)); 59 | } 60 | return x; 61 | } 62 | 63 | void sel_free(t_sel *x) 64 | { 65 | freebytes(x->matches, x->length * sizeof(t_float)); 66 | freebytes(x->outs, x->length * sizeof(t_float *)); 67 | freebytes(x->ins[0], 8192 * sizeof(t_float)); 68 | freebytes(x->ins, 1 * sizeof(t_float *)); 69 | } 70 | 71 | t_int *sel_perform(t_int *w) 72 | { 73 | int i, j; 74 | t_sel *x = (t_sel *) w[1]; 75 | t_float **ins = x->ins; 76 | t_float **outs = x->outs; 77 | t_float *invec; 78 | t_float *inlet; 79 | t_float *match_outlet; 80 | t_float *matches = x->matches; 81 | int length = x->length; 82 | 83 | int n = (int) w[length + 3]; // obj, func, 1 inlet 84 | 85 | // copy input vectors (just 1 here) 86 | for(i = 0; i < 1; i++) { 87 | invec = (t_float *) w[2 + i]; 88 | for(j = 0; j < n; j++) { 89 | ins[i][j] = invec[j]; 90 | } 91 | } 92 | inlet = ins[0]; 93 | // assign output vector pointers 94 | for(i = 0; i < length; i++) { 95 | outs[i] = (t_float *) w[3 + i]; 96 | } 97 | 98 | // clean each outlet 99 | for(j = 0; j < length; j++) { 100 | match_outlet = (t_float *) outs[j]; 101 | for(i = 0; i < n; i++) { 102 | match_outlet[i] = 0.0; 103 | } 104 | } 105 | // now match and route any clicks in the input 106 | for(i = 0; i < n; i++) { 107 | if(inlet[i]) { 108 | for(j = 0; j < length; j++) { 109 | if( inlet[i] == matches[j]) { 110 | match_outlet = (t_float *) outs[j]; 111 | match_outlet[i] = 1.0; // always send a unity click 112 | } 113 | } 114 | } 115 | } 116 | return (w + length + 4); 117 | } 118 | 119 | /* 120 | void sel_perform64(t_sel *x, t_object *dsp64, double **ins, 121 | long numins, double **outs,long numouts, long n, 122 | long flags, void *userparam) 123 | { 124 | int i, j; 125 | t_double *inlet = ins[0]; 126 | t_double *match_outlet; 127 | t_double *matches = x->matches; 128 | int length = x->length; 129 | 130 | // clean each outlet 131 | for(j = 0; j < length; j++) { 132 | match_outlet = (t_double *) outs[j]; 133 | for(i = 0; i < n; i++) { 134 | match_outlet[i] = 0.0; 135 | } 136 | } 137 | // now match and route any clicks in the input 138 | for(i = 0; i < n; i++) { 139 | if(inlet[i]) { 140 | for(j = 0; j < length; j++) { 141 | if( inlet[i] == matches[j]) { 142 | match_outlet = (t_double *) outs[j]; 143 | match_outlet[i] = 1.0; // always send a unity click 144 | } 145 | } 146 | } 147 | } 148 | } 149 | 150 | 151 | t_int *sel_dsp64(t_sel *x, t_object *dsp64, short *count, double sr, long n, long flags) 152 | { 153 | if(!sp[0]->s_sr) 154 | return; 155 | object_method(dsp64, gensym("dsp_add64"),x,sel_perform64,0,NULL); 156 | } 157 | */ 158 | 159 | void sel_dsp(t_sel *x, t_signal **sp) 160 | { 161 | long i; 162 | t_int **sigvec; 163 | int pointer_count = x->length + 3; // output chans + object + inchan + vectorsize 164 | if(!sp[0]->s_sr) { 165 | return; 166 | } 167 | sigvec = (t_int **) getbytes(pointer_count * sizeof(t_int *)); 168 | for(i = 0; i < pointer_count; i++) { 169 | sigvec[i] = (t_int *) getbytes(sizeof(t_int) * 1); 170 | } 171 | sigvec[0] = (t_int *)x; // first pointer is to the object 172 | sigvec[pointer_count - 1] = (t_int *)sp[0]->s_n; // last pointer is to vector size (N) 173 | for(i = 1; i < pointer_count - 1; i++){ // now attach the inlet and all outlets 174 | sigvec[i] = (t_int *)sp[i-1]->s_vec; 175 | } 176 | dsp_addv(sel_perform, pointer_count, (t_int *)sigvec); 177 | freebytes(sigvec, pointer_count * sizeof(t_int *)); 178 | } 179 | -------------------------------------------------------------------------------- /phasemod~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 472 143 549 554 12; 2 | #X floatatom 32 211 5 20 20000 2 freq phasemod-freq-in -; 3 | #N canvas 600 60 454 304 scope 0; 4 | #N canvas 0 22 450 300 (subpatch) 0; 5 | #X array phasemod-scope 441 float 3; 6 | #A 0 0.826968 0.819897 0.812698 0.805372 0.797922 0.790348 0.782531 7 | 0.774711 0.766647 0.75846 0.750025 0.741595 0.732915 0.724247 0.715329 8 | 0.706293 0.697003 0.687733 0.678209 0.66857 0.658817 0.648952 0.638829 9 | 0.628595 0.61825 0.607798 0.597238 0.586575 0.575651 0.564624 0.553496 10 | 0.542268 0.530779 0.519356 0.507674 0.495898 0.484031 0.471904 0.459858 11 | 0.447555 0.435167 0.422695 0.409969 0.397338 0.384454 0.371495 0.358284 12 | 0.345181 0.33183 0.318412 0.304929 0.291385 0.277783 0.26394 0.250042 13 | 0.236092 0.222094 0.207862 0.193774 0.179457 0.164913 0.150523 0.136101 14 | 0.121459 0.106791 0.0920999 0.0771974 0.062469 0.0475355 0.0325913 15 | 0.0174481 0.00249272 -0.012655 -0.0277998 -0.0429383 -0.0580668 -0.0733733 16 | -0.0886626 -0.103931 -0.119175 -0.134391 -0.149765 -0.165102 -0.1804 17 | -0.195654 -0.211049 -0.226391 -0.241678 -0.256905 -0.272252 -0.287347 18 | -0.302554 -0.317684 -0.332915 -0.347879 -0.362934 -0.377895 -0.392934 19 | -0.407694 -0.422522 -0.437237 -0.451836 -0.466485 -0.480839 -0.495232 20 | -0.509655 -0.523773 -0.53791 -0.551898 -0.565732 -0.579408 -0.593078 21 | -0.606426 -0.619907 -0.633058 -0.64603 -0.658961 -0.671701 -0.684385 22 | -0.696728 -0.709002 -0.721066 -0.732915 -0.744674 -0.756206 -0.767508 23 | -0.778576 -0.789407 -0.800113 -0.81057 -0.820774 -0.83083 -0.840622 24 | -0.850146 -0.8594 -0.868476 -0.877177 -0.885689 -0.893999 -0.901929 25 | -0.909646 -0.917062 -0.924173 -0.931047 -0.937606 -0.943847 -0.949768 26 | -0.955425 -0.96075 -0.965744 -0.970403 -0.974769 -0.978791 -0.982468 27 | -0.98583 -0.988836 -0.991487 -0.993779 -0.995714 -0.997305 -0.998528 28 | -0.999391 -0.999876 -0.999993 -0.999735 -0.999094 -0.998071 -0.996666 29 | -0.994879 -0.992712 -0.990139 -0.987179 -0.9838 -0.980068 -0.975912 30 | -0.971367 -0.966387 -0.961016 -0.955255 -0.949106 -0.942509 -0.935523 31 | -0.92815 -0.920393 -0.912178 -0.903579 -0.894514 -0.885154 -0.875329 32 | -0.865129 -0.854458 -0.843414 -0.832002 -0.820226 -0.807979 -0.795372 33 | -0.782412 -0.768981 -0.755327 -0.74108 -0.726623 -0.711702 -0.696452 34 | -0.680882 -0.664854 -0.648514 -0.63187 -0.614778 -0.597392 -0.579721 35 | -0.561773 -0.543395 -0.524753 -0.505856 -0.486545 -0.466994 -0.447212 36 | -0.427035 -0.406643 -0.386047 -0.365078 -0.343921 -0.322589 -0.301092 37 | -0.279256 -0.257275 -0.234974 -0.212548 -0.19001 -0.167371 -0.144454 38 | -0.121459 -0.0983988 -0.0750943 -0.0517487 -0.0283748 -0.00479367 0.00498542 39 | 0.0113129 0.0176399 0.0239662 0.0302915 0.0368072 0.0431298 0.0496422 40 | 0.0561525 0.062469 0.0689743 0.0754767 0.0819759 0.0884716 0.0951544 41 | 0.101642 0.108126 0.114795 0.121459 0.127928 0.134581 0.141228 0.147868 42 | 0.154502 0.161319 0.167938 0.17455 0.181343 0.188127 0.194714 0.20148 43 | 0.208237 0.214983 0.221907 0.228632 0.235347 0.242236 0.248928 0.255793 44 | 0.262645 0.269484 0.276309 0.28312 0.289918 0.2967 0.303651 0.310403 45 | 0.317321 0.324222 0.331106 0.337973 0.344821 0.351652 0.358463 0.365435 46 | 0.372207 0.379138 0.386047 0.392758 0.399624 0.406468 0.413464 0.420261 47 | 0.427035 0.433958 0.440683 0.447555 0.4544 0.461219 0.468011 0.474775 48 | 0.48168 0.488387 0.495232 0.501881 0.508665 0.515418 0.522139 0.528828 49 | 0.535484 0.542268 0.548856 0.55557 0.56209 0.568732 0.575338 0.581906 50 | 0.588437 0.595083 0.601536 0.608102 0.614475 0.620959 0.627401 0.6338 51 | 0.640156 0.646469 0.652882 0.659105 0.665427 0.671559 0.677786 0.683965 52 | 0.690096 0.696315 0.702345 0.708326 0.71439 0.720402 0.726359 0.732263 53 | 0.738112 0.743906 0.749644 0.755453 0.761078 0.76677 0.772402 0.777974 54 | 0.783485 0.788936 0.794442 0.799768 0.805145 0.810457 0.815704 0.820884 55 | 0.825997 0.831043 0.836127 0.841037 0.84598 0.850852 0.855651 0.860379 56 | 0.865033 0.869614 0.874215 0.878646 0.883094 0.887463 0.891754 0.895966 57 | 0.900183 0.904235 0.908288 0.912178 0.916065 0.919868 0.923586 0.927291 58 | 0.930837 0.934366 0.937739 0.941091 0.944353 0.947524 0.950605 0.953653 59 | 0.95655 0.959409 0.962174 0.964842 0.967415 0.969891 0.972271 0.974598 60 | 0.976823 0.978948 0.980972 0.982894 0.984715 0.986434 0.988081 0.989622 61 | 0.991031 0.992362 0.993608 0.994723 0.995732 0.99665 0.997457 0.998153 62 | 0.998738 0.999212 0.999575 0.999831 0.999969 0.999996 0.999907 0.999704 63 | 0.999384 0.998941 0.99839 0.99771 0.996911 0.995993 0.994957 0.993779 64 | 0.992503 0.991082 0.989567 0.987903 0.986086; 65 | #X coords 0 1 440 -1 200 140 1; 66 | #X restore 37 20 graph; 67 | #X obj 69 246 tabwrite~ phasemod-scope; 68 | #X obj 69 193 inlet~; 69 | #X obj 130 216 metro 100; 70 | #X obj 130 197 tgl 15 0 empty phasemod-scope-tog empty 17 7 0 10 -262144 71 | -1 -1 1 1; 72 | #X text 154 201 turn on scope; 73 | #X connect 2 0 1 0; 74 | #X connect 3 0 1 0; 75 | #X connect 4 0 3 0; 76 | #X restore 153 273 pd scope; 77 | #X obj 32 237 lyonpotpourri/phasemod~; 78 | #X obj 32 350 lpp-meters; 79 | #X text 222 269 <= look at waveform; 80 | #X obj 190 150 osc~ 0.15; 81 | #X obj 190 178 *~ 15; 82 | #X obj 190 204 +~ 15; 83 | #N canvas 600 60 421 227 init 0; 84 | #X obj 45 50 loadbang; 85 | #X msg 45 79 \; phasemod-freq-in 100 \; phasemod-scope-tog 1; 86 | #X connect 0 0 1 0; 87 | #X restore 200 484 pd init; 88 | #X text 243 49 - a phase-modulated sinusoid; 89 | #X text 29 117 In this example the maximum index of modulation is 30 90 | \, but you could try higher values too.; 91 | #X obj 25 19 lpp-icon phasemod~; 92 | #X text 237 207 modulation index ranges from 0 - 30; 93 | #X connect 0 0 2 0; 94 | #X connect 2 0 1 0; 95 | #X connect 2 0 3 0; 96 | #X connect 2 0 3 1; 97 | #X connect 5 0 6 0; 98 | #X connect 6 0 7 0; 99 | #X connect 7 0 2 1; 100 | -------------------------------------------------------------------------------- /sarec~-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 426 42 805 761 12; 2 | #N canvas 0 22 450 300 (subpatch) 0; 3 | #X array track1 100000 float 2; 4 | #X coords 0 1 99999 -1 200 100 1; 5 | #X restore 54 293 graph; 6 | #X obj 521 319 noise~; 7 | #X obj 521 348 *~ 0.1; 8 | #X obj 321 423 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 9 | -1 -1; 10 | #X floatatom 321 540 5 0 0 0 - - -; 11 | #X msg 217 636 \; track1 const 0; 12 | #X text 214 615 clear track; 13 | #X obj 57 504 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 14 | -1; 15 | #X obj 419 698 s sarec.messages; 16 | #X obj 194 455 r sarec.messages; 17 | #X obj 264 304 vradio 15 1 0 4 empty empty record_mode 0 -8 0 10 -204800 18 | -4160 -1 1; 19 | #X text 282 303 record; 20 | #X text 282 320 overdub; 21 | #X text 283 335 punch; 22 | #X text 282 351 lock track; 23 | #N canvas 310 149 676 348 status-messages 0; 24 | #X msg 88 133 overdub; 25 | #X msg 147 133 punch; 26 | #X msg 37 133 record; 27 | #X msg 192 134 lock; 28 | #X obj 90 68 sel 0 1 2 3; 29 | #X obj 48 213 s sarec.messages; 30 | #X obj 81 28 inlet; 31 | #X text 229 64 record \, overdub \, and punch should be familiar. When 32 | lock mode is selected \, you can't record onto the track.; 33 | #X connect 0 0 5 0; 34 | #X connect 1 0 5 0; 35 | #X connect 2 0 5 0; 36 | #X connect 3 0 5 0; 37 | #X connect 4 0 2 0; 38 | #X connect 4 1 0 0; 39 | #X connect 4 2 1 0; 40 | #X connect 4 3 3 0; 41 | #X connect 6 0 4 0; 42 | #X restore 264 375 pd status-messages; 43 | #X msg 419 672 punchfade \$1; 44 | #X msg 419 641 5; 45 | #X msg 456 641 50; 46 | #X msg 492 641 150; 47 | #N canvas 149 234 450 300 show-record-phase 0; 48 | #X obj 53 132 snapshot~; 49 | #X msg 179 95 1; 50 | #X obj 179 116 metro 50; 51 | #X obj 179 76 loadbang; 52 | #X text 94 154 record phase; 53 | #X obj 53 60 inlet~; 54 | #X obj 53 199 outlet; 55 | #X connect 0 0 6 0; 56 | #X connect 1 0 2 0; 57 | #X connect 2 0 0 0; 58 | #X connect 3 0 1 0; 59 | #X connect 5 0 0 0; 60 | #X restore 321 515 pd show-record-phase; 61 | #N canvas 600 60 450 300 set-record-region 0; 62 | #X obj 42 244 s sarec.messages; 63 | #X msg 49 120 region 500 1000; 64 | #X msg 37 93 region 0 0; 65 | #X text 40 75 set region to entire array (default); 66 | #X text 167 120 select region within array (ms.); 67 | #X msg 61 159 region 0 1500; 68 | #X msg 99 200 region 200 400; 69 | #X connect 1 0 0 0; 70 | #X connect 2 0 0 0; 71 | #X connect 5 0 0 0; 72 | #X connect 6 0 0 0; 73 | #X restore 419 594 pd set-record-region; 74 | #X obj 57 554 lpp-meters; 75 | #X obj 57 529 tabplay~ track1; 76 | #X obj 321 492 lyonpotpourri/sarec~ track1 1; 77 | #X obj 35 22 lpp-icon sarec~; 78 | #X text 191 422 trigger record =>; 79 | #X text 41 135 [sarec~] implements sample-accurate recording \, including 80 | precision punching and overdubs. The record mode is set with various 81 | messages. Recording to the specified region within an array is triggered 82 | with a click \, thus a sample-accurate event.; 83 | #X obj 321 454 lyonpotpourri/click~; 84 | #X text 93 497 <= play back recorded track; 85 | #X obj 521 392 lyonpotpourri/clean_selector~ 2; 86 | #N canvas 600 60 551 463 pad 0; 87 | #X msg 126 63 87.3071 261.626 329.628 391.995; 88 | #X obj 126 123 unpack f f f f; 89 | #X obj 126 239 phasor~; 90 | #X obj 126 269 -~ 0.5; 91 | #X obj 194 242 phasor~; 92 | #X obj 197 272 -~ 0.5; 93 | #X obj 261 242 phasor~; 94 | #X obj 258 274 -~ 0.5; 95 | #X obj 330 242 phasor~; 96 | #X obj 330 272 -~ 0.5; 97 | #X obj 126 33 loadbang; 98 | #X obj 126 299 lyonpotpourri/flanjah~ 10 -0.47 0.434 0.251 0.99; 99 | #X obj 126 329 outlet~; 100 | #X obj 390 45 inlet; 101 | #X msg 390 79 \$1 50; 102 | #X obj 390 113 line~; 103 | #X obj 126 209 *~; 104 | #X obj 188 209 *~; 105 | #X obj 254 209 *~; 106 | #X obj 316 209 *~; 107 | #X obj 143 379 loadbang; 108 | #X msg 143 406 1; 109 | #X obj 143 429 s \$0-ptranspose; 110 | #X connect 0 0 1 0; 111 | #X connect 1 0 16 0; 112 | #X connect 1 1 17 0; 113 | #X connect 1 2 18 0; 114 | #X connect 1 3 19 0; 115 | #X connect 2 0 3 0; 116 | #X connect 3 0 11 0; 117 | #X connect 4 0 5 0; 118 | #X connect 5 0 11 0; 119 | #X connect 6 0 7 0; 120 | #X connect 7 0 11 0; 121 | #X connect 8 0 9 0; 122 | #X connect 9 0 11 0; 123 | #X connect 10 0 0 0; 124 | #X connect 11 0 12 0; 125 | #X connect 13 0 14 0; 126 | #X connect 14 0 15 0; 127 | #X connect 15 0 16 1; 128 | #X connect 15 0 17 1; 129 | #X connect 15 0 18 1; 130 | #X connect 15 0 19 1; 131 | #X connect 16 0 2 0; 132 | #X connect 17 0 4 0; 133 | #X connect 18 0 6 0; 134 | #X connect 19 0 8 0; 135 | #X connect 20 0 21 0; 136 | #X connect 21 0 22 0; 137 | #X restore 626 317 pd pad; 138 | #X text 416 623 set taper (ms) for punch mode; 139 | #X obj 626 351 *~ 0.2; 140 | #X obj 431 262 vradio 15 1 0 2 empty empty empty 0 -8 0 10 -262144 141 | -1 -1 1; 142 | #X msg 431 315 channel \$1; 143 | #X msg 217 710 \; track1 normalize; 144 | #X text 214 690 normalize track; 145 | #X text 449 260 select noise input; 146 | #X text 450 277 select pad input; 147 | #X text 270 48 - sample-accurate recording; 148 | #X text 409 393 input signal =>; 149 | #X text 416 574 select region of track to record on; 150 | #X floatatom 626 289 5 0 0 0 - - -; 151 | #X obj 629 239 hsl 128 15 0.5 2 0 0 empty \$0-ptranspose pad_transpose 152 | -2 -8 0 10 -262130 -1 -1 4233 1; 153 | #X connect 1 0 2 0; 154 | #X connect 2 0 30 0; 155 | #X connect 3 0 28 0; 156 | #X connect 7 0 23 0; 157 | #X connect 9 0 24 0; 158 | #X connect 10 0 15 0; 159 | #X connect 16 0 8 0; 160 | #X connect 17 0 16 0; 161 | #X connect 18 0 16 0; 162 | #X connect 19 0 16 0; 163 | #X connect 20 0 4 0; 164 | #X connect 23 0 22 0; 165 | #X connect 23 0 22 1; 166 | #X connect 24 0 20 0; 167 | #X connect 28 0 24 0; 168 | #X connect 30 0 24 1; 169 | #X connect 31 0 33 0; 170 | #X connect 33 0 30 1; 171 | #X connect 34 0 35 0; 172 | #X connect 35 0 30 0; 173 | #X connect 43 0 31 0; 174 | #X connect 44 0 43 0; 175 | --------------------------------------------------------------------------------