Forums > MaxMSP

Play random audio file from specific folder

April 14, 2011 | 3:10 pm

I am trying to make a patch that opens a random audio file (.aif) from a specified folder, This is what I’ve got bellow. I don’t understand what the next stage is to make this work

{
"boxes" : [ {
"box" : {
"maxclass" : "newobj",
"text" : "sprintf open %ld.aif",
"fontsize" : 12.0,
"numinlets" : 1,
"numoutlets" : 1,
"patching_rect" : [ 655.0, 689.0, 113.0, 20.0 ],
"outlettype" : [ "" ],
"id" : "obj-22",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "toggle",
"numinlets" : 1,
"numoutlets" : 1,
"patching_rect" : [ 700.0, 654.0, 20.0, 20.0 ],
"outlettype" : [ "int" ],
"id" : "obj-21"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "delay 100",
"fontsize" : 12.0,
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 700.0, 629.0, 63.0, 20.0 ],
"outlettype" : [ "bang" ],
"id" : "obj-6",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "random",
"fontsize" : 12.0,
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 655.0, 592.0, 51.0, 20.0 ],
"outlettype" : [ "int" ],
"id" : "obj-19",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "sfplay~",
"fontsize" : 12.0,
"numinlets" : 2,
"numoutlets" : 2,
"patching_rect" : [ 655.0, 725.0, 49.0, 20.0 ],
"outlettype" : [ "signal", "bang" ],
"id" : "obj-23",
"fontname" : "Arial",
"save" : [ "#N", "sfplay~", "", 1, 120960, 0, "", ";" ]
}

}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-6", 0 ],
"destination" : [ "obj-21", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-19", 0 ],
"destination" : [ "obj-22", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-21", 0 ],
"destination" : [ "obj-23", 0 ],
"hidden" : 0,
"midpoints" : [ 709.5, 681.0, 640.0, 681.0, 640.0, 720.0, 664.5, 720.0 ]
}

}
, {
"patchline" : {
"source" : [ "obj-22", 0 ],
"destination" : [ "obj-23", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
]
}


April 14, 2011 | 11:10 pm

You could use [dropfile] into [umenu], and randomly trigger files that way:

– Pasted Max Patch, click to expand. –

April 15, 2011 | 1:51 am

try this

– Pasted Max Patch, click to expand. –

April 15, 2011 | 1:52 am

change number 7 for number of files to play


December 2, 2012 | 10:30 pm

@balam, thanks for that patch :) works great


Viewing 5 posts - 1 through 5 (of 5 total)