Forums > MaxMSP

Help with simple LFO patch: Using interchangeable waveforms


DJF
March 13, 2012 | 2:01 am

Hello,

I am wanting to allow a simple LFO patch to switch between waveforms, however, I am having trouble implementing this through the selector~. Could somebody give me some advice, or point me in the direction of some other simple LFO patches? The text for this modification is below. I have outlined the bits I want to swap in red.

{
"patcher" : {
"fileversion" : 1,
"appversion" : {
"major" : 6,
"minor" : 0,
"revision" : 0
}
,
"rect" : [ 4.0, 44.0, 1379.0, 1110.0 ],
"bglocked" : 0,
"openinpresentation" : 0,
"default_fontsize" : 12.0,
"default_fontface" : 0,
"default_fontname" : "Arial",
"gridonopen" : 0,
"gridsize" : [ 15.0, 15.0 ],
"gridsnaponopen" : 0,
"statusbarvisible" : 0,
"toolbarvisible" : 1,
"boxanimatetime" : 200,
"imprint" : 0,
"enablehscroll" : 1,
"enablevscroll" : 1,
"devicewidth" : 0.0,
"description" : "",
"digest" : "",
"tags" : "",
"boxes" : [ {
"box" : {
"bordercolor" : [ 1.0, 0.0, 0.0, 1.0 ],
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-9",
"maxclass" : "flonum",
"maximum" : 2.0,
"minimum" : 0.0,
"numinlets" : 1,
"numoutlets" : 2,
"outlettype" : [ "float", "bang" ],
"parameter_enable" : 0,
"patching_rect" : [ 480.0, 120.0, 50.0, 20.0 ]
}

}
, {
"box" : {
"color" : [ 1.0, 0.0, 0.0, 1.0 ],
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-7",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "signal" ],
"patching_rect" : [ 671.0, 120.0, 45.0, 20.0 ],
"presentation_rect" : [ 794.53949, 125.644737, 0.0, 0.0 ],
"text" : "cycle~"
}

}
, {
"box" : {
"color" : [ 1.0, 0.0, 0.0, 1.0 ],
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-6",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "signal" ],
"patching_rect" : [ 575.5, 120.0, 45.0, 20.0 ],
"presentation_rect" : [ 689.973877, 126.032249, 0.0, 0.0 ],
"text" : "cycle~"
}

}
, {
"box" : {
"color" : [ 1.0, 0.0, 0.0, 1.0 ],
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-5",
"maxclass" : "newobj",
"numinlets" : 3,
"numoutlets" : 1,
"outlettype" : [ "signal" ],
"patching_rect" : [ 480.0, 162.97963, 210.0, 20.0 ],
"text" : "selector~ 2"
}

}
, {
"box" : {
"color" : [ 1.0, 0.0, 0.0, 1.0 ],
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-3",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "signal" ],
"patching_rect" : [ 196.000061, 132.97963, 45.0, 20.0 ],
"text" : "cycle~"
}

}
, {
"box" : {
"bgcolor" : [ 0.0, 0.0, 0.0, 1.0 ],
"fgcolor" : [ 1.0, 1.0, 1.0, 1.0 ],
"id" : "obj-1",
"maxclass" : "scope~",
"numinlets" : 2,
"numoutlets" : 0,
"patching_rect" : [ 285.0, 190.25, 137.769836, 86.5 ]
}

}
, {
"box" : {
"bgcolor" : [ 0.0, 0.0, 0.0, 1.0 ],
"bgcolor2" : [ 1.0, 1.0, 1.0, 1.0 ],
"fontface" : 3,
"fontname" : "Arial",
"fontsize" : 7.0,
"id" : "obj-52",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 157.000031, 330.0, 32.0, 13.0 ],
"text" : "On/Off",
"textcolor" : [ 1.0, 1.0, 1.0, 1.0 ]
}

}
, {
"box" : {
"bgcolor" : [ 0.0, 0.0, 0.0, 1.0 ],
"bgcolor2" : [ 1.0, 1.0, 1.0, 1.0 ],
"fontface" : 3,
"fontname" : "Arial",
"fontsize" : 7.0,
"id" : "obj-51",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 157.000031, 15.0, 32.0, 13.0 ],
"text" : "On/Off",
"textcolor" : [ 1.0, 1.0, 1.0, 1.0 ]
}

}
, {
"box" : {
"bgcolor" : [ 0.0, 0.0, 0.0, 1.0 ],
"bgcolor2" : [ 1.0, 1.0, 1.0, 1.0 ],
"fontface" : 3,
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-49",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 285.0, 15.0, 43.0, 18.0 ],
"text" : "depth",
"textcolor" : [ 1.0, 1.0, 1.0, 1.0 ]
}

}
, {
"box" : {
"bgcolor" : [ 0.0, 0.0, 0.0, 1.0 ],
"bgcolor2" : [ 1.0, 1.0, 1.0, 1.0 ],
"fontface" : 3,
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-48",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 196.000061, 15.0, 33.0, 18.0 ],
"text" : "rate",
"textcolor" : [ 1.0, 1.0, 1.0, 1.0 ]
}

}
, {
"box" : {
"bgcolor" : [ 0.0, 0.0, 0.0, 1.0 ],
"bgcolor2" : [ 1.0, 1.0, 1.0, 1.0 ],
"fontface" : 3,
"fontname" : "Arial",
"fontsize" : 24.0,
"id" : "obj-47",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 15.0, 330.0, 63.0, 32.0 ],
"text" : "Osc.",
"textcolor" : [ 1.0, 1.0, 1.0, 1.0 ]
}

}
, {
"box" : {
"bgcolor" : [ 0.0, 0.0, 0.0, 1.0 ],
"bgcolor2" : [ 1.0, 1.0, 1.0, 1.0 ],
"fontface" : 3,
"fontname" : "Arial",
"fontsize" : 24.0,
"id" : "obj-46",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 15.0, 15.0, 62.0, 32.0 ],
"text" : "LFO",
"textcolor" : [ 1.0, 1.0, 1.0, 1.0 ]
}

}
, {
"box" : {
"bgcolor" : [ 0.0, 0.0, 0.0, 1.0 ],
"bordercolor" : [ 0.0, 0.0, 0.0, 1.0 ],
"checkedcolor" : [ 1.0, 1.0, 1.0, 1.0 ],
"id" : "obj-39",
"maxclass" : "toggle",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "int" ],
"parameter_enable" : 0,
"patching_rect" : [ 165.0, 345.0, 16.000061, 16.000061 ]
}

}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-38",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 0,
"patching_rect" : [ 196.000061, 300.0, 37.0, 20.0 ],
"text" : "dac~"
}

}
, {
"box" : {
"bgcolor" : [ 0.0, 0.0, 0.0, 1.0 ],
"bordercolor" : [ 0.0, 0.0, 0.0, 1.0 ],
"id" : "obj-37",
"knobcolor" : [ 1.0, 1.0, 1.0, 1.0 ],
"maxclass" : "slider",
"numinlets" : 1,
"numoutlets" : 1,
"orientation" : 1,
"outlettype" : [ "" ],
"parameter_enable" : 0,
"patching_rect" : [ 285.0, 45.5, 83.0, 16.0 ]
}

}
, {
"box" : {
"bgcolor" : [ 0.0, 0.0, 0.0, 1.0 ],
"bordercolor" : [ 0.0, 0.0, 0.0, 1.0 ],
"id" : "obj-36",
"knobcolor" : [ 1.0, 1.0, 1.0, 1.0 ],
"maxclass" : "slider",
"numinlets" : 1,
"numoutlets" : 1,
"orientation" : 1,
"outlettype" : [ "" ],
"parameter_enable" : 0,
"patching_rect" : [ 196.000061, 45.5, 83.0, 16.0 ]
}

}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-30",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "signal" ],
"patching_rect" : [ 196.000061, 465.0, 42.0, 20.0 ],
"text" : "*~ 0.2"
}

}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-28",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "signal" ],
"patching_rect" : [ 196.000061, 330.0, 68.0, 20.0 ],
"text" : "cycle~ 440"
}

}
, {
"box" : {
"bgcolor" : [ 0.0, 0.0, 0.0, 1.0 ],
"fontname" : "Arial",
"fontsize" : 9.0,
"htextcolor" : [ 0.870588, 0.870588, 0.870588, 1.0 ],
"id" : "obj-2",
"maxclass" : "flonum",
"numinlets" : 1,
"numoutlets" : 2,
"outlettype" : [ "float", "bang" ],
"parameter_enable" : 0,
"patching_rect" : [ 285.0, 105.0, 35.0, 17.0 ],
"textcolor" : [ 1.0, 1.0, 1.0, 1.0 ],
"triscale" : 0.9
}

}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 9.0,
"id" : "obj-10",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "signal" ],
"patching_rect" : [ 143.0, 142.0, 25.0, 17.0 ],
"text" : "sig~"
}

}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 9.0,
"id" : "obj-11",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 143.0, 109.0, 21.0, 15.0 ],
"text" : "0.8"
}

}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 9.0,
"id" : "obj-14",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 2,
"outlettype" : [ "bang", "" ],
"patching_rect" : [ 120.0, 75.0, 41.0, 17.0 ],
"text" : "select 1"
}

}
, {
"box" : {
"bgcolor" : [ 0.0, 0.0, 0.0, 1.0 ],
"bordercolor" : [ 0.0, 0.0, 0.0, 1.0 ],
"checkedcolor" : [ 1.0, 1.0, 1.0, 1.0 ],
"id" : "obj-15",
"maxclass" : "toggle",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "int" ],
"parameter_enable" : 0,
"patching_rect" : [ 165.0, 29.5, 16.000061, 16.000061 ]
}

}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 9.0,
"id" : "obj-16",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "signal" ],
"patching_rect" : [ 178.000061, 225.0, 37.0, 17.0 ],
"text" : "gate~"
}

}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 9.0,
"id" : "obj-17",
"maxclass" : "newobj",
"numinlets" : 6,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 285.0, 75.0, 86.5, 17.0 ],
"text" : "scale 0 127 0. 1."
}

}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 9.0,
"id" : "obj-19",
"maxclass" : "newobj",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "signal" ],
"patching_rect" : [ 196.000061, 187.0, 33.0, 17.0 ],
"text" : "*~ 0.1"
}

}
, {
"box" : {
"bgcolor" : [ 0.098039, 0.098039, 0.098039, 1.0 ],
"fontname" : "Arial",
"fontsize" : 9.0,
"htextcolor" : [ 0.870588, 0.870588, 0.870588, 1.0 ],
"id" : "obj-20",
"maxclass" : "flonum",
"numinlets" : 1,
"numoutlets" : 2,
"outlettype" : [ "float", "bang" ],
"parameter_enable" : 0,
"patching_rect" : [ 196.000061, 105.0, 35.0, 17.0 ],
"textcolor" : [ 1.0, 1.0, 1.0, 1.0 ],
"triscale" : 0.9
}

}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 9.0,
"id" : "obj-21",
"maxclass" : "newobj",
"numinlets" : 6,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 196.000061, 75.0, 86.5, 17.0 ],
"text" : "scale 0 127 0. 10."
}

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

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

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

}
, {
"patchline" : {
"destination" : [ "obj-16", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 174.5, 95.0, 187.500061, 95.0 ],
"source" : [ "obj-15", 0 ]
}

}
, {
"patchline" : {
"destination" : [ "obj-1", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 187.500061, 268.017426, 265.27124, 268.017426, 265.27124, 186.709381, 294.5, 186.709381 ],
"source" : [ "obj-16", 0 ]
}

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

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

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

}
, {
"patchline" : {
"destination" : [ "obj-19", 1 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 294.5, 162.0, 219.500061, 162.0 ],
"source" : [ "obj-2", 0 ]
}

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

}
, {
"patchline" : {
"destination" : [ "obj-20", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-21", 0 ]
}

}
, {
"patchline" : {
"destination" : [ "obj-30", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-28", 0 ]
}

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

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

}
, {
"patchline" : {
"destination" : [ "obj-38", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-30", 0 ]
}

}
, {
"patchline" : {
"destination" : [ "obj-21", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-36", 0 ]
}

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

}
, {
"patchline" : {
"destination" : [ "obj-38", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-39", 0 ]
}

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

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

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

}
],
"dependency_cache" : [ ]
}

}

Attachments:
  1. SimpleLFO.maxpat

March 13, 2012 | 9:32 am

First off, Copy Compressed.

Second, use an integer, and not a float to control selector~


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