# Max gen~ Delay analysis

I use Cycling 74’s Max/MSP every  day. It’s almost gotten to the point where I use it for emailing. But, until yesterday, I never used the gen~ option. So, in order to come up-to-speed, I decided to sit down and follow a couple of tutorials to figure out whether gen~ would help me make things either faster or better – or both.

One of the cool options in the gen~ environment is that you can choose the interpolation type of the audio delay. You have 4 options: linear, spline, cosine, or cubic interpolation. So, I decided to make a little experiment to test which I’d like to use as a default.

I made a little patcher which is shown below.

I only changed two variables – one was the interpolation type and the second was the delay time (either 20.25 samples or 20.5 samples – as can be seen in the message boxes in the main patcher).

As you can see there, the result is recorded as a wav. file (just 16-bit – but that’s good enough for this test) at 44.1 kHz (the sampling rate I used for the test).

I then imported 8 wav. files into Matlab for analysis. There were 4 interpolation types for each of the two delay values.

The big question in my head was “what is the influence of the interpolation type on the magnitude response of the delayed signal?” So, I did a 16k FFT of the delayed click (with rectangular windowing, which is fine, since I’m measuring an impulse response response and I’m starting and ending with 0’s). The results of the two delay times are shown in Figures 2 and 3, below.

As can be seen there, things are behaving more or less like they should. The Linear and Cosine interpolations have identical magnitude responses when the delay time is exactly x.5 samples. In addition, it’s worth noting that the linearly interpolated has the biggest roll-off when the the delay time is not x.5 samples.

So far so good.

But, just to be thorough, I figured I’d plot the time responses as well. These are shown below in Figures 4 and 5.

Interesting! It appears that we have a small bug. It looks like, in both cases, the linear and the cosine interpolations are 1 sample late… Time to send an email to Cycling74 and ask them to look into this.

In case you’re a geek, and you need the details:

• I’m running Max/MSP Version 7.1.0 on a late 2011 17″ MacBook Pro running OS 10.11.2.
• Max was using the internal I/O and had I/O Vector and Signal Vector sizes of 1024 samples.

## 2016/04/14 – Max 7.2.1 Update

As you can see in the “Replies” to this posting, a quick message came in from Andrew Pask (at Cycling74) on April 12 asking me to try this again in Max 7.2.1.

So, I made the patcher again, saved the .wav’s again, put them in Matlab again, and the results are plotted below.

So, it looks to me like things are fixed. Thanks Andrew!

Now, can you do something about the fact that the levelmeter~ object forgets/ignores its saved ballistics settings (attack and release time values) when you load a patcher? :-)

Cheers

-geoff