Programmer Guide/SPU Reference/LIMITER: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
 
(20 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
Apply limiter function to a signal.
Apply a non-linear limiter function to a signal.
==<code>[SPU LIMITER <var>X TYPE MAX LIM</var> OUT <var>Y Q</var>]</code>==
==<code>[SPU LIMITER <var>X TYPE MAX LIM</var> OUT <var>Y Q</var>]</code>==
{|class="einrahmen"
{|class="einrahmen"
Line 17: Line 17:
|<var>Y</var>||limited signal||same type as <var>A</var>||variable  
|<var>Y</var>||limited signal||same type as <var>A</var>||variable  
|-
|-
|<var>Q</var>||overload ratio||number||variable  
|<var>Q</var>||relative number of limited samples||number||variable  
|}
|}
;Description:
;Description:
This SP-atom applies a non-linear magnitude weighting (= limiter function) to the signal. The limiter function is only applied if the absolute value of the signal magnitude is higher than the specified limiter start magnitude <var>LIM</var>. For the limiter function, the following algorithm is used:
This SP-atom applies a non-linear magnitude weighting (= limiter function) to the signal. The limiter function is only applied if the absolute value of the signal magnitude is higher than the specified limiter start magnitude <var>LIM</var>. For the limiter function, the following algorithm is used:
<math>y_i = \begin{cases}  
:<math>y_i = \begin{cases}  
x_i  & \mbox{if }|x_i|\leslant LIM \\
x_i  & \mbox{ if }|x_i| \leqslant LIM \\
3n+1, & \mbox{if }n\mbox{ is odd}  
sign(x_i).f \left ( \frac{|x_i|}{MAX} \right ) & \mbox{ otherwise}  
\end{cases}
\end{cases}
</math>
</math>
 
The absolute magitude of the limited signal is always lower than <var>MAX</var>. The limiter function is selected by the input <var>TYPE</var>.
The level meter value ''v''<sub>t</sub> (t = sample index) is computed for each value ''x''<sub>t</sub> of the input signal <var>X</var>. The last ''v''<sub>t</sub> of an evaluation cycle is used to update the outputs <var>Y</var> and <var>P</var>.
:{|class="einrahmen"
!<var>TYPE</var> !! computation of ''v''<sub>t</sub>
|-
|<code>0</code> or <code>HOLD</code>
|<math>v_t = \max(|x_t|, |x_{t-1}|, .., |x_{t-T+1}|)\!</math>
|-
|<code>1</code> or <code>EXPONENTIAL</code>
|<math>v_t = max(|x_t|, v_{t-1}.k)\mbox{, with: }k = \frac{1}{\sqrt[T]{2}}</math>
|-
|<code>2</code> or <code>RMS</code>
|<math>r_t = \frac{(r_{t-1}.(T-1)+x^2)}{T}</math><BR><math>v_t = \sqrt{2.r_t}</math>
|}
The last value ''v''<sub>t</sub> of an evaluation cycle is converted to the selected <var>UNIT</var> and stored in the output <var>Y</var>.
:{|class="einrahmen"
:{|class="einrahmen"
!<var>UNIT</var> !! <var>Y</var>
!<var>TYPE</var> !!limiter function ''f''(''z''<sub>i</sub>)
|-
|<code>0</code> or <code>VALUE</code> || <math>v_t\!</math>
|-
|<code>1</code> or <code>SQUARE</code> || <math>v_t^2</math>
|-
|<code>2</code> or <code>RATIO</code> || <math>\frac{v_t}{REF}</math>
|-
|<code>3</code> or <code>DB</code> ||<math>20.\log_{10}{\frac{v_t}{REF}}</math>
|}
 
The output <var>P</var> is set to a value in range 0 to <var>SIZE</var> and can be used to display a level bar. For <var>P</var> always the logarithmic value (level in dB) is used. The level interval -140dB to 0dB is mapped to the position interval 0 to <var>SIZE</var> using a non-linear mapping function.
 
The output <var>M</var> is the maximum of all computed ''v''<sub>t</sub> values converted to the selected output unit.
 
 
 
 
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
====LIMITER - amplitude limiter (non-linear)====
 
 
 
[[File:1240.png]]
 
with:
 
{|
|-
|x, y
|input and output signal sample
|-
|LIM, <var>MAX</var>
|limiter start amplitude and maximum signal amplitude
|-
|f()
|limiter function selected by input TYPE
|}
 
Table: Limiter functions{|
|-
|-
|The value of TYPE
|<code>0</code> or <code>RECTANGLE</code>
|The limiter function f(z)
|<math>k\!</math>
|-
|-
|0 or RECTANGLE
|<code>1</code> or <code>ATAN</code>
|[[File:1241.png]] ('cut<nowiki>-</nowiki>off')
|<math>k+(1-k) \cdot \frac{2}{\pi} \cdot atan\left ( \frac{z-k}{1-k} \cdot \frac{\pi}{2} \right )</math>
|-
|-
|1 or ATAN
|<code>2</code> or <code>EXPONENTIAL</code>
|[[File:1242.png]]
|<math>1-(1-k) \cdot e^{-\frac{z-k}{1-k}}</math>
|-
|2 or EXPONENTIAL
|[[File:1243.png]]
|}
|}
:with: <math>z_i = \frac{|x_i|}{MAX}, k = \frac{LIM}{MAX}</math>


with:
[[File:1244.png]]
The output Q is set to the relative number of processed samples:
<var>Q</var> = number of changed samples / number of processed samples
=====Usage:=====
<code>LIMITER <var>X TYPE MAX LIM</var></code>
=====Inputs:=====
;<var>X</var>
:The signal vector or sample.
;<var>TYPE</var>
:The type of limiter function (see table above).
;<var>MAX</var>
:The maximum magnitude (full attenuation).
;<var>LIM</var>
:The limiter start magnitude. This value must be less than <var>MAX</var>.
=====Outputs:=====
;<var>Y</var>
:The limited signal (the same type as <var>X</var>).
;<var>Q</var>


:The relative number of limited (changed) samples.
The output <var>Q</var> is set to the relative number of limited (changed) samples.
:<math>Q = \frac{changedSamples}{processedSamples}</math>


;See also:
;See also:
<[[../#Signal Processing Atoms|SP-atoms]]>
<[[../#Signal Processing Atoms|SP-atoms]]>
<!-- AN, 2.5.2011 -->
<!-- AN, 2.5.2011 -->

Latest revision as of 11:54, 9 May 2011

Apply a non-linear limiter function to a signal.

[SPU LIMITER X TYPE MAX LIM OUT Y Q]

input description data type value type default value
X input signal number, vector variable
TYPE limiter function
(RECTANGLE, ATAN, EXPONENTIAL)
number (int.), string constant 0 (= RECTANGLE)
MAX maximum value; 0 < MAX number constant 1
LIM limiter start value; 0 < LIMMAX number constant 1
output description data type value type comment
Y limited signal same type as A variable
Q relative number of limited samples number variable
Description

This SP-atom applies a non-linear magnitude weighting (= limiter function) to the signal. The limiter function is only applied if the absolute value of the signal magnitude is higher than the specified limiter start magnitude LIM. For the limiter function, the following algorithm is used:

{\displaystyle y_{i}={\begin{cases}x_{i}&{\mbox{ if }}|x_{i}|\leqslant LIM\\sign(x_{i}).f\left({\frac {|x_{i}|}{MAX}}\right)&{\mbox{ otherwise}}\end{cases}}}

The absolute magitude of the limited signal is always lower than MAX. The limiter function is selected by the input TYPE.

TYPE limiter function f(zi)
0 or RECTANGLE {\displaystyle k\!}
1 or ATAN {\displaystyle k+(1-k)\cdot {\frac {2}{\pi }}\cdot atan\left({\frac {z-k}{1-k}}\cdot {\frac {\pi }{2}}\right)}
2 or EXPONENTIAL {\displaystyle 1-(1-k)\cdot e^{-{\frac {z-k}{1-k}}}}
with: {\displaystyle z_{i}={\frac {|x_{i}|}{MAX}},k={\frac {LIM}{MAX}}}


The output Q is set to the relative number of limited (changed) samples.

{\displaystyle Q={\frac {changedSamples}{processedSamples}}}
See also

<SP-atoms>

Navigation menu

Personal tools