From f9b27fddb587cc044f6d6e0e1b7844ad1318f9c0 Mon Sep 17 00:00:00 2001 From: delucis Date: Tue, 10 Mar 2015 22:39:19 -0400 Subject: [PATCH] Added input parameters check for non-number input --- .../cs.audio-harmonizer.maxpat | 387 +++++++++++++++++- 1 file changed, 372 insertions(+), 15 deletions(-) diff --git a/cs.audio-harmonizer/cs.audio-harmonizer.maxpat b/cs.audio-harmonizer/cs.audio-harmonizer.maxpat index cb0b2bc..6ea1ee3 100644 --- a/cs.audio-harmonizer/cs.audio-harmonizer.maxpat +++ b/cs.audio-harmonizer/cs.audio-harmonizer.maxpat @@ -8,7 +8,7 @@ "architecture" : "x86" } , - "rect" : [ 0.0, 44.0, 869.0, 706.0 ], + "rect" : [ 0.0, 44.0, 873.0, 706.0 ], "bglocked" : 0, "openinpresentation" : 1, "default_fontsize" : 12.0, @@ -28,6 +28,354 @@ "digest" : "", "tags" : "", "boxes" : [ { + "box" : { + "fontname" : "Helvetica Neue", + "fontsize" : 12.0, + "id" : "obj-74", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 6, + "minor" : 1, + "revision" : 9, + "architecture" : "x86" + } +, + "rect" : [ 288.0, 53.0, 347.0, 357.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Helvetica Neue", + "gridonopen" : 0, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 0, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "boxanimatetime" : 200, + "imprint" : 0, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "boxes" : [ { + "box" : { + "fontname" : "Helvetica Neue", + "fontsize" : 12.0, + "id" : "obj-86", + "maxclass" : "message", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 30.0, 223.5, 282.0, 18.0 ], + "text" : "Error: your list contains items that are not numbers" + } + + } +, { + "box" : { + "fontname" : "Helvetica Neue", + "fontsize" : 12.0, + "id" : "obj-46", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 30.0, 254.0, 116.0, 20.0 ], + "text" : "print #1-harmonizer" + } + + } +, { + "box" : { + "fontname" : "Helvetica Neue", + "fontsize" : 12.0, + "id" : "obj-7", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 15.0, 285.0, 163.0, 20.0 ], + "text" : "v #1-harmonizer-parameters" + } + + } +, { + "box" : { + "fontname" : "Helvetica Neue", + "fontsize" : 12.0, + "id" : "obj-6", + "maxclass" : "newobj", + "numinlets" : 3, + "numoutlets" : 3, + "outlettype" : [ "bang", "bang", "" ], + "patching_rect" : [ 15.0, 195.0, 46.0, 20.0 ], + "text" : "sel 0 1" + } + + } +, { + "box" : { + "fontname" : "Helvetica Neue", + "fontsize" : 12.0, + "id" : "obj-5", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "int" ], + "patching_rect" : [ 15.0, 165.0, 315.0, 20.0 ], + "text" : "i 0" + } + + } +, { + "box" : { + "fontname" : "Helvetica Neue", + "fontsize" : 11.0, + "frgb" : 0.0, + "id" : "obj-4", + "linecount" : 2, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 45.0, 99.5, 120.0, 32.0 ], + "presentation_rect" : [ 72.0, 199.5, 0.0, 0.0 ], + "text" : "sets flag if a list item does not match", + "textcolor" : [ 0.5, 0.5, 0.5, 1.0 ], + "textjustification" : 2 + } + + } +, { + "box" : { + "fontname" : "Helvetica Neue", + "fontsize" : 12.0, + "frgb" : 0.0, + "id" : "obj-93", + "linecount" : 2, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 45.0, 8.5, 285.0, 34.0 ], + "text" : "make sure list is made up of only numbers (float or int; positive or negative)" + } + + } +, { + "box" : { + "fontname" : "Helvetica Neue", + "fontsize" : 12.0, + "id" : "obj-2", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "int" ], + "patching_rect" : [ 255.0, 135.0, 24.0, 20.0 ], + "text" : "t 1" + } + + } +, { + "box" : { + "fontname" : "Helvetica Neue", + "fontsize" : 12.0, + "id" : "obj-1", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 3, + "outlettype" : [ "bang", "", "int" ], + "patching_rect" : [ 15.0, 45.0, 315.0, 20.0 ], + "text" : "t b l 0" + } + + } +, { + "box" : { + "fontname" : "Helvetica Neue", + "fontsize" : 12.0, + "id" : "obj-70", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 165.0, 75.0, 27.0, 20.0 ], + "text" : "iter" + } + + } +, { + "box" : { + "fontname" : "Arial", + "fontsize" : 13.0, + "id" : "obj-61", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 5, + "outlettype" : [ "", "", "", "", "" ], + "patching_rect" : [ 165.0, 105.0, 141.0, 21.0 ], + "text" : "regexp \\\\-?\\\\d+(\\\\.\\\\d*)?" + } + + } +, { + "box" : { + "comment" : "", + "id" : "obj-72", + "maxclass" : "inlet", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 15.0, 15.0, 25.0, 25.0 ] + } + + } +, { + "box" : { + "comment" : "", + "id" : "obj-73", + "maxclass" : "outlet", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 15.0, 315.0, 25.0, 25.0 ] + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-5", 1 ], + "disabled" : 0, + "hidden" : 0, + "source" : [ "obj-1", 2 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-5", 0 ], + "disabled" : 0, + "hidden" : 0, + "source" : [ "obj-1", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-70", 0 ], + "disabled" : 0, + "hidden" : 0, + "source" : [ "obj-1", 1 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-5", 1 ], + "disabled" : 0, + "hidden" : 0, + "source" : [ "obj-2", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-6", 0 ], + "disabled" : 0, + "hidden" : 0, + "source" : [ "obj-5", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-7", 0 ], + "disabled" : 0, + "hidden" : 0, + "source" : [ "obj-6", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-86", 0 ], + "disabled" : 0, + "hidden" : 0, + "source" : [ "obj-6", 1 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-2", 0 ], + "disabled" : 0, + "hidden" : 0, + "source" : [ "obj-61", 3 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-73", 0 ], + "disabled" : 0, + "hidden" : 0, + "source" : [ "obj-7", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-61", 0 ], + "disabled" : 0, + "hidden" : 0, + "source" : [ "obj-70", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-1", 0 ], + "disabled" : 0, + "hidden" : 0, + "source" : [ "obj-72", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-46", 0 ], + "disabled" : 0, + "hidden" : 0, + "source" : [ "obj-86", 0 ] + } + + } + ] + } +, + "patching_rect" : [ 586.75, 360.0, 116.0, 20.0 ], + "saved_object_attributes" : { + "default_fontface" : 0, + "default_fontname" : "Helvetica Neue", + "default_fontsize" : 12.0, + "description" : "", + "digest" : "", + "fontface" : 0, + "fontname" : "Helvetica Neue", + "fontsize" : 12.0, + "globalpatchername" : "", + "tags" : "" + } +, + "text" : "p is-list-of-numbers" + } + + } +, { "box" : { "fontname" : "Helvetica Neue", "fontsize" : 12.0, @@ -35,7 +383,7 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 586.75, 540.0, 119.0, 20.0 ], + "patching_rect" : [ 586.75, 570.0, 119.0, 20.0 ], "text" : "s #1-to-harm-transp" } @@ -63,7 +411,7 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 630.0, 510.0, 101.0, 20.0 ], + "patching_rect" : [ 630.0, 540.0, 101.0, 20.0 ], "text" : "s #1-to-harm-vol" } @@ -130,7 +478,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 50.0, 17.5, 180.0, 34.0 ], + "patching_rect" : [ 50.0, 8.5, 180.0, 34.0 ], "text" : "make sure list is made up of pairs (even number of items)" } @@ -308,7 +656,7 @@ ] } , - "patching_rect" : [ 586.75, 360.0, 95.0, 20.0 ], + "patching_rect" : [ 586.75, 390.0, 95.0, 20.0 ], "saved_object_attributes" : { "default_fontface" : 0, "default_fontname" : "Helvetica Neue", @@ -335,7 +683,7 @@ "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 630.0, 420.0, 32.5, 20.0 ], + "patching_rect" : [ 630.0, 450.0, 32.5, 20.0 ], "text" : "t l l" } @@ -349,7 +697,7 @@ "numinlets" : 2, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 586.75, 390.0, 58.0, 20.0 ], + "patching_rect" : [ 586.75, 420.0, 58.0, 20.0 ], "text" : "zl.delace" } @@ -362,7 +710,7 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 645.0, 480.0, 123.0, 20.0 ], + "patching_rect" : [ 645.0, 510.0, 123.0, 20.0 ], "text" : "s #1-harmonizer-size" } @@ -376,7 +724,7 @@ "numinlets" : 2, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 645.0, 450.0, 38.0, 20.0 ], + "patching_rect" : [ 645.0, 480.0, 38.0, 20.0 ], "text" : "zl.len" } @@ -1072,7 +1420,7 @@ "presentation_rect" : [ 105.0, 80.0, 105.0, 50.0 ], "setminmax" : [ 0.0, 1.0 ], "signed" : 1, - "size" : 5, + "size" : 7, "slidercolor" : [ 0.94902, 0.376471, 0.0, 1.0 ], "thickness" : 4, "varname" : "transp-vol" @@ -1101,7 +1449,7 @@ "presentation_rect" : [ 0.0, 80.0, 105.0, 50.0 ], "setminmax" : [ -12.0, 12.0 ], "signed" : 1, - "size" : 5, + "size" : 7, "slidercolor" : [ 0.94902, 0.376471, 0.0, 1.0 ], "thickness" : 4, "varname" : "transp-amt" @@ -1243,12 +1591,12 @@ "restore" : { "#1-voices" : [ 7 ], "live.gain~" : [ 0.0 ], - "transp-amt" : [ 2.0, 0.0, -8.0, -12.0, 0.0 ], - "transp-vol" : [ 0.2, 0.5, 0.4, 0.8, 0.0 ] + "transp-amt" : [ 2.0, 0.0, -8.0, -12.0, 0.0, 0.0, 0.0 ], + "transp-vol" : [ 0.2, 0.5, 0.4, 0.8, 0.0, 0.0, 0.0 ] } , "text" : "autopattr", - "varname" : "u751007280" + "varname" : "u160000749" } } @@ -1750,7 +2098,7 @@ "destination" : [ "obj-1", 0 ], "disabled" : 0, "hidden" : 0, - "midpoints" : [ 100.833, 254.0, 15.0, 254.0, 15.0, 417.0, 24.5, 417.0 ], + "midpoints" : [ 100.833, 254.0, 15.0, 254.0, 15.0, 489.0, 24.5, 489.0 ], "source" : [ "obj-43", 0 ] } @@ -1805,6 +2153,15 @@ "destination" : [ "obj-127", 0 ], "disabled" : 0, "hidden" : 0, + "source" : [ "obj-74", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-74", 0 ], + "disabled" : 0, + "hidden" : 0, "source" : [ "obj-91", 0 ] }