Forums > MaxMSP

convolution, delay of the "wet" signoal…

March 22, 2011 | 10:48 pm

Hi list,
look at the following patch.
It is an example of convolution using tconvolution~.
I would like to use "wet" and ""dry" signal together, but
the "wet" signal got a delay respect to the "dry" one.
How to solve this problem???
Can we calculate an appropriate delay for the "dry" signal
in order to synchronize it with the "wet" one???
Best
fv

{
"boxes" : [ {
"box" : {
"maxclass" : "number",
"outlettype" : [ "int", "bang" ],
"fontsize" : 16.0,
"numinlets" : 1,
"patching_rect" : [ 121.0, 256.0, 126.0, 25.0 ],
"id" : "obj-16",
"fontname" : "Arial",
"numoutlets" : 2
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "dspstate~",
"outlettype" : [ "int", "float", "int", "int" ],
"fontsize" : 16.0,
"numinlets" : 1,
"patching_rect" : [ 185.0, 306.0, 80.0, 25.0 ],
"id" : "obj-14",
"fontname" : "Arial",
"numoutlets" : 4
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "delay~ 44100 22050",
"outlettype" : [ "signal" ],
"fontsize" : 16.0,
"numinlets" : 2,
"patching_rect" : [ 89.0, 348.0, 156.0, 25.0 ],
"id" : "obj-13",
"fontname" : "Arial",
"numoutlets" : 1
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "loop 1",
"outlettype" : [ "" ],
"fontsize" : 16.0,
"numinlets" : 2,
"patching_rect" : [ 414.0, 124.0, 54.0, 23.0 ],
"id" : "obj-12",
"fontname" : "Arial",
"numoutlets" : 1
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "/~ 2.",
"outlettype" : [ "signal" ],
"fontsize" : 16.0,
"numinlets" : 2,
"patching_rect" : [ 206.0, 663.0, 42.0, 25.0 ],
"id" : "obj-11",
"fontname" : "Arial",
"numoutlets" : 1
}

}
, {
"box" : {
"maxclass" : "ezdac~",
"numinlets" : 2,
"patching_rect" : [ 206.0, 709.0, 87.0, 87.0 ],
"id" : "obj-10",
"numoutlets" : 0
}

}
, {
"box" : {
"maxclass" : "umenu",
"outlettype" : [ "int", "", "" ],
"fontsize" : 9.0,
"items" : [ "display", ",", "lowpass", ",", "highpass", ",", "bandpass", ",", "bandstop", ",", "peaknotch", ",", "lowshelf", ",", "highshelf", ",", "resonant", ",", "allpass" ],
"numinlets" : 1,
"types" : [ ],
"patching_rect" : [ 950.0, 111.0, 70.0, 17.0 ],
"id" : "obj-19",
"fontname" : "Arial",
"numoutlets" : 3
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "biquad~",
"outlettype" : [ "signal" ],
"fontsize" : 9.0,
"numinlets" : 6,
"patching_rect" : [ 947.0, 443.0, 79.0, 17.0 ],
"id" : "obj-22",
"fontname" : "Arial",
"numoutlets" : 1
}

}
, {
"box" : {
"maxclass" : "filtergraph~",
"outlettype" : [ "list", "float", "float", "float", "float", "list", "int" ],
"markercolor" : [ 0.509804, 0.509804, 0.509804, 1.0 ],
"hbwidthcolor" : [ 0.823529, 0.290196, 0.211765, 1.0 ],
"hcurvecolor" : [ 1.0, 0.086275, 0.086275, 1.0 ],
"domain" : [ 0.0, 22050.0 ],
"bwidthcolor" : [ 0.462745, 0.47451, 0.65098, 1.0 ],
"numinlets" : 8,
"patching_rect" : [ 1010.0, 242.0, 394.0, 149.0 ],
"bgcolor" : [ 0.913725, 0.913725, 1.0, 1.0 ],
"id" : "obj-24",
"numoutlets" : 7,
"fgcolor" : [ 0.756863, 0.756863, 1.0, 1.0 ],
"autoout" : 1,
"nfilters" : 1,
"setfilter" : [ 0, 7, 0, 0, 0, 1291.653931, 0.38856, 0.707, 0.0, 22050.0, 0.0001, 16.0, 0.5, 25.0 ]
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "0.707",
"outlettype" : [ "" ],
"fontsize" : 9.0,
"numinlets" : 2,
"patching_rect" : [ 1454.0, 176.0, 37.0, 15.0 ],
"bgcolor" : [ 0.611765, 0.701961, 1.0, 1.0 ],
"id" : "obj-6",
"fontname" : "Arial",
"numoutlets" : 1
}

}
, {
"box" : {
"maxclass" : "flonum",
"outlettype" : [ "float", "bang" ],
"fontsize" : 9.0,
"triscale" : 0.9,
"numinlets" : 1,
"patching_rect" : [ 1429.0, 141.0, 64.0, 17.0 ],
"bgcolor" : [ 0.866667, 0.866667, 0.866667, 1.0 ],
"id" : "obj-29",
"fontname" : "Arial",
"numoutlets" : 2,
"htextcolor" : [ 0.870588, 0.870588, 0.870588, 1.0 ]
}

}
, {
"box" : {
"maxclass" : "flonum",
"outlettype" : [ "float", "bang" ],
"fontsize" : 9.0,
"triscale" : 0.9,
"numinlets" : 1,
"patching_rect" : [ 1305.0, 123.0, 66.0, 17.0 ],
"bgcolor" : [ 0.866667, 0.866667, 0.866667, 1.0 ],
"id" : "obj-20",
"fontname" : "Arial",
"numoutlets" : 2,
"htextcolor" : [ 0.870588, 0.870588, 0.870588, 1.0 ]
}

}
, {
"box" : {
"maxclass" : "flonum",
"outlettype" : [ "float", "bang" ],
"fontsize" : 9.0,
"triscale" : 0.9,
"numinlets" : 1,
"patching_rect" : [ 1270.0, 97.0, 80.0, 17.0 ],
"bgcolor" : [ 0.866667, 0.866667, 0.866667, 1.0 ],
"id" : "obj-7",
"fontname" : "Arial",
"numoutlets" : 2,
"htextcolor" : [ 0.870588, 0.870588, 0.870588, 1.0 ]
}

}
, {
"box" : {
"maxclass" : "toggle",
"outlettype" : [ "int" ],
"numinlets" : 1,
"patching_rect" : [ 1073.0, 90.0, 15.0, 15.0 ],
"id" : "obj-9",
"numoutlets" : 1
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "gainmode $1",
"outlettype" : [ "" ],
"fontsize" : 9.0,
"numinlets" : 2,
"patching_rect" : [ 1073.0, 125.0, 66.0, 15.0 ],
"id" : "obj-27",
"fontname" : "Arial",
"numoutlets" : 1
}

}
, {
"box" : {
"maxclass" : "comment",
"text" : "gain",
"fontsize" : 9.0,
"numinlets" : 1,
"patching_rect" : [ 1375.0, 124.0, 100.0, 17.0 ],
"id" : "obj-53",
"fontname" : "Arial",
"numoutlets" : 0
}

}
, {
"box" : {
"maxclass" : "comment",
"text" : "Q ",
"fontsize" : 9.0,
"numinlets" : 1,
"patching_rect" : [ 1500.0, 140.0, 115.0, 17.0 ],
"id" : "obj-54",
"fontname" : "Arial",
"numoutlets" : 0
}

}
, {
"box" : {
"maxclass" : "gain~",
"outlettype" : [ "signal", "int" ],
"numinlets" : 2,
"patching_rect" : [ 305.0, 530.0, 80.0, 104.0 ],
"id" : "obj-5",
"numoutlets" : 2
}

}
, {
"box" : {
"maxclass" : "gain~",
"outlettype" : [ "signal", "int" ],
"numinlets" : 2,
"patching_rect" : [ 207.0, 530.0, 80.0, 104.0 ],
"id" : "obj-3",
"numoutlets" : 2
}

}
, {
"box" : {
"maxclass" : "toggle",
"outlettype" : [ "int" ],
"numinlets" : 1,
"patching_rect" : [ 373.154449, 127.749466, 20.0, 20.0 ],
"id" : "obj-41",
"numoutlets" : 1
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "open",
"outlettype" : [ "" ],
"fontsize" : 18.0,
"numinlets" : 2,
"patching_rect" : [ 312.08432, 126.477173, 52.0, 25.0 ],
"id" : "obj-39",
"fontname" : "Arial",
"numoutlets" : 1
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "sfplay~",
"outlettype" : [ "signal", "bang" ],
"fontsize" : 18.0,
"numinlets" : 2,
"patching_rect" : [ 312.084412, 164.64595, 69.0, 27.0 ],
"id" : "obj-38",
"fontname" : "Arial",
"numoutlets" : 2,
"save" : [ "#N", "sfplay~", "", 1, 120960, 0, "", ";" ]
}

}
, {
"box" : {
"maxclass" : "meter~",
"outlettype" : [ "float" ],
"numinlets" : 1,
"patching_rect" : [ 337.954346, 198.149658, 80.0, 13.0 ],
"id" : "obj-37",
"numoutlets" : 1
}

}
, {
"box" : {
"maxclass" : "comment",
"text" : "3. calculateFilterKernel",
"fontsize" : 18.0,
"numinlets" : 1,
"patching_rect" : [ 602.803406, 299.971008, 346.0, 27.0 ],
"id" : "obj-1",
"fontname" : "Arial",
"numoutlets" : 0
}

}
, {
"box" : {
"maxclass" : "comment",
"text" : "2. loadFilterKernel",
"fontsize" : 18.0,
"numinlets" : 1,
"patching_rect" : [ 603.269897, 267.033203, 341.0, 27.0 ],
"id" : "obj-2",
"fontname" : "Arial",
"numoutlets" : 0
}

}
, {
"box" : {
"maxclass" : "comment",
"text" : "1. load an IR to the buffer with replace",
"fontsize" : 18.0,
"numinlets" : 1,
"patching_rect" : [ 602.269897, 234.033203, 351.0, 27.0 ],
"id" : "obj-4",
"fontname" : "Arial",
"numoutlets" : 0
}

}
, {
"box" : {
"maxclass" : "gain~",
"outlettype" : [ "signal", "int" ],
"numinlets" : 2,
"patching_rect" : [ 289.0, 203.0, 22.0, 122.0 ],
"id" : "obj-8",
"numoutlets" : 2,
"orientation" : 2
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "replace 0 -1 1",
"outlettype" : [ "" ],
"fontsize" : 18.0,
"numinlets" : 2,
"patching_rect" : [ 612.808167, 344.375305, 140.0, 25.0 ],
"id" : "obj-15",
"fontname" : "Arial",
"numoutlets" : 1
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "calculate_filterKernel",
"outlettype" : [ "" ],
"fontsize" : 18.0,
"numinlets" : 2,
"patching_rect" : [ 513.429321, 171.266586, 209.0, 25.0 ],
"id" : "obj-21",
"fontname" : "Arial",
"numoutlets" : 1
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "load_filterKernel kernel",
"outlettype" : [ "" ],
"fontsize" : 18.0,
"numinlets" : 2,
"patching_rect" : [ 515.559448, 120.334923, 226.0, 25.0 ],
"id" : "obj-23",
"fontname" : "Arial",
"numoutlets" : 1
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "buffer~ kernel",
"outlettype" : [ "float", "bang" ],
"fontsize" : 18.0,
"numinlets" : 1,
"patching_rect" : [ 612.808167, 385.375305, 140.0, 27.0 ],
"id" : "obj-25",
"fontname" : "Arial",
"numoutlets" : 2
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "tconvolutionUB~",
"outlettype" : [ "signal" ],
"fontsize" : 18.0,
"numinlets" : 1,
"patching_rect" : [ 407.0, 259.0, 158.0, 27.0 ],
"id" : "obj-26",
"fontname" : "Arial",
"numoutlets" : 1
}

}
, {
"box" : {
"maxclass" : "comment",
"text" : "loads the IR from a buffer",
"linecount" : 2,
"fontsize" : 18.0,
"numinlets" : 1,
"patching_rect" : [ 556.186279, 55.616776, 112.0, 48.0 ],
"id" : "obj-30",
"fontname" : "Arial",
"numoutlets" : 0
}

}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-16", 0 ],
"destination" : [ "obj-13", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-13", 0 ],
"destination" : [ "obj-3", 0 ],
"hidden" : 0,
"midpoints" : [ 98.5, 450.0, 216.5, 450.0 ]
}

}
, {
"patchline" : {
"source" : [ "obj-38", 0 ],
"destination" : [ "obj-13", 0 ],
"hidden" : 0,
"midpoints" : [ 321.584412, 197.0, 98.5, 197.0 ]
}

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

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

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

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

}
, {
"patchline" : {
"source" : [ "obj-5", 0 ],
"destination" : [ "obj-11", 0 ],
"hidden" : 0,
"midpoints" : [ 314.5, 644.0, 215.5, 644.0 ]
}

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

}
, {
"patchline" : {
"source" : [ "obj-22", 0 ],
"destination" : [ "obj-5", 0 ],
"hidden" : 0,
"midpoints" : [ 956.5, 492.0, 314.5, 492.0 ]
}

}
, {
"patchline" : {
"source" : [ "obj-26", 0 ],
"destination" : [ "obj-22", 0 ],
"hidden" : 0,
"midpoints" : [ 416.5, 292.0, 383.0, 292.0, 383.0, 439.0, 920.0, 439.0, 920.0, 429.0, 956.5, 429.0 ]
}

}
, {
"patchline" : {
"source" : [ "obj-19", 1 ],
"destination" : [ "obj-24", 0 ],
"hidden" : 0,
"midpoints" : [ 985.0, 155.0, 1019.5, 155.0 ]
}

}
, {
"patchline" : {
"source" : [ "obj-20", 0 ],
"destination" : [ "obj-24", 6 ],
"hidden" : 0,
"midpoints" : [ 1314.5, 188.0, 1340.928589, 188.0 ]
}

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

}
, {
"patchline" : {
"source" : [ "obj-9", 0 ],
"destination" : [ "obj-27", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-24", 0 ],
"destination" : [ "obj-22", 1 ],
"hidden" : 0,
"midpoints" : [ 1019.5, 426.0, 968.5, 426.0 ]
}

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

}
, {
"patchline" : {
"source" : [ "obj-27", 0 ],
"destination" : [ "obj-24", 0 ],
"hidden" : 0,
"midpoints" : [ 1082.5, 189.0, 1019.5, 189.0 ]
}

}
, {
"patchline" : {
"source" : [ "obj-29", 0 ],
"destination" : [ "obj-24", 7 ],
"hidden" : 0,
"midpoints" : [ 1438.5, 200.0, 1394.5, 200.0 ]
}

}
, {
"patchline" : {
"source" : [ "obj-8", 0 ],
"destination" : [ "obj-26", 0 ],
"hidden" : 0,
"midpoints" : [ 298.0, 334.0, 334.25, 334.0, 334.25, 247.0, 416.5, 247.0 ]
}

}
, {
"patchline" : {
"source" : [ "obj-41", 0 ],
"destination" : [ "obj-38", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

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

}
, {
"patchline" : {
"source" : [ "obj-38", 0 ],
"destination" : [ "obj-8", 0 ],
"hidden" : 0,
"midpoints" : [ 321.584412, 196.822968, 298.0, 196.822968 ]
}

}
, {
"patchline" : {
"source" : [ "obj-38", 0 ],
"destination" : [ "obj-37", 0 ],
"hidden" : 0,
"midpoints" : [ 321.584412, 194.397797, 347.454346, 194.397797 ]
}

}
, {
"patchline" : {
"source" : [ "obj-23", 0 ],
"destination" : [ "obj-26", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-21", 0 ],
"destination" : [ "obj-26", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-15", 0 ],
"destination" : [ "obj-25", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
]
}


March 23, 2011 | 10:37 am

Take a look at the helpfile.

The latency depends on the segmentsize (which you can set with the setSegmentSize message).

Latency = 2 * SegmentSize (in samples)

You can use the [delay~] object to delay the dry signal.

BTW, "Copy Compressed" in the Edit menu is your friend for posting patches on the forum.


March 23, 2011 | 11:02 am

many thanks mudang
fv


March 23, 2011 | 11:52 am

soon to come: no latency convolution…

stay tuned!

p


March 23, 2011 | 12:32 pm

That’s so 90′s ;)

http://www.aes.org/e-lib/browse.cfm?elib=7957


March 24, 2011 | 1:29 am

Here just an idea hope to help you

– Pasted Max Patch, click to expand. –

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