Skip to main content
Skip table of contents



N-Channel Block median


Computes the median ("middle value") for each block of data. The median computation is computed on a channel by channel basis. The module supports an arbitrary block size and number of channels. The output has a block size of 1 and the number of channels matches the number of channels of the input.

Internally, the module uses a scratch buffer and sorts each block of data. It then picks the "middle" value as the median. Let N represent the block size of the input pin. If N is odd, then the median is the sample at index [(N - 1) / 2] (assuming zero indexing). If N is even, then the median is at sample index [N/2 - 1].

Type Definition

typedef struct _ModuleBlockMedian
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
} ModuleBlockMedianClass;


Input Pins

Name: in

Description: Input signal

Data type: float

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: Output signal

Data type: float

Scratch Pins

Channel count: 1

Block size: 32

Sample rate: 48000


File Name: block_median_module.m

 M = block_median_module(NAME)
 Computes the median value of a block of data.  Can be configured for
 block mode or streaming mode.  Arguments:
    NAME - name of the module.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.