Forums > MaxMSP

stupid question about triangle~

January 19, 2010 | 6:35 pm

How come triangle~ appears to generate a sawtooth wave in the help file? Am I missing something here? How do I get it to generate an actual triangle wave (i.e. linearly ramping from -1. to 1. to -1., rather than from -1. to 1., and then -1. to 1. again)?

Thanks,
Zach


January 19, 2010 | 6:49 pm

Hello, since i am beginner i wouldn’t know exactly what’s going on but my solution would be to use "line~ " to maybe work around this problem? for example 0, 1 1000 0 1000

Frid


January 19, 2010 | 6:54 pm

Like this.

{
"patcher" : {
"fileversion" : 1,
"rect" : [ 29.0, 67.0, 640.0, 480.0 ],
"bglocked" : 0,
"defrect" : [ 29.0, 67.0, 640.0, 480.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,
"enablehscroll" : 1,
"enablevscroll" : 1,
"devicewidth" : 0.0,
"boxes" : [ {
"box" : {
"maxclass" : "scope~",
"numinlets" : 2,
"id" : "obj-5",
"numoutlets" : 0,
"presentation_rect" : [ 386.0, 214.0, 0.0, 0.0 ],
"patching_rect" : [ 342.0, 214.0, 100.0, 50.0 ]
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "0, 1 $1 0 $1",
"numinlets" : 2,
"id" : "obj-6",
"numoutlets" : 1,
"presentation_rect" : [ 386.0, 161.0, 0.0, 0.0 ],
"fontsize" : 12.0,
"outlettype" : [ "" ],
"patching_rect" : [ 342.0, 168.0, 74.0, 18.0 ],
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "line~",
"numinlets" : 2,
"id" : "obj-7",
"numoutlets" : 2,
"presentation_rect" : [ 386.0, 185.0, 0.0, 0.0 ],
"fontsize" : 12.0,
"outlettype" : [ "signal", "bang" ],
"patching_rect" : [ 342.0, 189.0, 36.0, 20.0 ],
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "scope~",
"numinlets" : 2,
"id" : "obj-4",
"numoutlets" : 0,
"patching_rect" : [ 238.0, 214.0, 100.0, 50.0 ]
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "0, 1 1000 0 1000",
"numinlets" : 2,
"id" : "obj-3",
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "" ],
"patching_rect" : [ 238.0, 161.0, 101.0, 18.0 ],
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "line~",
"numinlets" : 2,
"id" : "obj-2",
"numoutlets" : 2,
"fontsize" : 12.0,
"outlettype" : [ "signal", "bang" ],
"patching_rect" : [ 238.0, 185.0, 36.0, 20.0 ],
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "ezdac~",
"numinlets" : 2,
"id" : "obj-1",
"numoutlets" : 0,
"patching_rect" : [ 288.0, 55.0, 45.0, 45.0 ]
}

}
, {
"box" : {
"maxclass" : "flonum",
"numinlets" : 1,
"id" : "obj-8",
"numoutlets" : 2,
"fontsize" : 12.0,
"outlettype" : [ "float", "bang" ],
"patching_rect" : [ 342.0, 145.0, 50.0, 20.0 ],
"fontname" : "Arial"
}

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

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

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

}
, {
"patchline" : {
"source" : [ "obj-2", 0 ],
"destination" : [ "obj-4", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-3", 0 ],
"destination" : [ "obj-2", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
]
}

}


January 19, 2010 | 7:14 pm

[phasor~ ] into [triangle~ 0.5] will give you a triangle waveform. But if you want a triangle wave for audio-frequency synthesis, [tri~ ] is more appropriate.


January 19, 2010 | 7:31 pm

Thanks, Tim. I didn’t realize that a peak offset of 1. would produce a sawtooth. I am using this for control, not audio, so triangle~ is more appropriate than tri~.


January 19, 2010 | 11:34 pm

@FRid, someone kindly pointed out to me that when you want to post a patch, you can use: edit/select all/edit/copy compressed, and you get a neat little text file for posting….spread the love


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