#N canvas 178 160 947 513 10; #N canvas 0 22 450 278 (subpatch) 0; #X array square 2051 float 2; #X coords 0 1 2051 -1 200 140 1; #X restore 12 187 graph; #X obj 12 116 bl_squarewave square 2048 40; #X msg 12 93 bang; #X floatatom 260 185 5 0 0 0 - - -, f 5; #X obj 260 204 sig~; #X obj 260 226 *~; #X obj 260 248 phasor~; #X obj 260 296 *~ 2048; #X obj 260 318 +~ 1; #X obj 260 340 tabread4~ square; #X obj 260 446 *~; #X obj 260 472 dac~; #X obj 278 362 hsl 128 15 0 1 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 0 1; #X obj 275 382 pow 4; #X obj 275 404 pack f 20; #X obj 275 426 line~; #X obj 409 232 >~ 0.5; #X obj 485 270 ==~ 0; #X floatatom 479 173 5 0 0 2 duty_cycle - -, f 5; #X obj 479 204 t f f; #X obj 506 249 /; #X obj 506 227 swap 1; #X obj 409 334 s~ phase_dist; #X obj 302 209 r~ phase_dist; #X obj 409 292 *~ 1; #X obj 485 292 *~ 1; #X text 189 95 this is a band limited waveform generator abstraction I've made. instead you can just use [sinesum( to create the square wave; #X text 520 176 a value of 2 is supposed to play the negative part of the waveform four times longer than the positive part. a value of 0.5 is supposed to act the other way round; #X text 70 23 Trying to implement the duty cycle to a band limited square wave. this seems to me like the way to go \, but changing the duty cycle creates a pitch difference.; #X connect 2 0 1 0; #X connect 3 0 4 0; #X connect 4 0 5 0; #X connect 5 0 6 0; #X connect 6 0 7 0; #X connect 6 0 16 0; #X connect 7 0 8 0; #X connect 8 0 9 0; #X connect 9 0 10 0; #X connect 10 0 11 0; #X connect 10 0 11 1; #X connect 12 0 13 0; #X connect 13 0 14 0; #X connect 14 0 15 0; #X connect 15 0 10 1; #X connect 16 0 17 0; #X connect 16 0 24 0; #X connect 17 0 25 0; #X connect 18 0 19 0; #X connect 19 0 24 1; #X connect 19 1 21 0; #X connect 20 0 25 1; #X connect 21 0 20 0; #X connect 21 1 20 1; #X connect 23 0 5 1; #X connect 24 0 22 0; #X connect 25 0 22 0;