Programmer Guide/SPU Reference/UCONV: Difference between revisions

From STX Wiki
Jump to navigationJump to search
(initial import)
 
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
====UCONV - amp/frq value conversions====
Apply amplitude or frequency scale conversion.
 
==<code>[SPU UCONV <var>X TYP A B</var> OUT <var>Y</var>]</code>==
=====Usage:=====
{|class="einrahmen"
 
!input !!description !!data type !!value type!!default value
<code>UCONV <var>x type a b</var></code>
 
=====Inputs:=====
 
{|
|-
|-
|x
|<var>X</var>||input date||number, vector||variable ||
|number or vector to be converted
|-
|-
|type
|<var>TYP</var>||conversion (see description)||number (int.), string||constant ||<code>0</code>
|type of conversion
|-
|-
|a
|<var>A, B</var>||conversion parameters (see description)||number||variable ||
|conversion parameter a
|-
|-
|b
!output !!description !!data type !!value type!!comment
|conversion parameter b
|}
 
=====Outputs:=====
 
{|
|-
|-
|<var>y</var>
|<var>Y</var>||converted input data||same type as <var>A</var>||variable
|converted number or vector (same type as x)
|}
|}
;Description:
This atom performs a conversion of the input <var>X</var> (containing physical data) into another unit or domain. The type of conversion is controlled by the selection input <var>TYPE</var> and the parameter inputs <var>A</var> and <var>B</var>. The input data can be stored in a number or vector. If the input is a vector, the conversion is applied to all elements.


=====Function:=====
{|class="einrahmen"
 
!<var>TYPE</var>
This atom performs a conversion of the vector <var>x</var> (containing physical data) into another unit or domain. The type of conversion is controlled by the selection input <var>type</var> and the parameter inputs <var>a</var> and <var>b</var>. The input data can be stored in a number or vector. If the input is a vector, the conversion is applied to all elements.
!default<BR><var>A</var>
 
!default<BR><var>B</var>
Conversion type selected by input <var>type</var>
!applied transformation /conversion
 
{|
|-
|
|
|
|
|-
|value of type
|default values
|applied transformation /conversion
|-
|a
|b
|-
|-
|<code>0</code> or <code>LINEAR</code>
|<code>0</code> or <code>LINEAR</code>
|<code>1</code>
|<code>1</code>
|<code>0</code>
|<code>0</code>
|Linear transformation. Parameter a is used as slope and parameter <var>b</var> as offset: <var>y</var><code>=</code><var>a</var><code>.</code><var>x</var><code>+</code><var>b</var>
|Linear transformation. Parameter <var>A</var> is used as slope and parameter <var>B</var> as offset<BR>
<math>Y=A.X+B\!</math>
|-
|-
|<code>1</code> or <code>HZ2CENT</code>
|<code>1</code> or <code>HZ2CENT</code>
|<code>1</code>
|<code>1</code>
|<code>0</code>
|<code>0</code>
|Convert frequency from Hertz to Cents. Parameter a is used as reference frequency and <var>b</var> as offset in Cents:<var>y</var><code>=1200.log2(</code><var>x</var><code>/</code><var>a</var><code>)+</code><var>b</var>
|Convert frequency from Hertz to Cents. Parameter <var>A</var> is used as reference frequency and <var>B</var> as offset in Cents.<BR>
<math>Y=1200\cdot\log_2\left (\frac{X}{A}\right )+B</math>
|-
|-
|<code>2</code> or <code>CENT2HZ</code>
|<code>2</code> or <code>CENT2HZ</code>
|<code>1</code>
|<code>1</code>
|<code>0</code>
|<code>0</code>
|Convert frequency from Cents to Hertz. Parameter a is used as reference frequency and <var>b</var> as offset in Cents: <var>y</var><code>=</code><var>a</var><code>.2(</code><var>x</var><code>-</code><var>b</var><code>)/1200</code>
|Convert frequency from Cents to Hertz. Parameter <var>A</var> is used as reference frequency and <var>B</var> as offset in Cents.<BR>
<math>Y=A\cdot 2^{\frac{X-B}{1200}}</math>
|-
|-
|<code>3</code> or <code>HZ2BARK</code>
|<code>3</code> or <code>HZ2BARK</code>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|Convert frequency from Hertz to Barks. Uses the transformation published by Zwicker and Fastl (1990). The parameters a and <var>b</var> are ignored.
|Convert frequency from Hertz to Barks. Uses the transformation published by Zwicker and Fastl (1990). The parameters <var>A</var> and <var>B</var> are ignored.
|-
|-
|<code>4</code> or <code>BARK2HZ</code>
|<code>4</code> or <code>BARK2HZ</code>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
|Convert frequency from Barks to Hertz. Uses an iteration method that minimizes the distance to the forward conversion algorithm. The parameters a and <var>b</var> are ignored.
|Convert frequency from Barks to Hertz. Uses an iteration method that minimizes the distance to the forward conversion algorithm. The parameters <var>A</var> and <var>B</var> are ignored.
|-
|-
|<code>5</code> or <code>LIN2LOG</code>
|<code>5</code> or <code>LIN2LOG</code>
|<code>1</code>
|<code>1</code>
|<code>20</code>
|<code>20</code>
|Convert from linear to logarithmic scale. Parameter a is used as reference value and <var>b</var> as factor: <var>y</var><code>=</code><var>b</var><code>.log10(</code><var>x</var><code>/</code><var>a</var><code>)</code>
|Convert from linear to logarithmic scale. Parameter <var>A</var> is used as reference value and <var>B</var> as factor.<BR>
<math>Y=B \cdot log_{10} \left (\frac{X}{A} \right )</math>
|-
|-
|<code>6</code> or <code>LOG2LIN</code>
|<code>6</code> or <code>LOG2LIN</code>
|<code>1</code>
|<code>1</code>
|<code>20</code>
|<code>20</code>
|Convert from logarithmic to linear scale. Parameter a is used as reference value and <var>b</var> as factor: <var>y</var><code>=</code><var>a</var><code>.10</code><var>x</var><code>/</code><var>b</var>
|Convert from logarithmic to linear scale. Parameter <var>A</var> is used as reference value and <var>B</var> as factor.<BR>
<math>Y=A \cdot 10^{\frac{X}{B}}</math>
|-
|-
|<code>7 or HZ2MEL</code>
|<code>7 or HZ2MEL</code>
|<code>-</code>
|<code>-</code>
|<code>-</code>
|<code>-</code>
|Convert from Hertz to Mel.The parameters a and <var>b</var> are ignored.
|Convert from Hertz to Mel. The parameters <var>A</var> and <var>B</var> are ignored.
|-
|-
|<code>8 or MEL2HZ</code>
|<code>8 or MEL2HZ</code>
|<code>-</code>
|<code>-</code>
|<code>-</code>
|<code>-</code>
|Convert from Mel to Hertz.The parameters a and <var>b</var> are ignored.
|Convert from Mel to Hertz. The parameters <var>A</var> and <var>B</var> are ignored.
|-
|-
|<code>9 or HZ2ERB</code>
|<code>9 or HZ2ERB</code>
|<code>-</code>
|<code>-</code>
|<code>-</code>
|<code>-</code>  
|Convert from Hertz to ERB (Equivalent Rectangular Bandwidth).The parameters a and <var>b</var> are ignored.
|Convert from Hertz to ERB (Equivalent Rectangular Bandwidth). The parameters <var>A</var> and <var>B</var> are ignored.
|-
|-
|<code>10 or ERB2HZ</code>
|<code>10 or ERB2HZ</code>
|<code>-</code>
|<code>-</code>
|<code>-</code>
|<code>-</code>
|Convert from ERB (Equivalent Rectangular Bandwidth) to Hertz.The parameters a and <var>b</var> are ignored.
|Convert from ERB (Equivalent Rectangular Bandwidth) to Hertz. The parameters <var>A</var> and <var>B</var> are ignored.
|}
|}
;See also:
<[[../#Signal Processing Atoms|SP-atoms]]>
<!-- AN, 2.5.2011 -->

Latest revision as of 14:24, 9 May 2011

Apply amplitude or frequency scale conversion.

[SPU UCONV X TYP A B OUT Y]

input description data type value type default value
X input date number, vector variable
TYP conversion (see description) number (int.), string constant 0
A, B conversion parameters (see description) number variable
output description data type value type comment
Y converted input data same type as A variable
Description

This atom performs a conversion of the input X (containing physical data) into another unit or domain. The type of conversion is controlled by the selection input TYPE and the parameter inputs A and B. The input data can be stored in a number or vector. If the input is a vector, the conversion is applied to all elements.

TYPE default
A
default
B
applied transformation /conversion
0 or LINEAR 1 0 Linear transformation. Parameter A is used as slope and parameter B as offset

{\displaystyle Y=A.X+B\!}

1 or HZ2CENT 1 0 Convert frequency from Hertz to Cents. Parameter A is used as reference frequency and B as offset in Cents.

{\displaystyle Y=1200\cdot \log _{2}\left({\frac {X}{A}}\right)+B}

2 or CENT2HZ 1 0 Convert frequency from Cents to Hertz. Parameter A is used as reference frequency and B as offset in Cents.

{\displaystyle Y=A\cdot 2^{\frac {X-B}{1200}}}

3 or HZ2BARK - - Convert frequency from Hertz to Barks. Uses the transformation published by Zwicker and Fastl (1990). The parameters A and B are ignored.
4 or BARK2HZ - - Convert frequency from Barks to Hertz. Uses an iteration method that minimizes the distance to the forward conversion algorithm. The parameters A and B are ignored.
5 or LIN2LOG 1 20 Convert from linear to logarithmic scale. Parameter A is used as reference value and B as factor.

{\displaystyle Y=B\cdot log_{10}\left({\frac {X}{A}}\right)}

6 or LOG2LIN 1 20 Convert from logarithmic to linear scale. Parameter A is used as reference value and B as factor.

{\displaystyle Y=A\cdot 10^{\frac {X}{B}}}

7 or HZ2MEL - - Convert from Hertz to Mel. The parameters A and B are ignored.
8 or MEL2HZ - - Convert from Mel to Hertz. The parameters A and B are ignored.
9 or HZ2ERB - - Convert from Hertz to ERB (Equivalent Rectangular Bandwidth). The parameters A and B are ignored.
10 or ERB2HZ - - Convert from ERB (Equivalent Rectangular Bandwidth) to Hertz. The parameters A and B are ignored.
See also

<SP-atoms>

Navigation menu

Personal tools