User-Defined Opcode Database

lowpass

A k-rate smoothing UDO that is useful for averaging performance controller data.

Download UDO File

Description

This opcode implements a smoothing algorithm which is intended for use with alternate controllers. It takes a data-value input and a power (filter strength) input outputting of course, the smoothed data.

Syntax

kout lowpass kin, kpow

Performance

kin -- Data to be smoothed.

kpow -- Strength of the filter.

kout -- Smoothed data.

Code

opcode	lowpass, k, kk

klp	init	0

kval, kpowr	xin

kpow	pow	1.037, kpowr
kpow	=	kpow - 1

klp	=	((kpow * klp) + kval)/(kpow+1)

	xout	klp

		endop

Examples

instr	2	;  demonstrate lowpass filter

kin	ctrl7	1, 1, 0, 127
kpow	ctrl7	1, 7, 0, 127

kpass	lowpass	kin, kpow

	printks	"\\nraw: %d\\npow: %d\\nfilt: %d\\n", 0.25, kin, kpow, kpass

		endin

Credits

David Akbari - 2005


Previous Home Next
hysteresis   rbatonPot