Namespaces

Variants
Actions

bucket

From Cycling '74 Wiki
(Difference between revisions)
Jump to: navigation, search
({{maxword|name=bucket}} Tips and Workarounds)
(People who looked at/used this object also looked at....)
 
(12 intermediate revisions by 2 users not shown)
Line 2: Line 2:
  
 
==Using the {{maxword|name=bucket}} object==
 
==Using the {{maxword|name=bucket}} object==
 +
 +
The {{maxword|name=bucket}} object implements a [//en.wikipedia.org/wiki/Bucket_brigade bucket brigade] device (in the electronics world, this is sometimes referred to as [//en.wikipedia.org/wiki/Bucket-brigade_device a discrete time-analogue delay line]). As the examples below suggest, it's useful for single-sample delay lines, calculating averages, computing velocity and acceleration, and permutating lists by rotating them.
  
 
=={{maxword|name=bucket}} Tutorials==
 
=={{maxword|name=bucket}} Tutorials==
 +
 +
In the Max tutorial on abstractions, you can find a classic example of why the {{maxword|name=bucket}} object is so useful - [//www.cycling74.com/docs/max6/dynamic/c74_docs.html#basicchapter15 this Max tutorial] demonstrates its use as a single sample delay for number values useful for constructing drawing commands.
  
 
=={{maxword|name=bucket}} Tips and Workarounds==
 
=={{maxword|name=bucket}} Tips and Workarounds==
  
While lots of people use the <strong>bucket</strong> object for shifting data in series, it's computationally useful for calculating first and second derivatives for streams of data.
+
===Velocity and Acceleration===
 +
 
 +
Lots of people use the <strong>bucket</strong> object for shifting data in series, it's computationally useful for calculating first and second derivatives for streams of data. The terms "first and second derivative" are math-speak for keeping track of:
 +
 
 +
* the rate that things are changing (that's what velocity (the first derivative) is - the rate of change in a value over time.
 +
 
 +
* the ''rate of the rate'' that things are changing - that's what acceleration (the second derivative) is.
 +
 
 +
[[File:Bucket-in-action.png|550px]]
 +
 
 +
Here's a patch that does that:
  
 
<maxpat>
 
<maxpat>
Line 34: Line 48:
 
</maxpat>
 
</maxpat>
  
I also tend to use the object quite a bit in situations where I desire a running average over some finite set of events (if you want a running average for an unspecified set of values, you'd use the {{maxword|name=mean}} object). Here's an example that calculates the average of the last 8 floating point input values:
+
===Running Averages===
 +
 
 +
I also tend to use the object quite a bit in situations where I desire a running average over some finite set of events (if you want a running average for an stream or unspecified set of values, you'd use the {{maxword|name=mean}} object). Here's an example that calculates the average of the last 8 floating point input values:
  
 
<maxpat>
 
<maxpat>
Line 50: Line 66:
 
CKoD.YpH+8s8ylrHvTpLlPsabu3Q4g3geaAy6mpNqmJMO1aJQtufMUfbZbdM
 
CKoD.YpH+8s8ylrHvTpLlPsabu3Q4g3geaAy6mpNqmJMO1aJQtufMUfbZbdM
 
7efczjOq
 
7efczjOq
 +
-----------end_max5_patcher-----------
 +
</maxpat>
 +
 +
===A Bucket for Symbols===
 +
 +
The {{maxword|name=bucket}} object is a little unusual in that you don't need to worry about using arguments to the object in order to have it work with floating point values. In fact, {{maxword|name=bucket}} is ''so'' useful that people often ask whether or not there's a Max object that is similar but will work with symbols or lists. While there isn't a specific object, here's a Max patch that does exactly that (and it also helpfully outputs stuff in standard right-to-left order, too):
 +
 +
<maxpat>
 +
----------begin_max5_patcher----------
 +
778.3oc2X10bhBCEF9Z7WACWy5jOfjvd296Xmc1A0Ta5ffCDacam9eeIm.pc
 +
KsDEw05zYTOGfj22mdxW7xDufYEakUA9e2+m9dduLwyCRYR30D6ErJc67rzJ
 +
31BVIqpRWJCBsWSK2pg72UrorMY9lUp7LoFdBRSx0kxJYtNUqJx+cobt11q7
 +
D9z3PeBYJJzG07g+u12REazsMEtsoR0yuWku78MSLzLTh42XwAMjZAnxhYO7
 +
MJtUm2UjqySWIgK8iRUZV6Urcp9Oqk1lOHXWKYdnJ0yvEv0cmI6qSlX9HbfL
 +
TeeoTdRPjJL9lDMPHRoG.QnI+PHhtZg3SEmBBYLKBGXcHiCOqK0gjjqUDVj+
 +
4UgtSCbryzP7UkFePAkHhCETb9vpnDTfdDjEknOaTIgciMpjyvf4E3ANyVTh
 +
6PL9la8AF2Ze9.wHiwcGiQWqXr2sp3LOhEQtyC5+adjKepVHuCGOm4WJWdRk
 +
U1o2wwtruCRuKSfiguhPVl9AX7j18V3WDTRPnAhxDg6nDcihR6jTX9vPIWfb
 +
Fk3ja5pRgXXnTvntiR5ULJ09Y9yL+0IMwcxkn9m3CYWdtc00tAC+D4xrz7ku
 +
6aWXEbOAYp7+8MD.Nwj+s.rpdc04s8bih8w65oExJsJGJwN3dLSB4u2u2qVr
 +
PBWG0jYkZw5BUttQCbDeJlUeZMdcaSXFfYRE2Dsu2TUoyxj.95t.3XbAoGWX
 +
F+eTtPjLUPoTLcuKpSMxtf1mKnGmKDbxNIG9lnQv.lCHdf351A7iy.LRjQxB
 +
X32AAig7SFA4yStTxmhN+xmGAqJbQjO97KeAheojO2A0Sv8H+yXsrKECly+c
 +
vr+iodvtL1xbr9KkdntnG1ESODWp9MmO8Z5+W39zSGKoBueQ3vnhHbGQQw1Q
 +
rzcQiwL8tL5.P.9311yd+viSrupg2D03NLZTcmS0RniycMyd13GFm0Qj0cbh
 +
vc2Y2.a550OJKqZTHXr585+PQoIjEBgpbaHrC9fR4ip16mBYRKq25ttde6aJ
 +
sa6dqfELwzOuN4u.mi5K2B
 +
-----------end_max5_patcher-----------
 +
</maxpat>
 +
 +
 +
===Arbitrary List Rotation ===
 +
 +
One way to think of the {{maxword|name=bucket}} object is a as an object that adds new input values and rotates the list by one position. While you can rotate a list forward or backward using the ''r2l'' and ''l2r'' messages to the {{maxword|name=bucket}} object, performing arbitrary list rotations can be done using the {{maxword|name=zl}} object and specifying the '''rot''' option:
 +
 +
[[File:Bucket-in-action-2.png|550px]]
 +
 +
<maxpat>
 +
----------begin_max5_patcher----------
 +
1116.3oc2Y1zbaqBEFds8uBtZtK80iPf9HcWW1scamNYP1DGZk.O.xIoc5+8
 +
q.jh+H1wXEEZFOYhrEBc3bdz6AyA86oShJEORUQfOA9FXxjeOcxDaSlFlzc9
 +
jnZxiKpHJa2hVHpqobczL20zzG011+xcfmDMfGHbMPK.RglnolljfJlRCJeB
 +
TKjTf9dBGH3TvZghoYB9LPixzLE7qJysADk+ftPOG7UZMstjJM2h1YPFekwP
 +
zMTNf2XtnB7.qpBTQI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GN5j6IcRBFcfmiNYgiNYdRGXvny47Fyd8EJ5f7jNgwc74YEDG
 +
rGV93NgKOGOBKMslsbsfw0psU4lZV.drcuuvaOa63Ldq.vC+GGLZ5yjlv3fI
 +
0fd4OgqxCX5GJsOzmeUIObOs7QKCGZoGtpXIqWugJUc1z5Js07+CgzbZ1L6o
 +
Lt6TaA6QRpYG7c829pBhHx1Rt0s0a2Hc07+XgY6EZGm+L8+wpYGFn
 
-----------end_max5_patcher-----------
 
-----------end_max5_patcher-----------
 
</maxpat>
 
</maxpat>
Line 58: Line 138:
  
 
==People who looked at/used this object also looked at....==
 
==People who looked at/used this object also looked at....==
 +
 +
The [http://www.cycling74.com/docs/max6/dynamic/c74_docs.html#zl zl] object (in its '''zl rot''' form)
  
 
The [http://www.cycling74.com/docs/max6/dynamic/c74_docs.html#cycle cycle] object
 
The [http://www.cycling74.com/docs/max6/dynamic/c74_docs.html#cycle cycle] object

Latest revision as of 04:58, 1 May 2013

Contents

[edit] bucket online refpage

[edit] Using the bucket object

The bucket object implements a bucket brigade device (in the electronics world, this is sometimes referred to as a discrete time-analogue delay line). As the examples below suggest, it's useful for single-sample delay lines, calculating averages, computing velocity and acceleration, and permutating lists by rotating them.

[edit] bucket Tutorials

In the Max tutorial on abstractions, you can find a classic example of why the bucket object is so useful - this Max tutorial demonstrates its use as a single sample delay for number values useful for constructing drawing commands.

[edit] bucket Tips and Workarounds

[edit] Velocity and Acceleration

Lots of people use the bucket object for shifting data in series, it's computationally useful for calculating first and second derivatives for streams of data. The terms "first and second derivative" are math-speak for keeping track of:

  • the rate that things are changing (that's what velocity (the first derivative) is - the rate of change in a value over time.
  • the rate of the rate that things are changing - that's what acceleration (the second derivative) is.

Bucket-in-action.png

Here's a patch that does that:

-- Pasted Max Patch, click to expand. --

[edit] Running Averages

I also tend to use the object quite a bit in situations where I desire a running average over some finite set of events (if you want a running average for an stream or unspecified set of values, you'd use the mean object). Here's an example that calculates the average of the last 8 floating point input values:

-- Pasted Max Patch, click to expand. --

[edit] A Bucket for Symbols

The bucket object is a little unusual in that you don't need to worry about using arguments to the object in order to have it work with floating point values. In fact, bucket is so useful that people often ask whether or not there's a Max object that is similar but will work with symbols or lists. While there isn't a specific object, here's a Max patch that does exactly that (and it also helpfully outputs stuff in standard right-to-left order, too):

-- Pasted Max Patch, click to expand. --


[edit] Arbitrary List Rotation

One way to think of the bucket object is a as an object that adds new input values and rotates the list by one position. While you can rotate a list forward or backward using the r2l and l2r messages to the bucket object, performing arbitrary list rotations can be done using the zl object and specifying the rot option:

Bucket-in-action-2.png

-- Pasted Max Patch, click to expand. --

[edit] Third-Party Max externals similar to the bucket object

Maxobjects.com listing for the bucket object

[edit] People who looked at/used this object also looked at....

The zl object (in its zl rot form)

The cycle object

[edit] Errors or Clarifications

(please list things that you believe to be errors or omissions from the existing refpage)