<?xml version="1.0" encoding="utf-8" standalone="yes"?>

<?xml-stylesheet href="./_c74_ref.xsl" type="text/xsl"?>

<!--This is an automatically generated file. DO NOT EDIT THIS FILE DIRECTLY. Rather, use the _ref.xml files found in the 'edits' folder.-->
<c74object name="onepole~" module="msp" category="MSP Filters">
	<digest>
		Single-pole lowpass filter
	</digest>
	<description>
		The <o>onepole~</o> object implements the simplest of IIR filters, providing a 6dB per octave attenuation. This filter is very efficient and useful for gently rolling off harsh high end and for smoothing out control signals.
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			MSP
		</metadata>
		<metadata name="tag">
			MSP Filters
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="signal">
			<digest>
				(signal) filter input
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="1" type="signal or float">
			<digest>
				(signal or float) Cutoff Frequency (Hz)
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="signal">
			<digest>
				(signal) filter output
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
	</outletlist>
	<!--ARGUMENTS-->
	<objarglist>
		<objarg name="center-frequency" optional="1" units="hz" type="float">
			<digest>
				Center frequency
			</digest>
			<description>
				Sets the center frequency for the filter, as described above.
			</description>
		</objarg>
		<objarg name="Hz/linear/radians" optional="1" type="symbol">
			<digest>
				Frequency input mode
			</digest>
			<description>
				Using the symbols <m>Hz</m>, <m>linear</m>, or <m>radians</m> for an optional second argument sets the frequency input mode. The default mode is Hz (which is the same as providing no mode argument). Using the <m>linear</m> argument sets the frequency input mode to linear (0 - 1). Using the <m>radians</m> argument sets the frequency input mode to radians (0 - 1).
			</description>
		</objarg>
	</objarglist>
	<!--MESSAGES-->
	<methodlist>
		<method name="int">
			<arglist>
				<arg name="center-frequency (Hz)" optional="0" type="int" />
			</arglist>
			<digest>
				Set the filter frequency
			</digest>
			<description>
				In right inlet: Sets the frequency for the filter (if no signal is connected). By default, frequency is expressed in Hz, where the allowable range is from 0 to one fourth of the current sampling rate. For convenience, <o>onepole~</o> has two additional input modes that use the more conventional input range, 0 - 1 (see the <m>linear</m> and <m>radians</m> messages).
			</description>
		</method>
		<method name="float">
			<arglist>
				<arg name="center-frequency (Hz or 0 through 1 specified by object-argument)" optional="0" type="float" />
			</arglist>
			<digest>
				Set the filter frequency
			</digest>
			<description>
				In right inlet: Sets the frequency for the filter (if no signal is connected). By default, frequency is expressed in Hz, where the allowable range is from 0 to one fourth of the current sampling rate. For convenience, <o>onepole~</o> has two additional input modes that use the more conventional input range, 0 - 1 (see the <m>linear</m> and <m>radians</m> messages).
			</description>
		</method>
		<method name="Hz">
			<arglist />
			<digest>
				Set the frequency input mode to Hz.
			</digest>
			<description>
				In either inlet: Sets the frequency input mode to Hz (the default).
			</description>
		</method>
		<method name="clear">
			<arglist />
			<digest>
				Clear the filter's internal state
			</digest>
			<description>
				In either inlet: Clears the internal state of onepole~. Since onepole~ does not have the inherent instability of other filter types, this should never be necessary.
			</description>
		</method>
		<method name="linear">
			<arglist />
			<digest>
				Set the frequency input mode to linear
			</digest>
			<description>
				In either inlet: Sets the frequency input mode to linear (0 - 1). Linear mode is simply a scaled version of the standard Hz mode, except that values in the 0-1 range traverses the full frequency range.
			</description>
		</method>
		<method name="radians">
			<arglist />
			<digest>
				Set the frequency input mode to radians
			</digest>
			<description>
				In either inlet: Sets the frequency input mode to radians (0 - 1). Radians mode lets you set the center frequency (f_c) of the equation directly, while the input has the same range (0-1), the output has a curved frequency response that is closer to the exponential pitch scale of the human ear.
			</description>
		</method>
		<method name="signal">
			<arglist />
			<digest>
				Function depends on inlet
			</digest>
			<description>
				In left inlet: Signal to be filtered.
				<br />
				<br />
				In right inlet: A signal can be used to set the frequency for the filter, with the same effect as a float. If a signal is connected to this inlet, its value is sampled once every signal vector.
			</description>
		</method>
	</methodlist>
	<!--ATTRIBUTES-->
	<!--EXAMPLE-->
	<examplelist>
		<example img="onepole~.png" caption="onepole~ provides efficient filtering for a simple sample player" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="biquad~" />
		<seealso name="comb~" />
		<seealso name="cross~" />
		<seealso name="lores~" />
		<seealso name="reson~" />
		<seealso name="svf~" />
		<seealso name="audio_filtering" module="core" type="vignette" />
	</seealsolist>
	<discussion>
		The standard difference equation for this filter is
		<br />
		<br />
		y(n) = a_{0} x(n) + b_{1} y(n-1)
		<br />
		Where
		<br />
		<br />
		b_{1} = 1 - a_{0}
		<br />
		<br />
		which can be factored down to
		<br />
		<br />
		y(n) = y(n-1) + a_{0}[ x(n) - y(n-1) ]
		<br />
		<br />
		As the value of the a_{0} coefficient is lowered (b_{1} increases) the input will be increasingly smoothed and the effective cutoff frequency (f_c) lowered. Calculating the a_0 coefficient from the f_c cutoff frequency is performed with the equation
		<br />
		<br />
		a_{0} = sin(f_c * (pi/nyquist))
		<br />
		<br />
		where f_s is the sampling frequency and f_c the cutoff frequency expressed in Hertz. <o>onepole~</o> is a more efficient implementation of a <o>biquad~</o> object with the following coefficients:
		<br />
		<br />
		a_{0} &amp;= a_{0}
		<br />
		a_{1} &amp;= 0
		<br />
		a_{2} &amp;= 0
		<br />
		b_{1} &amp;= -b_{1}
		<br />
		b_{2} &amp;= 0
		<br />
		Note the sign flip for b_{1} as biquad uses flipped signs for the feedback coefficients.
	</discussion>
	<misc name="Output">
		<entry name="signal">
			<description>
				The filtered signal.
			</description>
		</entry>
	</misc>
</c74object>
