2 summary:: Median filter.
3 categories:: UGens>Filters>Nonlinear
8 Returns the median of the last length input points. This non-linear
9 filter is good at reducing impulse noise from a signal.
18 Number of input points in which to find the median. Must be an
19 odd number from 1 to 31. If
21 then Median has no effect.
31 Output will be multiplied by this value.
36 This value will be added to the output.
43 // a signal with impulse noise.
44 { Saw.ar(500, 0.1) + Dust2.ar(100, 0.9) }.play;
46 // after applying median filter
47 { Median.ar(3, Saw.ar(500, 0.1) + Dust2.ar(100, 0.9)) }.play;
49 // The median length can be increased for longer duration noise.
51 // a signal with longer impulse noise.
52 { Saw.ar(500, 0.1) + LPZ1.ar(Dust2.ar(100, 0.9)) }.play;
54 // length 3 doesn't help here because the impulses are 2 samples long.
55 { Median.ar(3, Saw.ar(500, 0.1) + LPZ1.ar(Dust2.ar(100, 0.9))) }.play;
57 // length 5 does better
58 { Median.ar(5, Saw.ar(500, 0.1) + LPZ1.ar(Dust2.ar(100, 0.9))) }.play;
60 // long Median filters begin chopping off the peaks of the waveform
63 x = SinOsc.ar(1000, 0, 0.2);
68 // another noise reduction application:
70 Synth.play({ WhiteNoise.ar(0.1) + SinOsc.ar(800,0,0.1) });
72 // use Median filter for high frequency noise
73 Synth.play({ Median.ar(31, WhiteNoise.ar(0.1) + SinOsc.ar(800,0,0.1)) });
76 // use LeakDC for low frequency noise
78 LeakDC.ar(Median.ar(31, WhiteNoise.ar(0.1) + SinOsc.ar(800,0,0.1)), 0.9)