Forums > MaxMSP

Extract full path for multiple files

January 3, 2013 | 10:21 am

Hi guys, I am trying to extract multiple files by using folder object. The objective of this component is to allow me to read audio file from folder and add it into ‘playlist’ (using coll). However there is a problem that it looks like cant be solved with my knowledge. All of the full paths of file will be stored in a qlist but there is always an additional item once it finish the reading. Example: I imported 11 songs but in the qlist, the last item was duplicated once for no reason.

If anyone can spend your little precious time to help me solve this problem, your help is truly appreciated.

{
"boxes" : [ {
"box" : {
"maxclass" : "button",
"numinlets" : 1,
"numoutlets" : 1,
"patching_rect" : [ 140.5, 105.0, 20.0, 20.0 ],
"id" : "obj-22",
"outlettype" : [ "bang" ]
}

}
, {
"box" : {
"maxclass" : "comment",
"text" : "folder (multiple file reading)",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 180.0, 58.0, 162.784424, 20.0 ],
"id" : "obj-20",
"fontname" : "Arial",
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "print folder",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 285.0, 690.0, 67.0, 20.0 ],
"id" : "obj-55",
"fontname" : "Arial",
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "print relative",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 570.0, 690.0, 76.0, 20.0 ],
"id" : "obj-54",
"fontname" : "Arial",
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "print open",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 180.0, 690.0, 64.0, 20.0 ],
"id" : "obj-53",
"fontname" : "Arial",
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "print path",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 480.0, 690.0, 61.0, 20.0 ],
"id" : "obj-17",
"fontname" : "Arial",
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "r path",
"numinlets" : 0,
"numoutlets" : 1,
"patching_rect" : [ 480.0, 660.0, 41.0, 20.0 ],
"id" : "obj-15",
"fontname" : "Arial",
"outlettype" : [ "" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "button",
"numinlets" : 1,
"numoutlets" : 1,
"patching_rect" : [ 285.0, 465.0, 20.0, 20.0 ],
"id" : "obj-16",
"outlettype" : [ "bang" ]
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "r metadatabang",
"numinlets" : 0,
"numoutlets" : 1,
"patching_rect" : [ 271.784424, 405.0, 95.0, 20.0 ],
"id" : "obj-14",
"fontname" : "Arial",
"outlettype" : [ "" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "button",
"numinlets" : 1,
"numoutlets" : 1,
"patching_rect" : [ 585.0, 600.0, 20.0, 20.0 ],
"id" : "obj-9",
"outlettype" : [ "bang" ]
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "print easy",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 390.0, 690.0, 63.0, 20.0 ],
"id" : "obj-7",
"fontname" : "Arial",
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "rewind",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 349.784424, 540.0, 46.0, 18.0 ],
"id" : "obj-5",
"fontname" : "Arial",
"outlettype" : [ "" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "next 1",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 299.784424, 522.0, 43.0, 18.0 ],
"id" : "obj-3",
"fontname" : "Arial",
"outlettype" : [ "" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "comment",
"text" : "single file",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 60.0, 58.0, 69.0, 20.0 ],
"id" : "obj-2",
"fontname" : "Arial",
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "r dropfile",
"numinlets" : 0,
"numoutlets" : 1,
"patching_rect" : [ 540.0, 90.0, 57.0, 20.0 ],
"id" : "obj-96",
"fontname" : "Arial",
"outlettype" : [ "" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "r openfolder",
"numinlets" : 0,
"numoutlets" : 1,
"patching_rect" : [ 180.0, 105.0, 75.0, 20.0 ],
"id" : "obj-97",
"fontname" : "Arial",
"outlettype" : [ "" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "r openfile",
"numinlets" : 0,
"numoutlets" : 1,
"patching_rect" : [ 60.0, 98.25, 60.0, 20.0 ],
"id" : "obj-98",
"fontname" : "Arial",
"outlettype" : [ "" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "opendialog fold",
"numinlets" : 1,
"numoutlets" : 2,
"patching_rect" : [ 180.0, 150.0, 92.0, 20.0 ],
"id" : "obj-12",
"fontname" : "Arial",
"outlettype" : [ "", "bang" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "loadbang",
"numinlets" : 1,
"numoutlets" : 1,
"patching_rect" : [ 360.0, 45.0, 60.0, 20.0 ],
"id" : "obj-101",
"fontname" : "Arial",
"outlettype" : [ "bang" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "qlist",
"numinlets" : 1,
"numoutlets" : 3,
"patching_rect" : [ 430.0, 516.75, 45.0, 21.0 ],
"id" : "obj-274",
"fontname" : "Arial",
"outlettype" : [ "", "bang", "bang" ],
"fontsize" : 13.0,
"save" : [ "#N", "qlist", ";", "#X", "insert", 500, "path", "Macintosh HD:/Applications/Max6/10 Going-to-hate songs/01 Don't Know Why.aiff", ";", ";", "#X", "insert", 500, "path", "Macintosh HD:/Applications/Max6/10 Going-to-hate songs/01 Hero.aiff", ";", ";", "#X", "insert", 500, "path", "Macintosh HD:/Applications/Max6/10 Going-to-hate songs/02 I Do.aiff", ";", ";", "#X", "insert", 500, "path", "Macintosh HD:/Applications/Max6/10 Going-to-hate songs/02 Just a kiss.aiff", ";", ";", "#X", "insert", 500, "path", "Macintosh HD:/Applications/Max6/10 Going-to-hate songs/03 It's Always Been You.aiff", ";", ";", "#X", "insert", 500, "path", "Macintosh HD:/Applications/Max6/10 Going-to-hate songs/03 It's My Life.aiff", ";", ";", "#X", "insert", 500, "path", "Macintosh HD:/Applications/Max6/10 Going-to-hate songs/03 Secrets.aiff", ";", ";", "#X", "insert", 500, "path", "Macintosh HD:/Applications/Max6/10 Going-to-hate songs/04 Man Who Can't Be Moved.aiff", ";", ";", "#X", "insert", 500, "path", "Macintosh HD:/Applications/Max6/10 Going-to-hate songs/06 P.D.A. (We Just Don't Care).aiff", ";", ";", "#X", "insert", 500, "path", "Macintosh HD:/Applications/Max6/10 Going-to-hate songs/10 Exit Wounds.aiff", ";", ";", "#X", "insert", 500, "path", "Macintosh HD:/Applications/Max6/10 Going-to-hate songs/16 Moves Like Jagger (feat. Christina Aguilera) (Studio Recording from The Voice).aiff", ";", ";", "#X", "insert", 500, "path", "Macintosh HD:/Applications/Max6/10 Going-to-hate songs/16 Moves Like Jagger (feat. Christina Aguilera) (Studio Recording from The Voice).aiff", ";", ";" ]
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "prepend insert 500 path",
"numinlets" : 1,
"numoutlets" : 1,
"patching_rect" : [ 430.0, 444.75, 137.0, 20.0 ],
"id" : "obj-265",
"fontname" : "Arial",
"outlettype" : [ "" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "unpack append relpath",
"numinlets" : 1,
"numoutlets" : 2,
"patching_rect" : [ 375.0, 270.0, 133.0, 20.0 ],
"id" : "obj-234",
"fontname" : "Arial",
"outlettype" : [ "", "" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "button",
"numinlets" : 1,
"numoutlets" : 1,
"patching_rect" : [ 480.0, 360.0, 20.0, 20.0 ],
"id" : "obj-229",
"outlettype" : [ "bang" ]
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "combine absolutepath relativepath",
"numinlets" : 2,
"numoutlets" : 2,
"patching_rect" : [ 430.0, 405.0, 209.0, 21.0 ],
"id" : "obj-231",
"fontname" : "Arial",
"outlettype" : [ "", "" ],
"fontsize" : 13.0
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "clear",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 349.784424, 459.75, 37.0, 18.0 ],
"id" : "obj-196",
"fontname" : "Arial",
"outlettype" : [ "" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "types AIFF",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 418.5, 98.25, 68.0, 18.0 ],
"id" : "obj-183",
"fontname" : "Arial",
"outlettype" : [ "" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "folder",
"numinlets" : 1,
"numoutlets" : 2,
"patching_rect" : [ 349.784424, 240.0, 41.0, 20.0 ],
"id" : "obj-121",
"fontname" : "Arial",
"outlettype" : [ "", "int" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "relativepath",
"numinlets" : 1,
"numoutlets" : 1,
"patching_rect" : [ 462.0, 180.0, 73.0, 20.0 ],
"id" : "obj-117",
"fontname" : "Arial",
"outlettype" : [ "" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "s audiofile",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 60.0, 172.75, 65.0, 20.0 ],
"id" : "obj-24",
"fontname" : "Arial",
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "opendialog",
"numinlets" : 1,
"numoutlets" : 2,
"patching_rect" : [ 60.0, 133.0, 69.0, 20.0 ],
"id" : "obj-11",
"fontname" : "Arial",
"outlettype" : [ "", "bang" ],
"fontsize" : 12.0
}

}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-12", 0 ],
"destination" : [ "obj-231", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-234", 1 ],
"destination" : [ "obj-229", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-234", 1 ],
"destination" : [ "obj-231", 1 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-101", 0 ],
"destination" : [ "obj-183", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-101", 0 ],
"destination" : [ "obj-196", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-11", 0 ],
"destination" : [ "obj-24", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-117", 0 ],
"destination" : [ "obj-121", 0 ],
"hidden" : 0,
"midpoints" : [ 471.5, 234.5, 359.284424, 234.5 ],
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-117", 0 ],
"destination" : [ "obj-54", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-12", 0 ],
"destination" : [ "obj-117", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-12", 0 ],
"destination" : [ "obj-53", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-121", 0 ],
"destination" : [ "obj-234", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-121", 0 ],
"destination" : [ "obj-55", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-14", 0 ],
"destination" : [ "obj-16", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-15", 0 ],
"destination" : [ "obj-17", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-16", 0 ],
"destination" : [ "obj-3", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-183", 0 ],
"destination" : [ "obj-121", 0 ],
"hidden" : 0,
"midpoints" : [ 428.0, 211.0, 359.284424, 211.0 ],
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-196", 0 ],
"destination" : [ "obj-274", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-229", 0 ],
"destination" : [ "obj-231", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-231", 0 ],
"destination" : [ "obj-265", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-265", 0 ],
"destination" : [ "obj-274", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-274", 1 ],
"destination" : [ "obj-196", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-274", 1 ],
"destination" : [ "obj-5", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-274", 0 ],
"destination" : [ "obj-7", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-274", 1 ],
"destination" : [ "obj-9", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-3", 0 ],
"destination" : [ "obj-274", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-5", 0 ],
"destination" : [ "obj-274", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-96", 0 ],
"destination" : [ "obj-117", 0 ],
"hidden" : 0,
"midpoints" : [ 549.5, 140.875, 471.5, 140.875 ],
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-96", 0 ],
"destination" : [ "obj-231", 0 ],
"hidden" : 0,
"midpoints" : [ 549.5, 316.25, 439.5, 316.25 ],
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-97", 0 ],
"destination" : [ "obj-12", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-98", 0 ],
"destination" : [ "obj-11", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
, {
"patchline" : {
"source" : [ "obj-22", 0 ],
"destination" : [ "obj-12", 0 ],
"hidden" : 0,
"disabled" : 0
}

}
],
"appversion" : {
"major" : 6,
"minor" : 0,
"revision" : 5
}

}


Viewing 1 post (of 1 total)