Forums > MaxMSP

measuring delay

December 9, 2007 | 2:49 pm

Hi,

I’m trying to build a patch that measures the amount of delay in an audio chain.

I tried a simple test but something is not working as I would expect. When I try to measure the amount of delay with timer or clocker, I always get different values.

I need some help. Here is the patch:

max v2;
#N vpatcher 212 83 1105 615;
#P window setfont "Sans Serif" 9.;
#P flonum 386 292 79 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 401 234 33 9109513 stop;
#P newex 386 260 54 9109513 clocker 0.1;
#B color 5;
#P newex 136 160 52 9109513 tapout~ 10;
#P newex 135 136 46 9109513 tapin~ 10;
#P flonum 243 353 87 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 261 249 34 9109513 edge~;
#P newex 261 214 29 9109513 >~ 0.;
#P button 261 304 15 0;
#P button 242 304 15 0;
#P newex 242 325 29 9109513 timer;
#P newex 262 181 43 9109513 change~;
#P user ezdac~ 137 206 181 239 0;
#P button 135 58 32 0;
#P newex 135 112 32 9109513 click~;
#P comment 168 65 100 9109513 click me;
#P comment 17 37 100 9109513 DELAY TEST;
#P connect 3 0 2 0;
#P connect 2 0 12 0;
#P connect 12 0 13 0;
#P fasten 3 0 7 0 140 108 247 108;
#P connect 7 0 6 0;
#P connect 6 0 11 0;
#P connect 5 0 9 0;
#P connect 9 0 10 0;
#P connect 10 0 8 0;
#P connect 8 0 6 1;
#P connect 13 0 5 0;
#P hidden connect 3 0 14 0;
#P fasten 15 0 14 0 406 254 391 254;
#P connect 14 0 16 0;
#P connect 8 0 15 0;


December 9, 2007 | 2:59 pm

record it into a buffer and check it in cool edit or something


December 9, 2007 | 3:06 pm

Sorry for not being clear.

I would like to do it in MAX/Msp, because later I’m going to build a patch that compensates the delay in my audio chain.

Thanks for the help.

Alex


December 9, 2007 | 5:38 pm

Hey, thanks for the idea of using a buffer.

Now I’m wondering if it’s possible to analize it with index (or something else) to determine the exact delay between the start point and the click.

Cheers,
Alex

Patch update:

max v2;
#N vpatcher 212 83 1105 615;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 50 229 56 9109513 click me;
#P hidden newex 285 61 45 9109513 loadbang;
#P hidden message 253 94 157 9109513 set 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1;
#P hidden message 51 173 14 9109513 1;
#P newex 51 206 81 9109513 record~ recmetoo;
#P newex 33 248 99 9109513 buffer~ recmetoo 200;
#P newex 136 160 52 9109513 tapout~ 20;
#P newex 135 136 46 9109513 tapin~ 20;
#P user ezdac~ 136 208 180 241 0;
#P button 135 58 32 0;
#P newex 135 112 32 9109513 click~;
#P comment 168 65 100 9109513 click me;
#P comment 17 37 100 9109513 DELAY TEST;
#P hidden connect 3 0 9 0;
#P connect 6 0 8 0;
#P hidden connect 9 0 8 0;
#P connect 3 0 2 0;
#P hidden connect 10 0 2 0;
#P connect 2 0 5 0;
#P connect 5 0 6 0;
#P connect 6 0 4 0;
#P connect 6 0 4 1;
#P hidden connect 11 0 10 0;


December 9, 2007 | 6:08 pm

You might want to try recording the pre-delay and post-delay click to a buffer then measure the distance in samples between them. You could step through the buffer values using peak~


December 13, 2007 | 3:13 pm

Thanks, John!

Greetings,
Alex


December 14, 2007 | 12:06 am

Alessandro Camnasio schrieb:
> I’m trying to build a patch that measures the amount of delay in an
> audio chain.
>
> I tried a simple test but something is not working as I would expect.
> When I try to measure the amount of delay with timer or clocker, I
> always get different values.

How different? more than a millisecond?

I always get the same value. My performance settings are overdrive on,
scheduler in audio interrupt on…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com


December 14, 2007 | 12:17 am

> How different? more than a millisecond?

I get result from 5.8 to 10.7 milliseconds.

>
> I always get the same value. My performance settings are overdrive on,
> scheduler in audio interrupt on…

Ah, thanks! I switched on the scheduler and now the patch works as expected.

Alex


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