{ "patcher" : { "fileversion" : 1, "appversion" : { "major" : 6, "minor" : 0, "revision" : 8 } , "rect" : [ 265.0, 269.0, 838.0, 588.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, "default_fontface" : 0, "default_fontname" : "Arial", "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" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-66", "linecount" : 3, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 645.0, 451.5, 150.0, 47.0 ], "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, 20.0 ], "text" : "trigger i f" } } , { "box" : { "fontface" : 2, "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-63", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 552.5, 540.0, 45.0, 20.0 ], "presentation_rect" : [ 552.0, 525.0, 0.0, 0.0 ], "text" : "Int" } } , { "box" : { "fontface" : 2, "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-62", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 480.0, 540.0, 45.0, 20.0 ], "presentation_rect" : [ 481.5, 530.0, 0.0, 0.0 ], "text" : "Int" } } , { "box" : { "fontface" : 2, "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-61", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 552.5, 390.0, 45.0, 20.0 ], "presentation_rect" : [ 548.0, 379.0, 0.0, 0.0 ], "text" : "Int" } } , { "box" : { "fontface" : 2, "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-60", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 419.0, 390.0, 45.0, 20.0 ], "presentation_rect" : [ 414.0, 376.0, 0.0, 0.0 ], "text" : "Float" } } , { "box" : { "fontface" : 2, "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-59", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 420.0, 540.0, 45.0, 20.0 ], "presentation_rect" : [ 423.0, 528.0, 0.0, 0.0 ], "text" : "Float" } } , { "box" : { "fontface" : 2, "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-58", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 615.0, 540.0, 45.0, 20.0 ], "text" : "Float" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-56", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "float", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 615.0, 510.0, 50.0, 20.0 ], "presentation_rect" : [ 622.0, 529.0, 0.0, 0.0 ] } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-55", "maxclass" : "number", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "int", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 552.5, 510.0, 50.0, 20.0 ], "presentation_rect" : [ 556.5, 521.0, 0.0, 0.0 ] } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-54", "maxclass" : "number", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "int", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 552.5, 420.0, 50.0, 20.0 ], "presentation_rect" : [ 550.0, 441.0, 0.0, 0.0 ] } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-53", "maxclass" : "number", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "int", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 480.0, 510.0, 50.0, 20.0 ] } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-51", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "float", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 420.0, 510.0, 50.0, 20.0 ], "presentation_rect" : [ 419.0, 520.0, 0.0, 0.0 ] } } , { "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, 20.0 ], "text" : "trigger f i" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-49", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "float", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 420.0, 420.0, 50.0, 20.0 ] } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-47", "linecount" : 6, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 600.0, 225.0, 180.0, 87.0 ], "text" : "Note the arrangement of patch cords and set messages. This allows one to adjust either flonum object by clicking and draggin, and to see the result in the other flonum immediately." } } , { "box" : { "fontface" : 2, "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-45", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 540.0, 150.0, 75.0, 20.0 ], "presentation_rect" : [ 551.0, 285.0, 0.0, 0.0 ], "text" : "Fahrenheit" } } , { "box" : { "fontface" : 2, "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-44", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 420.0, 150.0, 60.0, 20.0 ], "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, 18.0 ], "presentation_rect" : [ 578.0, 464.0, 0.0, 0.0 ], "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, 20.0 ], "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, 20.0 ], "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, 20.0 ], "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, 18.0 ], "text" : "set $1" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-34", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "float", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 540.0, 190.0, 50.0, 20.0 ], "presentation_rect" : [ 579.0, 328.0, 0.0, 0.0 ] } } , { "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, 20.0 ], "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, 20.0 ], "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, 20.0 ], "text" : "* 9." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-28", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "float", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 420.0, 190.0, 50.0, 20.0 ] } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-26", "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 420.0, 90.0, 390.0, 33.0 ], "text" : "We can use floating point math to make a patch which converts between degrees Celsius and Fahrenheit " } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-24", "linecount" : 5, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 165.0, 435.0, 236.0, 74.0 ], "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 012." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-22", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "float", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 75.0, 525.0, 50.0, 20.0 ], "presentation_rect" : [ 32.0, 509.0, 0.0, 0.0 ] } } , { "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, 20.0 ], "text" : "/ 3.14" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-20", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "float", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 75.0, 435.0, 50.0, 20.0 ] } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-18", "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 165.0, 360.0, 236.0, 20.0 ], "text" : "Another flonum object displays the result." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-16", "linecount" : 4, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 165.0, 285.0, 236.0, 60.0 ], "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, "frgb" : 0.0, "id" : "obj-14", "linecount" : 4, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 165.0, 210.0, 236.0, 60.0 ], "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, "frgb" : 0.0, "id" : "obj-12", "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 165.0, 165.0, 236.0, 33.0 ], "text" : "These are flonum objects. Note the decimal points." } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-10", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "float", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 75.0, 360.0, 50.0, 20.0 ], "presentation_rect" : [ 77.0, 295.0, 0.0, 0.0 ] } } , { "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, 20.0 ], "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, 20.0 ], "text" : "trigger b f" } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-7", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "float", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 90.0, 165.0, 50.0, 20.0 ], "presentation_rect" : [ 103.0, 165.0, 0.0, 0.0 ] } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-6", "maxclass" : "flonum", "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "float", "bang" ], "parameter_enable" : 0, "patching_rect" : [ 30.0, 165.0, 50.0, 20.0 ] } } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "frgb" : 0.0, "id" : "obj-5", "linecount" : 4, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 30.0, 90.0, 371.0, 60.0 ], "text" : "So far, when we have used numbers they have 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, "frgb" : 0.0, "id" : "obj-2", "linecount" : 3, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 15.0, 15.0, 315.0, 51.0 ], "text" : "Patch 021. Floating Point Numbers\nWilliam J Turkel\nhttp://williamjturkel.net/code/#programming" } } , { "box" : { "bgcolor" : [ 1.0, 1.0, 1.0, 0.0 ], "border" : 1, "id" : "obj-3", "maxclass" : "panel", "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 15.0, 75.0, 810.0, 495.0 ], "rounded" : 20 } } ], "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" : [ ] } }