Programmer Guide/SPU Reference/PPM: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(24 intermediate revisions by the same user not shown)
Line 7: Line 7:
|<var>X</var>||input signal||number, vector ||variable  
|<var>X</var>||input signal||number, vector ||variable  
|-
|-
|<var>TYPE</var>||measurement method<BR>(<code>HOLD, EXPONENTIAL, RMS<code>)||number (int.), string||constant ||<code>0</code> (= <code>HOLD</code>)
|<var>TYPE</var>||measurement method<BR>(<code>HOLD, EXPONENTIAL, RMS</code>)||number (int.), string||constant ||<code>0</code> (= <code>HOLD</code>)
|-
|-
|<var>T</var>||measurement time constant in samples||number||constant ||<code>100</code>
|<var>T</var>||measurement time constant in samples||number||constant ||<code>100</code>
Line 28: Line 28:


;Description:
;Description:
 
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>.
 
The computed value ''v'' 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> !! computation of ''v''<sub>t</sub>
|-
|<code>0</code> or <code>VALUE</code> || ''v''
|-
|<code>1</code> or <code>SQUARE</code> || ''v''<sup>2</sup>
|-
|<code>2</code> or <code>RATIO</code> || ''v'' / <var>REF</var>
|-
|<code>3</code> or <code>DB</code> || 20 * log<sub>10</sub>(''v'' / <var>REF</var>)
|}
 
 
The output <var>M</var> is the maximum of all computed <var>Y</var> values.
:<var>M</var><sub>t</sub> = max(<var>Y</var><sub>0</sub>, <var>Y</var><sub>1</sub>, .., <var>Y</var><sub>t</sub>)
:with: t = index of evaluation cycle
 
 
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.
The levels -140dB to 0dB are mapped to the values 0 to <var>SIZE</var> using a non-linear mapping function.
 
;See also:
<[[../#Signal Processing Atoms|SP-atoms]]>
<!-- AN, 2.5.2011 -->
 
 
 
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
====PPM - signal peak measurement====
 
=====Usage:=====
 
<code>PPM <var>X</var> <var>TYPE</var> <var>T</var> <var>UNIT</var> <var>REF</var></code>
 
=====Inputs:=====
 
{|
|-
|X
|signal (sample or frame)
|-
|TYPE
|type of measurement
|-
|T
|measurement interval, integration time (in samples)
|-
|UNIT
|output unit/mode
|-
|REF
|reference value for relative output units/modes
|}
 
=====Outputs:=====
 
{|
|-
|<var>Y</var>
|current peak value
|-
|M
|maximum peak value
|}
 
=====Function:=====
 
This function implements a set of magnitude measurement methods. If input X is a number, a peak value for each sample is computed. If input <var>X</var> is a vector, only one peak value for the vector is computed.
 
The computed peak value is converted to the selected unit/mode before it is written to the output. For the relative output modes (<var>UNIT</var> equal 2 or 3) the value of input <var>REF</var> (>0) is used as the reference value.
 
The output <var>M</var> is set to the maximum of all computed <var>Y</var> values (<var>M</var>(t) = max(<var>Y</var>(0), <var>Y</var>(1), .., <var>Y</var>(t)).
 
Table: Peak magnitude measurement methods selected by input <var>TYPE</var>{|
|-
|value of TYPE
|method (P = peak value)
|-
|-
|<code>0</code> or <code>HOLD</code>  
|<code>0</code> or <code>HOLD</code>  
|The absolute peak magnitude is measured using a sample/hold circuit:if <nowiki>|</nowiki><var>X</var>(t)| > P(t-1) or holdtime > T:P(t) = |<var>X</var>(t)|; holdtime is set to zerootherwise:P(t) = P(t-1); holdtime is incremented
|<math>v_t = \max(|x_t|, |x_{t-1}|, .., |x_{t-T+1}|)\!</math>
|-
|-
|<code>1</code> or <code>EXPONENTIAL</code>
|<code>1</code> or <code>EXPONENTIAL</code>
|Use an exponential decay for peak measurement:P(t) = max(k . P(t<nowiki>-</nowiki>1), |<var>X</var>(t)|)The factor k is set to k=0.51/<var>T</var> . This means the ppm value falls to 50% after <var>T</var> samples, if input values are lower than the ppm output.
|<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>
|<code>2</code> or <code>RMS</code>
|Pseudo ppm measurement based on running rms magnitude (just for test purposes):(1) r(t) = ((T-1).r(t-1) + <var>X</var>2(t)) / <var>T</var>(2) P(t) = (2.r(t))1/2
|<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>.
Table: Peak magnitude output formats selected by input <var>UNIT</var>{|
:{|class="einrahmen"
|-
!<var>UNIT</var> !! <var>Y</var>
|value of UNIT
|conversion
|-
|-
|<code>0</code> or <code>VALUE</code>
|<code>0</code> or <code>VALUE</code> || <math>v_t\!</math>
|Y(t) = P(t)
|-
|-
|<code>1</code> or <code>SQUARE</code>
|<code>1</code> or <code>SQUARE</code> || <math>v_t^2</math>
|Y(t) = P(t)2
|-
|-
|<code>2</code> or <code>RATIO</code>
|<code>2</code> or <code>RATIO</code> || <math>\frac{v_t}{REF}</math>
|Y(t) = P(t) / <var>REF</var>
|-
|-
|<code>3</code> or <code>DB</code>
|<code>3</code> or <code>DB</code> ||<math>20.\log_{10}{\frac{v_t}{REF}}</math>
|Y(t) = 20.log10(P(t) / <var>REF</var>)
|}
|}
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.
;See also:
<[[../#Signal Processing Atoms|SP-atoms]]>
<!-- AN, 2.5.2011 -->

Latest revision as of 10:51, 9 May 2011

Level meter (PPM). This atom is used for the level display in the recorder application.

[SPU PPM X TYPE T UNIT REF SIZE OUT Y M P]

input description data type value type default value
X input signal number, vector variable
TYPE measurement method
(HOLD, EXPONENTIAL, RMS)
number (int.), string constant 0 (= HOLD)
T measurement time constant in samples number constant 100
UNIT output value and unit
(VALUE, SQUARE, RATIO, DB)
number (int.), string constant 0 (=VALUE)
REF reference value, used for UNIT values RATIO and DB number constant 0
SIZE length of bar (graph) used for ppm display number constant 100
output description data type value type comment
Y ppm value number variable
M maximum Y number variable
P ppm bar position, always computed for the ppm value in dB (independent of UNIT) number variable


Description

The level meter value vt (t = sample index) is computed for each value xt of the input signal X. The last vt of an evaluation cycle is used to update the outputs Y and P.

TYPE computation of vt
0 or HOLD {\displaystyle v_{t}=\max(|x_{t}|,|x_{t-1}|,..,|x_{t-T+1}|)\!}
1 or EXPONENTIAL {\displaystyle v_{t}=max(|x_{t}|,v_{t-1}.k){\mbox{, with: }}k={\frac {1}{\sqrt[{T}]{2}}}}
2 or RMS {\displaystyle r_{t}={\frac {(r_{t-1}.(T-1)+x^{2})}{T}}}
{\displaystyle v_{t}={\sqrt {2.r_{t}}}}

The last value vt of an evaluation cycle is converted to the selected UNIT and stored in the output Y.

UNIT Y
0 or VALUE {\displaystyle v_{t}\!}
1 or SQUARE {\displaystyle v_{t}^{2}}
2 or RATIO {\displaystyle {\frac {v_{t}}{REF}}}
3 or DB {\displaystyle 20.\log _{10}{\frac {v_{t}}{REF}}}

The output P is set to a value in range 0 to SIZE and can be used to display a level bar. For P always the logarithmic value (level in dB) is used. The level interval -140dB to 0dB is mapped to the position interval 0 to SIZE using a non-linear mapping function.

The output M is the maximum of all computed vt values converted to the selected output unit.

See also

<SP-atoms>

Navigation menu

Personal tools