Multiple sounds into Buffer~ ?


    Apr 03 2013 | 5:52 pm
    Hi,
    I'm just wondering if it possible to change the audio file going into a buffer. I'm creating an app with a Hiphop, rock and ambient option so I want the user to be able to click Hiphop and the sound to change. I'm currently trying a button into a message with replace file then into the buffer but it doesn't seen to be changing the audio file.
    Any help would be appreciated :)
    Thanks, Nat { "boxes" : [ { "box" : { "maxclass" : "flonum", "numinlets" : 1, "patching_rect" : [ 1102.0, 748.0, 50.0, 21.0 ], "id" : "obj-252", "fontname" : "Arial", "numoutlets" : 2, "parameter_enable" : 0, "outlettype" : [ "float", "bang" ], "fontsize" : 13.0 }
    } , { "box" : { "maxclass" : "message", "text" : "0.125", "numinlets" : 2, "patching_rect" : [ 1190.0, 710.0, 41.0, 18.0 ], "id" : "obj-247", "fontname" : "Arial", "numoutlets" : 1, "outlettype" : [ "" ], "fontsize" : 12.0, "presentation_rect" : [ 1197.5, 746.0, 0.0, 0.0 ] }
    } , { "box" : { "maxclass" : "message", "text" : "0.05", "numinlets" : 2, "patching_rect" : [ 1113.5, 718.0, 34.0, 18.0 ], "id" : "obj-123", "fontname" : "Arial", "numoutlets" : 1, "outlettype" : [ "" ], "fontsize" : 12.0 }
    } , { "box" : { "maxclass" : "button", "numinlets" : 1, "patching_rect" : [ 1791.0, 371.0, 20.0, 20.0 ], "id" : "obj-282", "numoutlets" : 1, "outlettype" : [ "bang" ] }
    } , { "box" : { "maxclass" : "button", "numinlets" : 1, "patching_rect" : [ 1592.25, 361.0, 20.0, 20.0 ], "id" : "obj-281", "numoutlets" : 1, "outlettype" : [ "bang" ] }
    } , { "box" : { "maxclass" : "button", "numinlets" : 1, "patching_rect" : [ 1730.0, 308.0, 20.0, 20.0 ], "id" : "obj-280", "numoutlets" : 1, "outlettype" : [ "bang" ] }
    } , { "box" : { "maxclass" : "message", "text" : "replace horn2.wav", "numinlets" : 2, "patching_rect" : [ 1592.25, 409.0, 109.0, 18.0 ], "id" : "obj-279", "fontname" : "Arial", "numoutlets" : 1, "outlettype" : [ "" ], "fontsize" : 12.0 }
    } , { "box" : { "maxclass" : "message", "text" : "replace Rock2.wav", "numinlets" : 2, "patching_rect" : [ 1791.0, 409.0, 112.0, 18.0 ], "id" : "obj-278", "fontname" : "Arial", "numoutlets" : 1, "outlettype" : [ "" ], "fontsize" : 12.0 }
    } , { "box" : { "maxclass" : "message", "text" : "Hiphop2.wav", "numinlets" : 2, "patching_rect" : [ 1729.0, 346.0, 80.0, 18.0 ], "id" : "obj-277", "fontname" : "Arial", "numoutlets" : 1, "outlettype" : [ "" ], "fontsize" : 12.0 }
    } , { "box" : { "maxclass" : "newobj", "text" : "biquad~", "numinlets" : 6, "patching_rect" : [ 1144.5, 1423.760986, 92.0, 21.0 ], "id" : "obj-66", "fontname" : "Arial", "numoutlets" : 1, "outlettype" : [ "signal" ], "fontsize" : 13.0 }
    } , { "box" : { "maxclass" : "newobj", "text" : "biquad~", "numinlets" : 6, "patching_rect" : [ 677.5, 941.760925, 92.0, 21.0 ], "id" : "obj-124", "fontname" : "Arial", "numoutlets" : 1, "outlettype" : [ "signal" ], "fontsize" : 13.0 }
    } , { "box" : { "maxclass" : "newobj", "text" : "s l1l", "numinlets" : 1, "patching_rect" : [ 1872.0, 521.0, 32.0, 20.0 ], "id" : "obj-172", "fontname" : "Arial", "numoutlets" : 0, "fontsize" : 12.0 }
    } , { "box" : { "maxclass" : "newobj", "text" : "s l1l", "numinlets" : 1, "patching_rect" : [ 1872.0, 521.0, 32.0, 20.0 ], "id" : "obj-18", "fontname" : "Arial", "numoutlets" : 0, "fontsize" : 12.0 }
    } , { "box" : { "maxclass" : "newobj", "text" : "info~ loop1", "numinlets" : 1, "patching_rect" : [ 1791.0, 492.0, 113.5, 20.0 ], "id" : "obj-171", "fontname" : "Arial", "numoutlets" : 8, "outlettype" : [ "float", "list", "float", "float", "float", "float", "float", "" ], "fontsize" : 12.0 }
    } , { "box" : { "maxclass" : "newobj", "text" : "buffer~ loop1", "numinlets" : 1, "patching_rect" : [ 1729.0, 460.0, 81.0, 20.0 ], "id" : "obj-173", "fontname" : "Arial", "numoutlets" : 2, "outlettype" : [ "float", "bang" ], "fontsize" : 12.0 }
    } , { "box" : { "maxclass" : "newobj", "text" : "r l1l", "numinlets" : 0, "patching_rect" : [ 750.5, 822.0, 30.0, 20.0 ], "id" : "obj-19", "fontname" : "Arial", "numoutlets" : 1, "outlettype" : [ "" ], "fontsize" : 12.0 }
    } , { "box" : { "maxclass" : "newobj", "text" : "*~", "numinlets" : 2, "patching_rect" : [ 737.0, 853.0, 32.5, 20.0 ], "id" : "obj-153", "fontname" : "Arial", "numoutlets" : 1, "outlettype" : [ "signal" ], "fontsize" : 12.0 }
    } , { "box" : { "maxclass" : "newobj", "text" : "play~ loop1", "numinlets" : 1, "patching_rect" : [ 737.0, 894.0, 72.0, 20.0 ], "id" : "obj-154", "fontname" : "Arial", "numoutlets" : 2, "outlettype" : [ "signal", "bang" ], "fontsize" : 12.0 }
    } , { "box" : { "maxclass" : "newobj", "text" : "phasor~", "numinlets" : 2, "patching_rect" : [ 1100.0, 775.0, 54.0, 20.0 ], "id" : "obj-1", "fontname" : "Arial", "numoutlets" : 1, "outlettype" : [ "signal" ], "fontsize" : 12.0 }
    } , { "box" : { "maxclass" : "gain~", "interp" : 103.0, "numinlets" : 2, "patching_rect" : [ 719.0, 989.0, 22.0, 140.0 ], "id" : "obj-140", "numoutlets" : 2, "parameter_enable" : 0, "outlettype" : [ "signal", "int" ] }
    } , { "box" : { "maxclass" : "ezdac~", "numinlets" : 2, "patching_rect" : [ 1131.0177, 1469.0, 45.0, 45.0 ], "id" : "obj-45", "numoutlets" : 0 }
    } , { "box" : { "maxclass" : "gain~", "interp" : 103.0, "numinlets" : 2, "patching_rect" : [ 1144.5, 1273.0, 53.0, 141.0 ], "id" : "obj-193", "numoutlets" : 2, "parameter_enable" : 0, "outlettype" : [ "signal", "int" ] }
    } ], "lines" : [ { "patchline" : { "source" : [ "obj-247", 0 ], "destination" : [ "obj-252", 0 ], "hidden" : 0, "disabled" : 0 }
    } , { "patchline" : { "source" : [ "obj-252", 0 ], "destination" : [ "obj-1", 0 ], "hidden" : 0, "disabled" : 0 }
    } , { "patchline" : { "source" : [ "obj-123", 0 ], "destination" : [ "obj-252", 0 ], "hidden" : 0, "disabled" : 0 }
    } , { "patchline" : { "source" : [ "obj-282", 0 ], "destination" : [ "obj-247", 0 ], "hidden" : 0, "midpoints" : [ 1800.5, 393.0, 1386.0, 393.0, 1386.0, 705.0, 1199.5, 705.0 ], "disabled" : 0 }
    } , { "patchline" : { "source" : [ "obj-66", 0 ], "destination" : [ "obj-45", 0 ], "hidden" : 0, "midpoints" : [ 1154.0, 1461.0, 1140.5177, 1461.0 ], "disabled" : 0 }
    } , { "patchline" : { "source" : [ "obj-66", 0 ], "destination" : [ "obj-45", 1 ], "hidden" : 0, "midpoints" : [ 1154.0, 1461.0, 1166.5177, 1461.0 ], "disabled" : 0 }
    } , { "patchline" : { "source" : [ "obj-282", 0 ], "destination" : [ "obj-278", 0 ], "hidden" : 0, "disabled" : 0 }
    } , { "patchline" : { "source" : [ "obj-281", 0 ], "destination" : [ "obj-279", 0 ], "hidden" : 0, "disabled" : 0 }
    } , { "patchline" : { "source" : [ "obj-280", 0 ], "destination" : [ "obj-277", 0 ], "hidden" : 0, "disabled" : 0 }
    } , { "patchline" : { "source" : [ "obj-280", 0 ], "destination" : [ "obj-123", 0 ], "hidden" : 0, "midpoints" : [ 1739.5, 330.0, 1386.0, 330.0, 1386.0, 705.0, 1123.0, 705.0 ], "disabled" : 0 }
    } , { "patchline" : { "source" : [ "obj-279", 0 ], "destination" : [ "obj-173", 0 ], "hidden" : 0, "disabled" : 0 }
    } , { "patchline" : { "source" : [ "obj-278", 0 ], "destination" : [ "obj-173", 0 ], "hidden" : 0, "disabled" : 0 }
    } , { "patchline" : { "source" : [ "obj-277", 0 ], "destination" : [ "obj-173", 0 ], "hidden" : 0, "disabled" : 0 }
    } , { "patchline" : { "source" : [ "obj-193", 0 ], "destination" : [ "obj-66", 0 ], "hidden" : 0, "disabled" : 0 }
    } , { "patchline" : { "source" : [ "obj-19", 0 ], "destination" : [ "obj-153", 1 ], "hidden" : 0, "disabled" : 0 }
    } , { "patchline" : { "source" : [ "obj-173", 1 ], "destination" : [ "obj-171", 0 ], "hidden" : 0, "disabled" : 0 }
    } , { "patchline" : { "source" : [ "obj-171", 6 ], "destination" : [ "obj-18", 0 ], "hidden" : 0, "disabled" : 0 }
    } , { "patchline" : { "source" : [ "obj-154", 0 ], "destination" : [ "obj-124", 0 ], "hidden" : 0, "midpoints" : [ 746.5, 927.380493, 687.0, 927.380493 ], "disabled" : 0 }
    } , { "patchline" : { "source" : [ "obj-153", 0 ], "destination" : [ "obj-154", 0 ], "hidden" : 0, "disabled" : 0 }
    } , { "patchline" : { "source" : [ "obj-140", 0 ], "destination" : [ "obj-193", 0 ], "hidden" : 0, "midpoints" : [ 728.0, 1177.0, 1154.0, 1177.0 ], "disabled" : 0 }
    } , { "patchline" : { "source" : [ "obj-124", 0 ], "destination" : [ "obj-140", 0 ], "hidden" : 0, "midpoints" : [ 687.0, 975.380493, 728.0, 975.380493 ], "disabled" : 0 }
    } , { "patchline" : { "source" : [ "obj-1", 0 ], "destination" : [ "obj-153", 0 ], "hidden" : 0, "midpoints" : [ 1109.5, 815.5, 746.5, 815.5 ], "disabled" : 0 }
    } ], "appversion" : { "major" : 6, "minor" : 0, "revision" : 4 }
    }

    • Apr 03 2013 | 5:57 pm
      Make sure that the audio files you are trying to load are in the Max search path, a handy place is to keep them in the same folder as the patch itself.
      Also look at this http://www.youtube.com/watch?v=34cxCjPU_Ts&feature=youtu.be to see how to attach compressed versions of your code.
    • Apr 03 2013 | 5:58 pm
      I've just saved and closed and reopened and that seems to have done the trick.
      Thanks anyway:)