Forums > Max For Live

How can I save a sample in my patch?

February 28, 2010 | 10:10 pm

Hello ,
I have tried to adapt one of my max patchs into M4L, and I’m using sfplay~ to playback a sample with "embed 1" to save it… It works great in my max patch , but I can’t make it happen in M4L? Is it a restriction of M4L?
I can load the sample , but can’t save it.

Could anyone please point me the right direction?

Thanks in advance!

K


March 1, 2010 | 3:59 pm

I did something like this, using a pattr object with parameter mode enabled to store the name. Seems to work well:

{
"boxes" : [ {
"box" : {
"maxclass" : "comment",
"text" : "this stores the sample, be sure this is in "parameter mode" on in the inspector",
"linecount" : 3,
"patching_rect" : [ 260.0, 106.0, 150.0, 48.0 ],
"id" : "obj-17",
"fontname" : "Arial",
"numinlets" : 1,
"fontsize" : 12.0,
"numoutlets" : 0
}

}
, {
"box" : {
"maxclass" : "comment",
"text" : "select sample here",
"patching_rect" : [ 76.0, 57.0, 150.0, 20.0 ],
"id" : "obj-15",
"fontname" : "Arial",
"numinlets" : 1,
"fontsize" : 12.0,
"numoutlets" : 0
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "open julia_sound.wav",
"patching_rect" : [ 196.0, 405.0, 337.0, 18.0 ],
"id" : "obj-13",
"fontname" : "Arial",
"numinlets" : 2,
"fontsize" : 12.0,
"numoutlets" : 1,
"outlettype" : [ "" ]
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "sfplay~ 2",
"patching_rect" : [ 130.0, 429.0, 59.0, 20.0 ],
"id" : "obj-7",
"fontname" : "Arial",
"numinlets" : 2,
"fontsize" : 12.0,
"numoutlets" : 3,
"outlettype" : [ "signal", "signal", "bang" ],
"save" : [ "#N", "sfplay~", "", 2, 120960, 0, "", ";" ]
}

}
, {
"box" : {
"maxclass" : "button",
"patching_rect" : [ 41.0, 53.0, 20.0, 20.0 ],
"id" : "obj-6",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "bang" ]
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "strippath",
"patching_rect" : [ 230.0, 252.0, 57.0, 20.0 ],
"id" : "obj-11",
"fontname" : "Arial",
"numinlets" : 1,
"fontsize" : 12.0,
"numoutlets" : 2,
"outlettype" : [ "", "int" ]
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "prepend open",
"patching_rect" : [ 124.0, 376.0, 85.0, 20.0 ],
"id" : "obj-8",
"fontname" : "Arial",
"numinlets" : 1,
"fontsize" : 12.0,
"numoutlets" : 1,
"outlettype" : [ "" ]
}

}
, {
"box" : {
"maxclass" : "newobj",
"varname" : "Sample1",
"text" : "pattr Sample1",
"patching_rect" : [ 180.0, 105.0, 67.0, 17.0 ],
"id" : "obj-616",
"fontname" : "Arial",
"numinlets" : 1,
"fontsize" : 9.0,
"numoutlets" : 3,
"outlettype" : [ "", "", "" ],
"restore" : [ "Catland:/Users/UnUnUnium/Music/Samples/RAW samples/julia_sound.wav" ],
"saved_object_attributes" : {
"parameter_enable" : 1
}
,
"saved_attribute_attributes" : {
"valueof" : {
"parameter_mmin" : 0.0,
"parameter_type" : 3,
"parameter_initial_enable" : 0,
"parameter_shortname" : "Sample1",
"parameter_invisible" : 1,
"parameter_modmax" : 127.0,
"parameter_annotation_name" : "",
"parameter_longname" : "Sample1",
"parameter_modmin" : 0.0,
"parameter_linknames" : 0,
"parameter_modmode" : 0,
"parameter_info" : "",
"parameter_order" : 0,
"parameter_units" : "",
"parameter_speedlim" : 0,
"parameter_steps" : 0,
"parameter_exponent" : 1.0,
"parameter_unitstyle" : 10,
"parameter_mmax" : 127.0
}

}

}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "t b s",
"patching_rect" : [ 175.0, 134.0, 33.0, 20.0 ],
"id" : "obj-10",
"fontname" : "Arial",
"numinlets" : 1,
"fontsize" : 12.0,
"numoutlets" : 2,
"outlettype" : [ "bang", "" ]
}

}
, {
"box" : {
"maxclass" : "message",
"varname" : "Sampselect1",
"text" : ""Catland:/Users/UnUnUnium/Music/Samples/RAW samples/julia_sound.wav"",
"patching_rect" : [ 61.0, 197.0, 548.0, 18.0 ],
"id" : "obj-9",
"fontname" : "Arial",
"numinlets" : 2,
"fontsize" : 12.0,
"numoutlets" : 1,
"outlettype" : [ "" ]
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "opendialog",
"patching_rect" : [ 47.0, 82.0, 56.0, 17.0 ],
"id" : "obj-5",
"fontname" : "Arial",
"numinlets" : 1,
"fontsize" : 9.0,
"numoutlets" : 2,
"outlettype" : [ "", "bang" ]
}

}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-8", 0 ],
"destination" : [ "obj-13", 1 ],
"hidden" : 0,
"midpoints" : [ 133.5, 400.0, 523.5, 400.0 ]
}

}
, {
"patchline" : {
"source" : [ "obj-8", 0 ],
"destination" : [ "obj-7", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-11", 0 ],
"destination" : [ "obj-8", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

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

}
, {
"patchline" : {
"source" : [ "obj-9", 0 ],
"destination" : [ "obj-11", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-616", 0 ],
"destination" : [ "obj-10", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-5", 0 ],
"destination" : [ "obj-616", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

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

}
, {
"patchline" : {
"source" : [ "obj-10", 0 ],
"destination" : [ "obj-9", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
]
}


March 1, 2010 | 5:31 pm

fwiw, ‘embed 1′ works here ok, with files anywhere on my machine. Maybe send along a simple stripped down device?

-Ben



pid
March 1, 2010 | 6:36 pm

for the record ben, what is the best way to achieve this with a buffer~ NOT using live.drop? for example, audio gets recorded into a buffer~ using record~. i then want a "write" button to the buffer~, AND then a save of this written file TO the live set, so whenever the set is launched again the newly written file is ready loaded. i can automate the write path fine, but of course it is still not recalled. the ability to send a full path name TO live.drop would be great in this situation. is there something i am missing?
thanks.


March 1, 2010 | 7:04 pm

Unless i’m misunderstanding what you are wanting to do, you can just loadbang a ‘replace [filepath]‘ message to buffer~. You just need to store the file path.

maybe something like this:

– Pasted Max Patch, click to expand. –

This would be easy to use the pattr system if you had a bunch of different states that you needed to save.

Feel free to post a simple patch if you are still having problems.

-Ben


March 1, 2010 | 11:08 pm

Thanks for your answers, it made me realize that for some strange reason, I had to define the file preferences path again, which is strange, because I had no problems when running my original patch straight from Max.

Embed 1 works just fine now!

:)

K


March 4, 2010 | 11:35 am

Messing around with Max’s file preferences, or with absolute paths, seems distinctly non Max-for-Live-like.

What I’d like to see is some way in the LiveAPI of interrogating a clip for its audio file – then I’d just dedicate a track as a place-holder for audio files and let Live do all the file management for me.

Or am I missing something?


March 8, 2010 | 9:14 pm

I agree there should be some kind of live.player abstraction…
the weird thing is I didn’t have to define my paths in Max5 , but I had to in Max4live…
That I don’t really get.

A


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