{ "patcher" : { "fileversion" : 1, "appversion" : { "major" : 7, "minor" : 0, "revision" : 0, "architecture" : "x86", "modernui" : 1 } , "rect" : [ 86.0, 78.0, 845.0, 589.0 ], "bgcolor" : [ 0.721569, 0.737255, 0.85098, 1.0 ], "editing_bgcolor" : [ 0.721569, 0.737255, 0.85098, 1.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, "default_fontface" : 0, "default_fontname" : "Arial", "gridonopen" : 1, "gridsize" : [ 15.0, 15.0 ], "gridsnaponopen" : 1, "objectsnaponopen" : 1, "statusbarvisible" : 2, "toolbarvisible" : 1, "lefttoolbarpinned" : 0, "toptoolbarpinned" : 0, "righttoolbarpinned" : 0, "bottomtoolbarpinned" : 0, "toolbars_unpinned_last_save" : 0, "tallnewobj" : 0, "boxanimatetime" : 200, "enablehscroll" : 1, "enablevscroll" : 1, "devicewidth" : 0.0, "description" : "", "digest" : "", "tags" : "", "style" : "", "subpatcher_template" : "IceCubeTray", "boxes" : [ { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-66", "linecount" : 3, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 645.0, 451.5, 150.0, 47.0 ], "style" : "", "text" : "The trigger object can be used to convert floats to ints and vice versa" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-64", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "int", "float" ], "patching_rect" : [ 552.5, 465.0, 57.0, 22.0 ], "style" : "", "text" : "trigger i f" } } , { "box" : { "fontface" : 2, "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-63", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 552.5, 540.0, 45.0, 20.0 ], "style" : "", "text" : "Int" } } , { "box" : { "fontface" : 2, "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-62", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 480.0, 540.0, 45.0, 20.0 ], "style" : "", "text" : "Int" } } , { "box" : { "fontface" : 2, "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-61", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 552.5, 390.0, 45.0, 20.0 ], "style" : "", "text" : "Int" } } , { "box" : { "fontface" : 2, "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-60", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 419.0, 390.0, 45.0, 20.0 ], "style" : "", "text" : "Float" } } , { "box" : { "fontface" : 2, "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-59", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 420.0, 540.0, 45.0, 20.0 ], "style" : "", "text" : "Float" } } , { "box" : { "fontface" : 2, "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-58", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 615.0, 540.0, 45.0, 20.0 ], "style" : "", "text" : "Float" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "format" : 6, "id" : "obj-56", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 615.0, 510.0, 50.0, 22.0 ], "style" : "" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-55", "maxclass" : "number", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 552.5, 510.0, 50.0, 22.0 ], "style" : "" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-54", "maxclass" : "number", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 552.5, 420.0, 50.0, 22.0 ], "style" : "" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-53", "maxclass" : "number", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 480.0, 510.0, 50.0, 22.0 ], "style" : "" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "format" : 6, "id" : "obj-51", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 420.0, 510.0, 50.0, 22.0 ], "style" : "" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-50", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "float", "int" ], "patching_rect" : [ 420.0, 465.0, 57.0, 22.0 ], "style" : "", "text" : "trigger f i" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "format" : 6, "id" : "obj-49", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 420.0, 420.0, 50.0, 22.0 ], "style" : "" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-47", "linecount" : 6, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 600.0, 225.0, 180.0, 87.0 ], "style" : "", "text" : "Note the arrangement of patch cords and set messages. This allows one to adjust either flonum object by clicking and dragging, and to see the result in the other flonum immediately." } } , { "box" : { "fontface" : 2, "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-45", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 540.0, 150.0, 75.0, 20.0 ], "style" : "", "text" : "Fahrenheit" } } , { "box" : { "fontface" : 2, "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-44", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 420.0, 150.0, 60.0, 20.0 ], "style" : "", "text" : "Celsius" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-42", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 540.0, 330.0, 43.0, 22.0 ], "style" : "", "text" : "set $1" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-41", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "float" ], "patching_rect" : [ 540.0, 285.0, 32.5, 22.0 ], "style" : "", "text" : "/ 9." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-40", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "float" ], "patching_rect" : [ 540.0, 255.0, 32.5, 22.0 ], "style" : "", "text" : "* 5." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-39", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "float" ], "patching_rect" : [ 540.0, 225.0, 35.0, 22.0 ], "style" : "", "text" : "- 32." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-36", "maxclass" : "message", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 420.0, 330.0, 43.0, 22.0 ], "style" : "", "text" : "set $1" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "format" : 6, "id" : "obj-34", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 540.0, 190.0, 50.0, 22.0 ], "style" : "" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-31", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "float" ], "patching_rect" : [ 420.0, 285.0, 38.0, 22.0 ], "style" : "", "text" : "+ 32." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-30", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "float" ], "patching_rect" : [ 420.0, 255.0, 32.5, 22.0 ], "style" : "", "text" : "/ 5." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-29", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "float" ], "patching_rect" : [ 420.0, 225.0, 32.5, 22.0 ], "style" : "", "text" : "* 9." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "format" : 6, "id" : "obj-28", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 420.0, 190.0, 50.0, 22.0 ], "style" : "" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-26", "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 420.0, 90.0, 390.0, 33.0 ], "style" : "", "text" : "We can use floating point math to make a patch which converts between degrees Celsius and Fahrenheit " } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-24", "linecount" : 5, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 165.0, 435.0, 236.0, 74.0 ], "style" : "", "text" : "In this example, note that floating point division returns a floating point value. Compare with the div and mod arrangement we used with integers in Patch 7-011." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "format" : 6, "id" : "obj-22", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 75.0, 525.0, 50.0, 22.0 ], "style" : "" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-21", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "float" ], "patching_rect" : [ 75.0, 480.0, 41.0, 22.0 ], "style" : "", "text" : "/ 3.14" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "format" : 6, "id" : "obj-20", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 75.0, 435.0, 50.0, 22.0 ], "style" : "" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-18", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 165.0, 360.0, 236.0, 20.0 ], "style" : "", "text" : "Another flonum object displays the result." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-16", "linecount" : 4, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 165.0, 285.0, 236.0, 60.0 ], "style" : "", "text" : "We have to give our arithmetic operators a floating point parameter (zero in this case) so they don't convert their output to an integer" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-14", "linecount" : 4, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 165.0, 210.0, 238.0, 60.0 ], "style" : "", "text" : "We've used this trick before, to make both inlets hot. Note that we pass the f parameter to trigger when we want it to forward a floating point number." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-12", "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 165.0, 165.0, 236.0, 33.0 ], "style" : "", "text" : "These are flonum objects. Note the decimal points." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "format" : 6, "id" : "obj-10", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 75.0, 360.0, 50.0, 22.0 ], "style" : "" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-9", "maxclass" : "newobj", "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "float" ], "patching_rect" : [ 75.0, 285.0, 32.5, 22.0 ], "style" : "", "text" : "+ 0." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-8", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "bang", "float" ], "patching_rect" : [ 90.0, 210.0, 61.0, 22.0 ], "style" : "", "text" : "trigger b f" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "format" : 6, "id" : "obj-7", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 90.0, 165.0, 50.0, 22.0 ], "style" : "" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "format" : 6, "id" : "obj-6", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 30.0, 165.0, 50.0, 22.0 ], "style" : "" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-5", "linecount" : 4, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 30.0, 90.0, 373.0, 60.0 ], "style" : "", "text" : "So far, when we have used numbers they have mostly been integers \n(0, 1, 2, ...). Max can also deal with numbers that have a decimal place. These are known as floating point numbers. Display them with a flonum object." } } , { "box" : { "bubble" : 1, "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-2", "linecount" : 3, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 15.0, 15.0, 315.0, 51.0 ], "style" : "", "text" : "Patch 7-013. Floating Point Numbers\nWilliam J Turkel\nhttp://williamjturkel.net/code/#programming" } } , { "box" : { "angle" : 0.0, "bgcolor" : [ 1.0, 1.0, 1.0, 0.0 ], "border" : 1, "id" : "obj-3", "maxclass" : "panel", "mode" : 0, "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 15.0, 75.0, 810.0, 495.0 ], "proportion" : 0.39, "rounded" : 20, "style" : "" } } ], "lines" : [ { "patchline" : { "destination" : [ "obj-21", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-20", 0 ] } } , { "patchline" : { "destination" : [ "obj-22", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-21", 0 ] } } , { "patchline" : { "destination" : [ "obj-29", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-28", 0 ] } } , { "patchline" : { "destination" : [ "obj-30", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-29", 0 ] } } , { "patchline" : { "destination" : [ "obj-31", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-30", 0 ] } } , { "patchline" : { "destination" : [ "obj-36", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-31", 0 ] } } , { "patchline" : { "destination" : [ "obj-39", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-34", 0 ] } } , { "patchline" : { "destination" : [ "obj-34", 0 ], "disabled" : 0, "hidden" : 0, "midpoints" : [ 429.5, 360.0, 509.0, 360.0, 509.0, 179.0, 549.5, 179.0 ], "source" : [ "obj-36", 0 ] } } , { "patchline" : { "destination" : [ "obj-40", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-39", 0 ] } } , { "patchline" : { "destination" : [ "obj-41", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-40", 0 ] } } , { "patchline" : { "destination" : [ "obj-42", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-41", 0 ] } } , { "patchline" : { "destination" : [ "obj-28", 0 ], "disabled" : 0, "hidden" : 0, "midpoints" : [ 549.5, 348.0, 480.0, 348.0, 480.0, 177.0, 429.5, 177.0 ], "source" : [ "obj-42", 0 ] } } , { "patchline" : { "destination" : [ "obj-50", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-49", 0 ] } } , { "patchline" : { "destination" : [ "obj-51", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-50", 0 ] } } , { "patchline" : { "destination" : [ "obj-53", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-50", 1 ] } } , { "patchline" : { "destination" : [ "obj-64", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-54", 0 ] } } , { "patchline" : { "destination" : [ "obj-9", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-6", 0 ] } } , { "patchline" : { "destination" : [ "obj-55", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-64", 0 ] } } , { "patchline" : { "destination" : [ "obj-56", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-64", 1 ] } } , { "patchline" : { "destination" : [ "obj-8", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-7", 0 ] } } , { "patchline" : { "destination" : [ "obj-9", 1 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-8", 1 ] } } , { "patchline" : { "destination" : [ "obj-9", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-8", 0 ] } } , { "patchline" : { "destination" : [ "obj-10", 0 ], "disabled" : 0, "hidden" : 0, "source" : [ "obj-9", 0 ] } } ], "dependency_cache" : [ ], "embedsnapshot" : 0, "default_bgcolor" : [ 0.207843, 0.215686, 0.278431, 1.0 ], "color" : [ 0.901961, 0.901961, 0.901961, 1.0 ], "elementcolor" : [ 0.376471, 0.407843, 0.619608, 1.0 ], "accentcolor" : [ 0.552941, 0.588235, 0.85098, 1.0 ], "selectioncolor" : [ 0.552941, 0.588235, 0.85098, 1.0 ], "textcolor" : [ 0.090196, 0.07451, 0.07451, 1.0 ], "textcolor_inverse" : [ 0.721569, 0.737255, 0.85098, 1.0 ], "patchlinecolor" : [ 0.207843, 0.215686, 0.278431, 0.9 ], "bgfillcolor_type" : "gradient", "bgfillcolor_color1" : [ 0.376471, 0.407843, 0.619608, 1.0 ], "bgfillcolor_color2" : [ 0.376471, 0.407843, 0.619608, 1.0 ], "bgfillcolor_color" : [ 0.290196, 0.309804, 0.301961, 1.0 ], "bgfillcolor_angle" : 270.0, "bgfillcolor_proportion" : 0.39 } }