How to Oscillate Between Two Values (-1, 1)
Hi, all-- I guess the subject line says it all; how can generate a stream of values that oscillates back and forth between the range -1, 1?
Thanks!
Bryan
Open a blank patcher window, and type "How Digital Audio Works" into the lozenge at the upper right of the patcher window. Watch what happens. If you think there's too much there, click on "Guides" on the left side.
Typing into that lozenge is a very useful skill to acquire.
Something like this?
{
"boxes" : [ {
"box" : {
"maxclass" : "flonum",
"parameter_enable" : 0,
"format" : 6,
"style" : "",
"numinlets" : 1,
"numoutlets" : 2,
"outlettype" : [ "", "bang" ],
"patching_rect" : [ 407.0, 329.0, 50.0, 22.0 ],
"id" : "obj-17"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "scale 0 255 -1. 1.",
"style" : "",
"numinlets" : 6,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 407.0, 294.0, 103.0, 22.0 ],
"id" : "obj-15"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "counter 255 2",
"style" : "",
"numinlets" : 5,
"numoutlets" : 4,
"outlettype" : [ "int", "", "", "int" ],
"patching_rect" : [ 407.0, 260.0, 84.0, 22.0 ],
"id" : "obj-14"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "qmetro 30 hz @active 1",
"style" : "",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"patching_rect" : [ 407.0, 226.0, 137.0, 22.0 ],
"id" : "obj-5"
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-14", 0 ],
"destination" : [ "obj-15", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-5", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-15", 0 ],
"destination" : [ "obj-17", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
],
"appversion" : {
"major" : 7,
"minor" : 1,
"revision" : 0,
"architecture" : "x86",
"modernui" : 1
}
}
Yes, that is EXACTLY what I was looking for! Thanks, Gerardo!
Bryan
You are welcome Bryan!
Also check out the snapshot~ object
{
"boxes" : [ {
"box" : {
"maxclass" : "newobj",
"text" : "loadmess 1",
"outlettype" : [ "" ],
"id" : "obj-28",
"numinlets" : 1,
"patching_rect" : [ 328.0, 95.0, 72.0, 22.0 ],
"style" : "",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "loadmess start",
"outlettype" : [ "" ],
"id" : "obj-27",
"numinlets" : 1,
"patching_rect" : [ 328.0, 121.0, 89.0, 22.0 ],
"style" : "",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "flonum",
"outlettype" : [ "", "bang" ],
"id" : "obj-26",
"numinlets" : 1,
"patching_rect" : [ 213.0, 181.0, 45.0, 22.0 ],
"format" : 6,
"style" : "",
"parameter_enable" : 0,
"numoutlets" : 2
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "loadmess definerange -1 1",
"linecount" : 5,
"outlettype" : [ "" ],
"id" : "obj-21",
"numinlets" : 1,
"patching_rect" : [ 213.0, 224.0, 45.0, 77.0 ],
"style" : "",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "plot~",
"outlettype" : [ "" ],
"id" : "obj-20",
"numinlets" : 1,
"patching_rect" : [ 161.0, 181.0, 50.0, 190.0 ],
"numoutlets" : 1,
"numpoints" : 1,
"subplots" : [ {
"color" : [ 0.4, 0.4, 0.75, 1.0 ],
"thickness" : 3.0,
"point_style" : "circle",
"line_style" : "origin",
"number_style" : "none",
"filter" : "none",
"domain_start" : 0.0,
"domain_end" : 1.0,
"domain_style" : "linear",
"domain_markers" : [ ],
"domain_labels" : [ ],
"range_start" : -1.0,
"range_end" : 1.0,
"range_style" : "linear",
"range_markers" : [ ],
"range_labels" : [ ],
"origin_x" : 0.0,
"origin_y" : 0.0
}
]
}
}
, {
"box" : {
"maxclass" : "ezdac~",
"id" : "obj-8",
"numinlets" : 2,
"patching_rect" : [ 213.0, 326.0, 45.0, 45.0 ],
"style" : "",
"numoutlets" : 0
}
}
, {
"box" : {
"maxclass" : "flonum",
"outlettype" : [ "", "bang" ],
"id" : "obj-4",
"numinlets" : 1,
"patching_rect" : [ 161.0, 87.0, 50.0, 22.0 ],
"format" : 6,
"style" : "",
"parameter_enable" : 0,
"numoutlets" : 2
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "snapshot~ 5",
"outlettype" : [ "float" ],
"id" : "obj-2",
"numinlets" : 2,
"patching_rect" : [ 161.0, 145.0, 76.0, 22.0 ],
"style" : "",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "cycle~",
"outlettype" : [ "signal" ],
"id" : "obj-1",
"numinlets" : 2,
"patching_rect" : [ 161.0, 114.0, 45.0, 22.0 ],
"style" : "",
"numoutlets" : 1
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-4", 0 ],
"destination" : [ "obj-1", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-28", 0 ],
"destination" : [ "obj-1", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-27", 0 ],
"destination" : [ "obj-2", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-21", 0 ],
"destination" : [ "obj-20", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-2", 0 ],
"destination" : [ "obj-26", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-2", 0 ],
"destination" : [ "obj-20", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-1", 0 ],
"destination" : [ "obj-2", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
],
"appversion" : {
"major" : 7,
"minor" : 1,
"revision" : 0,
"architecture" : "x64",
"modernui" : 1
}
}