Programmer Guide/SPU Reference/PPM: Difference between revisions
No edit summary |
No edit summary |
||
Line 42: | Line 42: | ||
|<code>3</code> or <code>DB</code> || 20 * log<sub>10</sub>(''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. | The output <var>M</var> is the maximum of all computed <var>Y</var> values. | ||
Line 47: | Line 48: | ||
:with: t = index of evaluation cycle | :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: | ;See also: |
Revision as of 09:05, 9 May 2011
Level meter (PPM). This atom is used for the level display in the recorder application.
Contents
[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 computed value v is converted to the selected UNIT and stored in the output Y.
UNIT Y 0
orVALUE
v 1
orSQUARE
v2 2
orRATIO
v / REF 3
orDB
20 * log10(v / REF)
The output M is the maximum of all computed Y values.
- Mt = max(Y0, Y1, .., Yt)
- with: t = index of evaluation cycle
The output P is set to a value in range 0 to SIZE and can be used to display a level bar.
The levels -140dB to 0dB are mapped to the values 0 to SIZE using a non-linear mapping function.
- See also
<SP-atoms>
PPM - signal peak measurement
Usage:
PPM X TYPE T UNIT REF
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:
Y | 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 X 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 (UNIT equal 2 or 3) the value of input REF (>0) is used as the reference value.
The output M is set to the maximum of all computed Y values (M(t) = max(Y(0), Y(1), .., Y(t)).
Table: Peak magnitude measurement methods selected by input TYPE{|
|-
|value of TYPE
|method (P = peak value)
|-
|0
or HOLD
|The absolute peak magnitude is measured using a sample/hold circuit:if |X(t)| > P(t-1) or holdtime > T:P(t) = |X(t)|; holdtime is set to zerootherwise:P(t) = P(t-1); holdtime is incremented
|-
|1
or EXPONENTIAL
|Use an exponential decay for peak measurement:P(t) = max(k . P(t-1), |X(t)|)The factor k is set to k=0.51/T . This means the ppm value falls to 50% after T samples, if input values are lower than the ppm output.
|-
|2
or RMS
|Pseudo ppm measurement based on running rms magnitude (just for test purposes):(1) r(t) = ((T-1).r(t-1) + X2(t)) / T(2) P(t) = (2.r(t))1/2
|}
Table: Peak magnitude output formats selected by input UNIT{|
|-
|value of UNIT
|conversion
|-
|0
or VALUE
|Y(t) = P(t)
|-
|1
or SQUARE
|Y(t) = P(t)2
|-
|2
or RATIO
|Y(t) = P(t) / REF
|-
|3
or DB
|Y(t) = 20.log10(P(t) / REF)
|}