Malte Steiner wrote:
I didnt looked into your patch yet but usually these waveforms are stored in one table as one sample. Your tabread object should run through one waveform at a time, I have to look up how much bytes they are but assume 256, so it runs from 0 to 255 and to switch to another waveform you add n*256 where n is the waveformnumber. When you switch with a line object over several waveforms, you get the wonderful crude ppg sound but you should make sure that it goes only whole numbers without fractions so it really jumps a whole waveform each step. It can be done by sending the moving number through an int object.
Here's a patch that does exactly this. 256 waveforms each 256 samples long.
When writing it I found a bug in wrap~ in pd-0.40-2 from Miller's site:
sig~ 1 wrap~ print~ -> 0
sig~ 0 wrap~ print~ -> 1
http://claudiusmaximus.goto10.org
#N canvas 10 18 454 378 10; #N canvas 0 0 293 526 $0-make-wavetables 0; #X obj 29 26 inlet; #X obj 29 59 bang; #X msg 29 88 256; #X obj 29 118 until; #X obj 29 147 f 0; #X obj 61 147 + 1; #X obj 60 169 mod 256; #X msg 29 225 256; #X obj 29 255 until; #X obj 29 284 f 0; #X obj 61 284 + 1; #X obj 60 306 mod 256; #X obj 29 422 pack f f; #X obj 29 198 t b f f; #X obj 29 332 t f f; #X obj 191 315 * 256; #X obj 171 416 +; #X obj 29 499 tabwrite $0-wavetable; #X obj 125 305 / 255; #X obj 29 359 / 256; #N canvas 523 553 450 300 $0-waveform 0; #X obj 27 33 inlet; #X obj 27 57 unpack f f; #X obj 27 262 outlet; #X text 34 105 phase; #X text 286 102 morph; #X obj 28 127 expr cos((1-$f2) * 5*tanh(1-$f1*2) + ($f2) * 5*cos(5*(1-$f1*2))) ; #X connect 0 0 1 0; #X connect 1 0 5 0; #X connect 1 1 5 1; #X connect 5 0 2 0; #X restore 29 468 pd $0-waveform; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 4 0 5 0; #X connect 4 0 13 0; #X connect 5 0 6 0; #X connect 6 0 4 1; #X connect 7 0 8 0; #X connect 8 0 9 0; #X connect 9 0 10 0; #X connect 9 0 14 0; #X connect 10 0 11 0; #X connect 11 0 9 1; #X connect 12 0 20 0; #X connect 13 0 7 0; #X connect 13 1 18 0; #X connect 13 2 15 0; #X connect 14 0 19 0; #X connect 14 1 16 0; #X connect 15 0 16 1; #X connect 16 0 17 1; #X connect 18 0 12 1; #X connect 19 0 12 0; #X connect 20 0 17 0; #X restore 78 65 pd $0-make-wavetables; #X obj 76 99 table $0-wavetable 65536; #X obj 56 37 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 78 37 loadbang; #X obj 85 258 +~; #X obj 85 309 hip~ 5; #X obj 84 333 *~ 0.1; #X obj 85 355 dac~; #X obj 260 60 metro 2000; #X obj 260 37 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1; #X obj 260 106 vline~; #X obj 273 134 wrap~; #X obj 259 155 -~; #X obj 141 236 samphold~; #X msg 290 273 ; pd dsp $1; #X obj 290 252 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1; #X obj 83 126 loadbang; #X obj 259 210 *~ 256; #X obj 260 176 max~ 0; #X text 321 135 bug: wrap~ 0 -> 1; #X text 313 177 bug workaround; #X obj 85 283 tabread4~ $0-wavetable; #X obj 84 203 phasor~; #X obj 84 184 mtof; #X floatatom 83 166 5 0 0 0 - - -; #X msg 83 146 48; #X obj 85 235 *~ 256; #X obj 143 330 / 100; #X floatatom 143 312 5 0 0 0 - - -; #X msg 260 83 255 1500 , 0 300 1600; #X connect 2 0 0 0; #X connect 3 0 0 0; #X connect 4 0 21 0; #X connect 5 0 6 0; #X connect 6 0 7 0; #X connect 6 0 7 1; #X connect 8 0 29 0; #X connect 9 0 8 0; #X connect 10 0 11 0; #X connect 10 0 12 0; #X connect 11 0 12 1; #X connect 12 0 18 0; #X connect 13 0 4 1; #X connect 15 0 14 0; #X connect 16 0 25 0; #X connect 17 0 13 0; #X connect 18 0 17 0; #X connect 21 0 5 0; #X connect 22 0 13 1; #X connect 22 0 26 0; #X connect 23 0 22 0; #X connect 24 0 23 0; #X connect 25 0 24 0; #X connect 26 0 4 0; #X connect 27 0 6 1; #X connect 28 0 27 0; #X connect 29 0 10 0;