delay and pipe maximum delays
are there any issues i should bear in mind if giving pipe very large delay times (several hours)? will it cause memory problems? how accurate would it be compared to getting a system time and polling it to wait for the right time? which is the best way to do it? thanks.
From having read the Pd code for handling timing as well as what's available in the SDK documentation, I don't see any problems memory-wise.
Two points about accuracy.
1) Time is in milliseconds, represented by a 32-bit floating point value. 32-bit FP is big enough to handle about 4-5 hours while retaining ms-accuracy. If you increase the delay by a factor of ten, you lose a digit of accuracy. That means you could schedule a delay of a year and still be accurate to +/- one second. In theory.
2) In practice my experience with the Max metro is that its accuracy is susceptible to the complexity of your patch, performance options, and probably some other stuff. The Max 5 timing stuff may well have improved, but I don't know by how much.
Your idea to poll the system clock is not a bad one. There are zillions of stopwatch/timer patches out there that poll [date], you might find one of them a helpful springboard.
An alternative would be to sync Max to an external clock.
ok thanks. so are there any disadvantages at all to using large pipe delays as compared to the polling [date] method?
note that it stops working when the computer was turned off over the night.
yes there is that.
also i've just noticed that pipe doesn't work with symbols or lists, only ints and floats - why is this???
you could delay a bang which would then trigger the output of a symbol or list
the problem is that it's a large and complicated series of delay lengths followed lists to delay, so some kind of storage is needed to remember them all with their associated delays. it was nice that (i thought) pipe would make this very easy. i suppose i could keep a coll, and then use an index out of the pipe to trigger the list at that line in the coll.
peterworth@gmail.com wrote on Mon, 06 April 2009 21:35yes there is that.
also i've just noticed that pipe doesn't work with symbols or lists, only ints and floats - why is this???
yup, there is [delay] for bangs, [pipe] for numbers, and nothing for lists and symbols. thats because i dont know. if you only need to delay one thing, it is easy to make a custom abstraction, something like that:
[t l b]
[zl reg] [delay]
(store the list or symbol, delay a parallel bang)
but for a stream of various data there is no easy solution, not even with [coll].
peterworth@gmail.com wrote on Mon, 06 April 2009 21:56i suppose i could keep a coll, and then use an index out of the pipe to trigger the list at that line in the coll.
That sounds like the way to go.
Why no lpipe or sympipe or messpipe (for lists/symbols/messages)? Actually, Peter Elsea may have written one for lists, take a look at LObjects. And Stefan Tiedje may have written some abstrations. But the basic idea of Max is small, simple objects (which can be easily tested and maintained). That paradigm is hardly 'pure' anymore, but sometimes you want to do something that you think is so basic that there oughtta be an object, and it turns out you have to patch something together. This seems to be one of those times.
It had really not been my intention to plug anything on this message, but while writing it occurred to me that ice.lattice is, well, a tool for scheduling delayed lists/symbols/messages. Upside: it's free. Possible downside (or maybe an upside): Max 4 only. I can't tell whether it or coll is more appropriate for your particular application.
if anyone is interested i've made a listpipe abstraction which is the same as pipe but works with lists or symbols or anything. the only flaw with it is that each thing you add to be delayed gets added to a coll, and there is no automatic cleaning up of the coll, so it gets bigger and bigger, until you manually give listpipe a "clear" message, which resets everything.
oh i thought the attachment would appear as text.
{
"patcher" : {
"fileversion" : 1,
"rect" : [ 29.0, 67.0, 387.0, 512.0 ],
"bglocked" : 0,
"defrect" : [ 29.0, 67.0, 387.0, 512.0 ],
"openrect" : [ 0.0, 0.0, 0.0, 0.0 ],
"openinpresentation" : 0,
"default_fontsize" : 12.0,
"default_fontface" : 0,
"default_fontname" : "Arial",
"gridonopen" : 0,
"gridsize" : [ 15.0, 15.0 ],
"gridsnaponopen" : 0,
"toolbarvisible" : 1,
"boxanimatetime" : 200,
"imprint" : 0,
"metadata" : [ ],
"boxes" : [ {
"box" : {
"maxclass" : "newobj",
"text" : "r #0clear",
"id" : "obj-16",
"fontsize" : 12.0,
"numinlets" : 0,
"patching_rect" : [ 240.0, 105.0, 57.0, 20.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ],
"fontname" : "Arial"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "r #0clear",
"id" : "obj-14",
"fontsize" : 12.0,
"numinlets" : 0,
"patching_rect" : [ 60.0, 285.0, 57.0, 20.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ],
"fontname" : "Arial"
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "clear",
"id" : "obj-15",
"fontsize" : 12.0,
"numinlets" : 2,
"patching_rect" : [ 60.0, 315.0, 37.0, 18.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ],
"fontname" : "Arial"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "r #0clear",
"id" : "obj-13",
"fontsize" : 12.0,
"numinlets" : 0,
"patching_rect" : [ 195.0, 345.0, 57.0, 20.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ],
"fontname" : "Arial"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "s #0clear",
"id" : "obj-12",
"fontsize" : 12.0,
"numinlets" : 1,
"patching_rect" : [ 60.0, 105.0, 59.0, 20.0 ],
"numoutlets" : 0,
"fontname" : "Arial"
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "clear",
"id" : "obj-11",
"fontsize" : 12.0,
"numinlets" : 2,
"patching_rect" : [ 195.0, 375.0, 37.0, 18.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ],
"fontname" : "Arial"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "route clear",
"id" : "obj-3",
"fontsize" : 12.0,
"numinlets" : 1,
"patching_rect" : [ 60.0, 60.0, 79.0, 20.0 ],
"numoutlets" : 2,
"outlettype" : [ "", "" ],
"fontname" : "Arial"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "i",
"id" : "obj-22",
"fontsize" : 12.0,
"numinlets" : 2,
"patching_rect" : [ 120.0, 255.0, 32.5, 20.0 ],
"numoutlets" : 1,
"outlettype" : [ "int" ],
"fontname" : "Arial"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "prepend set",
"id" : "obj-18",
"fontsize" : 12.0,
"numinlets" : 1,
"patching_rect" : [ 210.0, 240.0, 74.0, 20.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ],
"fontname" : "Arial"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "prepend",
"id" : "obj-17",
"fontsize" : 12.0,
"numinlets" : 1,
"patching_rect" : [ 165.0, 285.0, 55.0, 20.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ],
"fontname" : "Arial"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "t b l b",
"id" : "obj-10",
"fontsize" : 12.0,
"numinlets" : 1,
"patching_rect" : [ 120.0, 150.0, 109.0, 20.0 ],
"numoutlets" : 3,
"outlettype" : [ "bang", "", "bang" ],
"fontname" : "Arial"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "counter",
"id" : "obj-9",
"fontsize" : 12.0,
"numinlets" : 5,
"patching_rect" : [ 210.0, 180.0, 78.0, 20.0 ],
"numoutlets" : 4,
"outlettype" : [ "int", "", "", "int" ],
"fontname" : "Arial"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "coll",
"id" : "obj-8",
"fontsize" : 12.0,
"numinlets" : 1,
"patching_rect" : [ 165.0, 405.0, 59.5, 20.0 ],
"numoutlets" : 4,
"outlettype" : [ "", "", "", "" ],
"fontname" : "Arial",
"save" : [ "#N", "coll", ";" ],
"saved_object_attributes" : {
"embed" : 0
}
}
}
, {
"box" : {
"maxclass" : "outlet",
"id" : "obj-7",
"numinlets" : 1,
"patching_rect" : [ 165.0, 435.0, 25.0, 25.0 ],
"numoutlets" : 0,
"comment" : ""
}
}
, {
"box" : {
"maxclass" : "inlet",
"id" : "obj-6",
"numinlets" : 0,
"patching_rect" : [ 60.0, 15.0, 25.0, 25.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ],
"comment" : ""
}
}
, {
"box" : {
"maxclass" : "inlet",
"id" : "obj-5",
"numinlets" : 0,
"patching_rect" : [ 135.0, 315.0, 25.0, 25.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ],
"comment" : ""
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "pipe",
"id" : "obj-1",
"fontsize" : 12.0,
"numinlets" : 2,
"patching_rect" : [ 120.0, 360.0, 34.0, 20.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ],
"fontname" : "Arial"
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-16", 0 ],
"destination" : [ "obj-9", 2 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-15", 0 ],
"destination" : [ "obj-1", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-14", 0 ],
"destination" : [ "obj-15", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-11", 0 ],
"destination" : [ "obj-8", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-13", 0 ],
"destination" : [ "obj-11", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-3", 0 ],
"destination" : [ "obj-12", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-3", 1 ],
"destination" : [ "obj-10", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-6", 0 ],
"destination" : [ "obj-3", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-5", 0 ],
"destination" : [ "obj-1", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-18", 0 ],
"destination" : [ "obj-17", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-17", 0 ],
"destination" : [ "obj-8", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-10", 2 ],
"destination" : [ "obj-9", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-10", 1 ],
"destination" : [ "obj-17", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-9", 0 ],
"destination" : [ "obj-22", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-9", 0 ],
"destination" : [ "obj-18", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-10", 0 ],
"destination" : [ "obj-22", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-22", 0 ],
"destination" : [ "obj-1", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-1", 0 ],
"destination" : [ "obj-8", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-8", 0 ],
"destination" : [ "obj-7", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
]
}
}
peterworth@gmail.com wrote on Tue, 07 April 2009 02:32if anyone is interested i've made a listpipe abstraction which is the same as pipe but works with lists or symbols or anything. the only flaw with it is that each thing you add to be delayed gets added to a coll, and there is no automatic cleaning up of the coll, so it gets bigger and bigger, until you manually give listpipe a "clear" message, which resets everything.
There's a similar abstraction in the CNMAT MMJ Depot called "pipe-any". It's at:
mz
with the "insert" commands it is easily possible to make a "scrolling" coll, which moves stuff around before any new entry.
of course then you have only a given number of maximum stored entries in it.
perfect, thanks. i didnt realise it had an insert message.
what do you mean by "only a given number of maximum stored entries in it"?...
insert, delete, and swap are wonderful.
well, either you have an "unlimited" coll, and for outputting the delayed input you read from it by index, or you have a coll with for example 1000 entries, and you read from it always at index 2 while it scrolls and deletes index 1 on any new input.
(otoh ... i just wonder what the message limit for [pipe] is?)
ah yes i see now. when you first mentioned insert i thought it would do something it didnt (insert at the next "empty" index in the coll)
i reckon pipe is only limited by memory. it's not there as an example external with code though so i cant check.
Now all you need to do is learn to use Copy Compressed when posting to the forum. And maybe read the sticky "Read This Before Posting to the Forum."
that sounds too difficult for me to learn
peterworth@gmail.com wrote on Wed, 08 April 2009 11:24that sounds too difficult for me to learn
but peter, then i cant read the patch with my max 4!
ok i'll try my hardest
peterworth@gmail.com wrote on Wed, 08 April 2009 11:36ok i'll try my hardest
nonono i mean peter castine.
attachments is the best.
aha.
so can max 4 read the xml type of file?
peterworth@gmail.com wrote on Wed, 08 April 2009 11:45so can max 4 read the xml type of file?
No.
Roman was implying that he could read the JSON (recto) format and re-implement it in Max 4 format.
It is highly unusual for an application program written in year X to interpret a format that was not invented until year X+2
%-Q
Peter Castine wrote on Wed, 08 April 2009 23:47peterworth@gmail.com wrote on Wed, 08 April 2009 11:45so can max 4 read the xml type of file?
No.
Roman was implying that he could read the JSON (recto) format and re-implement it in Max 4 format.
It is highly unusual for an application program written in year X to interpret a format that was not invented until year X+2
%-Q
max 4 can "read" attached patcher files best.
i am behind with many things, including hardware and software.
Peter Castine wrote on Tue, 07 April 2009 10:47 Upside: it's free. Possible downside (or maybe an upside): Max 4 only. I can't tell whether it or coll is more appropriate for your particular application.
Downside, its not downloadable since months. The download link is crossed out and doesn't work...
Stefan
stefantiedje wrote on Sat, 11 April 2009 00:17Downside, its not downloadable since months. The download link is crossed out and doesn't work...
http://www.bek.no/~pcastine/Litter/#try and click on any of the links. Works fine here.
this delay thread must have a feedback loop somewhere.
Peter Castine wrote on Sat, 11 April 2009 12:38stefantiedje wrote on Sat, 11 April 2009 00:17Downside, its not downloadable since months. The download link is crossed out and doesn't work...
http://www.bek.no/~pcastine/Litter/#try and click on any of the links. Works fine here.
I was talking about iCE not about Litter....
Stefan
Yes, of course, we were talking about iCE. It's just the iCE site isn't under my direct control. I'll look into it, thanks for mentioning it.