Below is a patch showing how to use the live.slider object to implement a simple non-linear crossfader. To open this patch in Max, copy all the text below and then in Max select File-->New From Clipboard. The comments in the patch give hints on how to use it.
Code: Select all
{
"boxes" : [ {
"box" : {
"maxclass" : "flonum",
"patching_rect" : [ 110.0, 352.0, 50.0, 20.0 ],
"numoutlets" : 2,
"parameter_enable" : 0,
"outlettype" : [ "float", "bang" ],
"fontsize" : 12.0,
"id" : "obj-12",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "volume level output: connect this to the \"output gain\" (7th) inlet of mptcfs_sa~ to control the playback volume level",
"linecount" : 3,
"patching_rect" : [ 170.0, 355.0, 280.0, 47.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-10",
"frgb" : 0.0,
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "here's a simple non-linear crossfader control with adjustable sharpness. The output below is a volume level between 0.00 and 1.0 that can be applied to the volume level input of the mptcfs_sa~ object ",
"linecount" : 3,
"patching_rect" : [ 55.0, 16.0, 474.0, 47.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-9",
"frgb" : 0.0,
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "volume level\n",
"patching_rect" : [ 46.0, 84.0, 76.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-7",
"frgb" : 0.0,
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "live.slider",
"varname" : "volume_level_slider",
"patching_rect" : [ 55.0, 110.0, 39.0, 95.0 ],
"numoutlets" : 2,
"parameter_enable" : 1,
"outlettype" : [ "", "float" ],
"id" : "obj-6",
"numinlets" : 1,
"saved_attribute_attributes" : {
"valueof" : {
"parameter_linknames" : 1,
"parameter_longname" : "volume_level_slider",
"parameter_shortname" : "volume_level",
"parameter_type" : 0,
"parameter_unitstyle" : 0
}
}
}
}
, {
"box" : {
"maxclass" : "number",
"patching_rect" : [ 83.0, 264.0, 28.0, 17.0 ],
"maximum" : 10,
"minimum" : -70,
"presentation" : 1,
"numoutlets" : 2,
"htextcolor" : [ 0.870588, 0.870588, 0.870588, 1.0 ],
"cantchange" : 1,
"parameter_enable" : 0,
"presentation_rect" : [ 86.0, 193.0, 22.0, 17.0 ],
"outlettype" : [ "int", "bang" ],
"bgcolor" : [ 0.866667, 0.866667, 0.866667, 1.0 ],
"fontsize" : 9.160198,
"triangle" : 0,
"id" : "obj-186",
"fontname" : "Sans Serif",
"numinlets" : 1,
"triscale" : 0.9
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "p dBtolin",
"patching_rect" : [ 55.0, 235.0, 47.0, 17.0 ],
"numoutlets" : 2,
"outlettype" : [ "", "float" ],
"fontsize" : 9.160198,
"id" : "obj-216",
"fontname" : "Sans Serif",
"numinlets" : 1,
"patcher" : {
"fileversion" : 1,
"appversion" : {
"major" : 6,
"minor" : 1,
"revision" : 7,
"architecture" : "x64"
}
,
"rect" : [ 40.0, 55.0, 400.0, 326.0 ],
"bglocked" : 0,
"openinpresentation" : 0,
"default_fontsize" : 10.0,
"default_fontface" : 0,
"default_fontname" : "Arial",
"gridonopen" : 0,
"gridsize" : [ 15.0, 15.0 ],
"gridsnaponopen" : 0,
"statusbarvisible" : 2,
"toolbarvisible" : 1,
"boxanimatetime" : 200,
"imprint" : 0,
"enablehscroll" : 1,
"enablevscroll" : 1,
"devicewidth" : 0.0,
"description" : "",
"digest" : "",
"tags" : "",
"boxes" : [ {
"box" : {
"maxclass" : "newobj",
"text" : "t f f",
"patching_rect" : [ 25.0, 112.0, 50.0, 17.0 ],
"numoutlets" : 2,
"outlettype" : [ "float", "float" ],
"fontsize" : 9.160198,
"id" : "obj-1",
"fontname" : "Sans Serif",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "outlet",
"patching_rect" : [ 167.0, 170.0, 15.0, 15.0 ],
"numoutlets" : 0,
"id" : "obj-2",
"numinlets" : 1,
"comment" : "dB value out"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "- 60.",
"patching_rect" : [ 25.0, 92.0, 50.0, 17.0 ],
"numoutlets" : 1,
"outlettype" : [ "float" ],
"fontsize" : 9.160198,
"id" : "obj-3",
"fontname" : "Sans Serif",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "* 70.",
"patching_rect" : [ 25.0, 71.0, 50.0, 17.0 ],
"numoutlets" : 1,
"outlettype" : [ "float" ],
"fontsize" : 9.160198,
"id" : "obj-4",
"fontname" : "Sans Serif",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "/ 127.",
"patching_rect" : [ 25.0, 50.0, 50.0, 17.0 ],
"numoutlets" : 1,
"outlettype" : [ "float" ],
"fontsize" : 9.160198,
"id" : "obj-5",
"fontname" : "Sans Serif",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "expr pow(10.\\,$f1/20.)",
"patching_rect" : [ 25.0, 147.0, 121.0, 17.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ],
"fontsize" : 9.160198,
"id" : "obj-6",
"fontname" : "Sans Serif",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "outlet",
"patching_rect" : [ 25.0, 171.0, 15.0, 15.0 ],
"numoutlets" : 0,
"id" : "obj-7",
"numinlets" : 1,
"comment" : "linear value out"
}
}
, {
"box" : {
"maxclass" : "inlet",
"patching_rect" : [ 25.0, 30.0, 15.0, 15.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ],
"id" : "obj-8",
"numinlets" : 0,
"comment" : ""
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "dB to linear conversion",
"patching_rect" : [ 33.0, 133.0, 120.0, 17.0 ],
"numoutlets" : 0,
"fontsize" : 9.160198,
"id" : "obj-9",
"frgb" : 0.0,
"fontname" : "Sans Serif",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "convert slider range [0.. 127] to -60 to + 10 dB",
"patching_rect" : [ 122.0, 38.0, 224.0, 17.0 ],
"numoutlets" : 0,
"fontsize" : 9.160198,
"id" : "obj-10",
"frgb" : 0.0,
"fontname" : "Sans Serif",
"numinlets" : 1
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-8", 0 ],
"destination" : [ "obj-5", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-5", 0 ],
"destination" : [ "obj-4", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-4", 0 ],
"destination" : [ "obj-3", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-3", 0 ],
"destination" : [ "obj-1", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-1", 0 ],
"destination" : [ "obj-6", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-6", 0 ],
"destination" : [ "obj-7", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-1", 1 ],
"destination" : [ "obj-2", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
]
}
,
"saved_object_attributes" : {
"default_fontface" : 0,
"default_fontname" : "Arial",
"default_fontsize" : 10.0,
"description" : "",
"digest" : "",
"fontface" : 0,
"fontname" : "Arial",
"fontsize" : 10.0,
"globalpatchername" : "",
"tags" : ""
}
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "t b f",
"patching_rect" : [ 321.0, 208.0, 32.5, 18.0 ],
"numoutlets" : 2,
"outlettype" : [ "bang", "float" ],
"fontsize" : 10.0,
"id" : "obj-63",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "expr \"pow($f1/127.0, 1.0/(($f2/10.) + 1.0))\"",
"patching_rect" : [ 199.0, 252.0, 178.0, 17.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ],
"fontsize" : 9.0,
"id" : "obj-20",
"fontname" : "Arial",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "t b f",
"patching_rect" : [ 199.0, 274.0, 32.0, 17.0 ],
"numoutlets" : 2,
"outlettype" : [ "bang", "float" ],
"fontsize" : 9.0,
"id" : "obj-5",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "expr 127 - $i1",
"patching_rect" : [ 200.0, 208.0, 66.0, 17.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ],
"fontsize" : 9.0,
"id" : "obj-24",
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "* 2.",
"patching_rect" : [ 131.0, 311.0, 30.0, 17.0 ],
"numoutlets" : 1,
"outlettype" : [ "float" ],
"fontsize" : 9.0,
"id" : "obj-11",
"fontname" : "Arial",
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "gradual <--> sharp",
"patching_rect" : [ 377.0, 84.0, 121.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-4",
"frgb" : 0.0,
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "live.slider",
"varname" : "sharpness_control",
"patching_rect" : [ 377.0, 110.0, 121.0, 40.0 ],
"numoutlets" : 2,
"parameter_enable" : 1,
"presentation_rect" : [ 15.0, 15.0, 50.0, 40.0 ],
"outlettype" : [ "", "float" ],
"orientation" : 1,
"id" : "obj-3",
"numinlets" : 1,
"saved_attribute_attributes" : {
"valueof" : {
"parameter_linknames" : 1,
"parameter_longname" : "sharpness_control",
"parameter_shortname" : "sharpness",
"parameter_type" : 0,
"parameter_unitstyle" : 0
}
}
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "crossfader\n",
"patching_rect" : [ 200.0, 84.0, 106.0, 20.0 ],
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-2",
"frgb" : 0.0,
"fontname" : "Arial",
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "live.slider",
"varname" : "crossfader_slider",
"patching_rect" : [ 200.0, 110.0, 121.0, 40.0 ],
"numoutlets" : 2,
"parameter_enable" : 1,
"presentation_rect" : [ 0.0, 0.0, 50.0, 40.0 ],
"outlettype" : [ "", "float" ],
"orientation" : 1,
"id" : "obj-74",
"numinlets" : 1,
"saved_attribute_attributes" : {
"valueof" : {
"parameter_linknames" : 1,
"parameter_longname" : "crossfader_slider",
"parameter_shortname" : "crossfader",
"parameter_type" : 0,
"parameter_unitstyle" : 0
}
}
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-11", 0 ],
"destination" : [ "obj-12", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-216", 0 ],
"destination" : [ "obj-11", 0 ],
"hidden" : 0,
"midpoints" : [ 64.5, 306.0, 140.5, 306.0 ],
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-6", 0 ],
"destination" : [ "obj-216", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-216", 1 ],
"destination" : [ "obj-186", 0 ],
"hidden" : 1,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-63", 1 ],
"destination" : [ "obj-20", 1 ],
"hidden" : 0,
"midpoints" : [ 344.0, 237.0, 367.5, 237.0 ],
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-63", 0 ],
"destination" : [ "obj-20", 0 ],
"hidden" : 0,
"midpoints" : [ 330.5, 237.0, 208.5, 237.0 ],
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-3", 0 ],
"destination" : [ "obj-63", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-74", 0 ],
"destination" : [ "obj-24", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-24", 0 ],
"destination" : [ "obj-20", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-20", 0 ],
"destination" : [ "obj-5", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-5", 1 ],
"destination" : [ "obj-11", 1 ],
"hidden" : 0,
"midpoints" : [ 221.5, 301.0, 151.5, 301.0 ],
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-5", 0 ],
"destination" : [ "obj-11", 0 ],
"hidden" : 0,
"midpoints" : [ 208.5, 301.0, 140.5, 301.0 ],
"disabled" : 0
}
}
],
"appversion" : {
"major" : 6,
"minor" : 1,
"revision" : 7,
"architecture" : "x64"
}
}