mediank
Prev | Orchestra Opcodes and Operators | Next

## mediank

mediank — A median filter, a variant FIR lowpass filter.

## Description

Implementation of a median filter.

## Syntax

    kres mediank kin, ksize, imaxsize [, iskip]

## Initialization

imaxsize -- the maximun size of the window used to select the data.

iskip -- initial disposition of internal data space. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.

## Performance

kin -- krate value to be filtered

ksize -- size of the window over which the input is to be filtered. It must not exceed the maximum window size; if it does it is truncated.

mediank is a simple filter that retuns the median value of the last ksize values. It has a lowpass action. The efficiency decreases as the window size increases.

## Examples

Here is an example of the mediank opcode. It uses the file mediank.csd.

Example 447. Example of the mediank opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

    <CsoundSynthesizer>
    <CsOptions>
    -n
    </CsOptions>
    <CsInstruments>
    sr = 44100
    kr = 147
    ksmps = 300
    nchnls = 1

    instr 1
      k1  oscil  100, 10, 1
      k2  mediank k1, 5, 8
      printk 0, k2
    endin
    </CsInstruments>
    <CsScore>
    f1 0 4096 10 1
    i 1 0 1
    e

    </CsScore>
    </CsoundSynthesizer>

## Credits

Author: John ffitch
University of Bath
May 2010

New in Csound version 5.13

Prev | Up | Next
median | Home | metro