## Filtering buffer contents with peek+slide?

Nov 4, 2009 at 11:56am

# Filtering buffer contents with peek+slide?

Hello,

I want to build a wavetable synth using a series of tables. Every table would have the same series of waves but would be low-pass filtered to a specific cutoff to match a specific pitch range so to have a good compromise between spectral richness and protection against aliasing. I plan to use 10 tables matching 10 octaves downwards from 22.05 kHz.

Of course I could prepare the wavetables outside Max but I was wondering whether it would be possible to filter the sounds upon loading within Max (and possibly in non real-time).

The idea would be to load the sound to be filtered into a buffer, read each sample with peek~, filter with slide and record in another buffer with another instance of peek~.

My questions:
1.If I want to apply a sharp lowpass filtering to my sound in nonrealtime, is slide the best option?
2. How should I calculate the smoothing argument to get a filtering at SR/2, SR/4, etc?

Roald Baudoux

#46286
Nov 5, 2009 at 7:57pm

2. SR/3

why peek~? why not play~ and record~?

-110

#166637
Nov 13, 2009 at 4:27pm

Nonrealtime could be much faster than real time…

#166638
Nov 13, 2009 at 4:43pm

The best way would probably be to implement a standard filter algorithm using Max objects only.

For instance, the the biquad~ use the following function:

For each sample n,
y[n] = a0 * x[n] + a1 * x[n-1] + a2 * x[n-2] – b1 * y[n-1] – b2 * y[n-2]

I may have I go at this later if I have time.

#166639
Dec 9, 2009 at 8:22pm

Sorry for the delay to answer, I got caught by one thousand other things.

Thank you Hans, this is a good peek into that stuff but I suppose I’d need a similar equation for a high slope low-pass filter. Any idea where I could get that?

Roald Baudoux

#166640
Dec 9, 2009 at 11:32pm

The function above can be used for almost any filter. Play around with filtergraph~ to find good values for the coefficients.

This generalization of the above formula should work for simple low-pass filters (taken from http://en.wikipedia.org/wiki/Low-pass_filter#Algorithmic_implementation), but the general formula may be required for high sloped ones.

`y[n] = y[n-1] + a * (x[n] - y[n-1])`

#166641

You must be logged in to reply to this topic.