Skip to content

Commit

Permalink
Fixed issue with resonance not extream enough.
Browse files Browse the repository at this point in the history
  • Loading branch information
trash80 committed Nov 26, 2013
1 parent ab18618 commit ecb27f2
Show file tree
Hide file tree
Showing 12 changed files with 2 additions and 1 deletion.
Binary file modified BlitterSynth.amxd
Binary file not shown.
Binary file modified BlitterSynthLivePack Project/BlitterSynthLivePack.als
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified BlitterSynthLivePack.alp
Binary file not shown.
3 changes: 2 additions & 1 deletion patchers/blitter-synth.maxpat
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@
}
, {
"box" : {
"code" : "/*\r\n ____ ____ \n| ~. | | `````|````` `````|````` | |`````````, \r\n-----------------------------------------------------------------------\n| ~. | | | | | | `. \n|_______.' |_______ | | | |___________ | `. \n \n \n ..'''' ``.. ..'' |.. | `````|````` | | \r\n-----------------------------------------------------------------------\n ..' | | ``.. | | | | \n....'' | | ``| | | |\r\n\r\n \n _/ _/ _/_/ _/ \n_/_/_/_/ _/ _/_/ _/_/_/ _/_/_/ _/_/_/ _/ _/ _/ _/ \n _/ _/_/ _/ _/ _/_/ _/ _/ _/_/ _/ _/ \n_/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ \n _/_/ _/ _/_/_/ _/_/_/ _/ _/ _/_/ _/ \r\n\r\n\r\nCC - Timothy Lamb - trash80.com\r\n\r\n*/\r\nBuffer wavetable(\"---wavram\");\r\nBuffer wavetabledisplay(\"---wavdisplayram\");\r\n\nHistory index(0);\nHistory sync_index(0);\nHistory sync_render(0);\r\n\nHistory current_shape(0);\nHistory bpz(0.0001);\nHistory lpz(0.0001);\n\nsize = in1;\nbits = in2;\nshape = in3;\nscale = in4;\nwrap = in5;\namp = in6;\nflip = in7;\nnoi = in8;\nfilter = in9;\ncutoff = in10;\nres = in11;\n\nfsync_enable = in12;\nfsync_rate = in13;\nfsync_reset = in14;\n\n\n// Framesync Oscillator\nif(fsync_enable == 1) { \n sync_period = fsync_rate * (SAMPLERATE / 1000);\n sync_phase = sync_index / sync_period;\n sync_index = sync_index < sync_period ? sync_index + 1 : 0;\r\n\n if(fsync_reset == 1) {\n sync_index = 0;\n }\n if(sync_render == index) {\n sync_render = 0;\n }\n if(sync_index == 0) {\n sync_render = index == 0 ? size : index - 1;\n }\n}\n\nsample = 0.5;\n\nif(fsync_enable == 0 || sync_render != index) {\n\n index = index < size ? index + 1 : 0 ; \n phase = index / size;\n if(index == 0) {\r\n\t\tcurrent_shape = shape;\r\n\t}\n // Shape ... No switch case support, sadness.\n if(current_shape == 0) {\n sample = (phase * (1 + scale))%1 >= 0.125 ? 0.9999 : 0;\n } else if (current_shape == 1) {\n sample = (phase * (1 + scale))%1 >= 0.25 ? 0.9999 : 0;\n } else if (current_shape == 2) {\n sample = (phase * (1 + scale))%1 >= 0.5 ? 0.9999 : 0;\n } else if (current_shape == 3) {\n sample = (phase * (1 + scale))%1 >= 0.75 ? 0.9999 : 0;\n } else if (current_shape == 4) {\n sample = 1 - abs((phase * (1.0001+scale) % 1) - 0.5) * 2;\n } else if (current_shape == 5) {\n sample = abs(phase * 2) * (0.5+scale) % 1;\n } else if (current_shape == 6) {\n sample = (sin(phase * TWOPI * (1 + scale ) )) / 2.0001 + 0.5;\n }\n\n // Flip\n sample = phase >= flip ? sample : 1 - sample;\n\n // Noise\r\n\tif(noi != 0) {\n sample = ((1 - noi) * sample) + (((noise() + 1) / 2) * noi);\r\n }\n\n // Normalize from 0. 1. to -0.5 0.5 and mult by Amp parameter\n sample = (sample - 0.5) * amp;\n\n // Filter - cheap and shity. ;)\n cutoff = cutoff > 1 ? 1 : cutoff < 0 ? 0 : cutoff;\r\n\r\n\t// Clip and flip Res\n res = res > 1 ? 0 : res < 0 ? 1 : 1 - res;\r\n\r\n\t// Turn off filter if cutoff is 1 and we are on LP\n filter = filter == 1 && cutoff == 1 && res == 1 ? 0 : filter;\r\n\r\n\t// Turn off filter if cutoff is 0 and we are on HP\n filter = filter == 2 && cutoff == 0 && res == 1 ? 0 : filter;\r\n\n\t// Do some feedback\n hp = sample - ((bpz * res) + lpz);\n bpz = ((hp * cutoff) + bpz);\n lpz = ((bpz * cutoff) + lpz);\r\n\t// Run it again just because\n hp = sample - ((bpz * res) + lpz);\n bpz = ((hp * cutoff) + bpz);\n lpz = ((bpz * cutoff) + lpz);\r\n\t// Clip and saturate\n bpz = bpz > 32 ? 32 : bpz < -32 ? -32 : bpz;\n lpz = lpz > 32 ? 32 : lpz < -32 ? -32 : lpz;\n bpz = bpz * (1 - (abs(bpz) * 0.015625));\n lpz = lpz * (1 - (abs(lpz) * 0.015625));\r\n\n\t// Apply filter to sample\n sample = filter == 1 ? lpz : filter == 2 ? hp : filter == 3 ? bpz : sample;\n // End Filter\n\n // Normalize from -0.5 0.5 to 0. 1.\n sample = sample + 0.5;\n\n // Clip & Wrap\n sample = wrap == 0 ? clamp(sample, 0, 1) : clamp((sample + 1000) % 1, 0, 1);\n\n // Apply Resolution\n sbits = pow(int(2), int(bits));\n sample = (float(int(sample * sbits)) / sbits) + (1 / sbits);\n\tsmooth = fsync_enable == 1? 0 : 0.8;\r\n\t\n poke(wavetable, sample, index, 0, smooth, overdubmode=\"mix\", boundmode=\"ignore\", index=\"samples\", channelmode=\"ignore\");\n poke(wavetabledisplay, sample, index, 0, 0, overdubmode=\"mix\", boundmode=\"ignore\", index=\"samples\", channelmode=\"ignore\");\n}\n\nout1 = sample;\nout2 = index;\n",
"code" : "/*\r\n ____ ____ \n| ~. | | `````|````` `````|````` | |`````````, \r\n-----------------------------------------------------------------------\n| ~. | | | | | | `. \n|_______.' |_______ | | | |___________ | `. \n \n \n ..'''' ``.. ..'' |.. | `````|````` | | \r\n-----------------------------------------------------------------------\n ..' | | ``.. | | | | \n....'' | | ``| | | |\r\n\r\n \n _/ _/ _/_/ _/ \n_/_/_/_/ _/ _/_/ _/_/_/ _/_/_/ _/_/_/ _/ _/ _/ _/ \n _/ _/_/ _/ _/ _/_/ _/ _/ _/_/ _/ _/ \n_/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ \n _/_/ _/ _/_/_/ _/_/_/ _/ _/ _/_/ _/ \r\n\r\n\r\nCC - Timothy Lamb - trash80.com\r\n\r\n*/\r\nBuffer wavetable(\"---wavram\");\r\nBuffer wavetabledisplay(\"---wavdisplayram\");\r\n\nHistory index(0);\nHistory sync_index(0);\nHistory sync_render(0);\r\n\nHistory current_shape(0);\nHistory bpz(0.0001);\nHistory lpz(0.0001);\n\nsize = in1;\nbits = in2;\nshape = in3;\nscale = in4;\nwrap = in5;\namp = in6;\nflip = in7;\nnoi = in8;\nfilter = in9;\ncutoff = in10;\nres = in11;\n\nfsync_enable = in12;\nfsync_rate = in13;\nfsync_reset = in14;\n\n\n// Framesync Oscillator\nif(fsync_enable == 1) { \n sync_period = fsync_rate * (SAMPLERATE / 1000);\n sync_phase = sync_index / sync_period;\n sync_index = sync_index < sync_period ? sync_index + 1 : 0;\r\n\n if(fsync_reset == 1) {\n sync_index = 0;\n }\n if(sync_render == index) {\n sync_render = 0;\n }\n if(sync_index == 0) {\n sync_render = index == 0 ? size : index - 1;\n }\n}\n\nsample = 0.5;\n\nif(fsync_enable == 0 || sync_render != index) {\n\n index = index < size ? index + 1 : 0 ; \n phase = index / size;\n if(index == 0) {\r\n\t\tcurrent_shape = shape;\r\n\t}\n // Shape ... No switch case support, sadness.\n if(current_shape == 0) {\n sample = (phase * (1 + scale))%1 >= 0.125 ? 0.9999 : 0;\n } else if (current_shape == 1) {\n sample = (phase * (1 + scale))%1 >= 0.25 ? 0.9999 : 0;\n } else if (current_shape == 2) {\n sample = (phase * (1 + scale))%1 >= 0.5 ? 0.9999 : 0;\n } else if (current_shape == 3) {\n sample = (phase * (1 + scale))%1 >= 0.75 ? 0.9999 : 0;\n } else if (current_shape == 4) {\n sample = 1 - abs((phase * (1.0001+scale) % 1) - 0.5) * 2;\n } else if (current_shape == 5) {\n sample = abs(phase * 2) * (0.5+scale) % 1;\n } else if (current_shape == 6) {\n sample = (sin(phase * TWOPI * (1 + scale ) )) / 2.0001 + 0.5;\n }\n\n // Flip\n sample = phase >= flip ? sample : 1 - sample;\n\n // Noise\r\n\tif(noi != 0) {\n sample = ((1 - noi) * sample) + (((noise() + 1) / 2) * noi);\r\n }\n\n // Normalize from 0. 1. to -0.5 0.5 and mult by Amp parameter\n sample = (sample - 0.5) * amp;\n\n // Filter - cheap and shity. ;)\n scutoff = cutoff > 1 ? 1 : cutoff < 0 ? 0 : cutoff;\r\n\r\n\t// Clip and flip Res\n sres = res > 1 ? 0 : res < 0 ? 1 : 1 - res;\r\n\r\n\t// Turn off filter if cutoff is 1 and we are on LP\n filter = filter == 1 && scutoff == 1 && sres == 1 ? 0 : filter;\r\n\r\n\t// Turn off filter if cutoff is 0 and we are on HP\n filter = filter == 2 && scutoff == 0 && sres == 1 ? 0 : filter;\r\n\n\t// Do some feedback\n hp = sample - ((bpz * sres) + lpz);\n bpz = ((hp * scutoff) + bpz);\n lpz = ((bpz * scutoff) + lpz);\r\n\t// Run it again just because\n hp = sample - ((bpz * sres) + lpz);\n bpz = ((hp * scutoff) + bpz);\n lpz = ((bpz * scutoff) + lpz);\r\n\t// Clip and saturate\n bpz = bpz > 32 ? 32 : bpz < -32 ? -32 : bpz;\n lpz = lpz > 32 ? 32 : lpz < -32 ? -32 : lpz;\n bpz = bpz * (1 - (abs(bpz) * 0.015625));\n lpz = lpz * (1 - (abs(lpz) * 0.015625));\r\n\n\t// Apply filter to sample\n sample = filter == 1 ? lpz : filter == 2 ? hp : filter == 3 ? bpz : sample;\n // End Filter\n\n // Normalize from -0.5 0.5 to 0. 1.\n sample = sample + 0.5;\n\n // Clip & Wrap\n sample = wrap == 0 ? clamp(sample, 0, 1) : clamp((sample + 1000) % 1, 0, 1);\n\n // Apply Resolution\n sbits = pow(int(2), int(bits));\n sample = (float(int(sample * sbits)) / sbits) + (1 / sbits);\n\tsmooth = fsync_enable == 1? 0 : 0.8;\r\n\t\n poke(wavetable, sample, index, 0, smooth, overdubmode=\"mix\", boundmode=\"ignore\", index=\"samples\", channelmode=\"ignore\");\n poke(wavetabledisplay, sample, index, 0, 0, overdubmode=\"mix\", boundmode=\"ignore\", index=\"samples\", channelmode=\"ignore\");\n}\n\nout1 = sample;\nout2 = index;\n",
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-3",
Expand Down Expand Up @@ -10054,6 +10054,7 @@
"description" : "",
"digest" : "",
"tags" : "",
"visible" : 1,
"boxes" : [ {
"box" : {
"fontname" : "Arial Bold",
Expand Down

0 comments on commit ecb27f2

Please sign in to comment.