Difference between revisions of "Component: Scale (DSP)"
(XML import) |
|||
(9 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {| style="width:50%" | |
− | |||
− | {| | ||
|- | |- | ||
− | | width="20%" style="color: gray;" | Author | + | | width="20%" style="color:gray;" | Author |
| Matrix Ltd | | Matrix Ltd | ||
|- | |- | ||
− | | width="20%" style="color: gray;" | Version | + | | width="20%" style="color:gray;" | Version |
− | | 1.1 | + | | 1.1 |
|- | |- | ||
− | | width="20%" style="color: gray;" | Category | + | | width="20%" style="color:gray;" | Category |
| DSP | | DSP | ||
|} | |} | ||
+ | ==Scale component== | ||
+ | Allows the values in a single buffer to be scaled uniformly. Functions include: Multiply, Divide, LeftShift, RightShift, Float Multiply, Float Divide | ||
− | == | + | ==Component Pack== |
− | |||
− | |||
− | + | DSP | |
− | |||
− | |||
− | |||
− | + | ==Detailed description== | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | ''No detailed description exists yet for this component'' | |
− | + | ==Examples== | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | Here is an example which demonstrates variable scaling based on an analogue input. | ||
− | + | {{Fcfile|Scale.fcfx|Scale}} | |
− | + | Here are the traces as seen on the data recorder window. | |
+ | [[File:DSPScale.jpg]] | ||
− | |||
− | |||
− | + | The RightShift macro is a very efficient means of performing a division but only for values which are a power of 2. | |
− | + | The LeftShift macro is a very efficient means of performing a multiplication but only for values which are a power of 2. | |
− | + | LeftShift(1) = Multiply by 2 / RightShift(1) = Divide by 2 | |
− | + | LeftShift(2) = Multiply by 4 / RightShift(2) = Divide by 4 | |
+ | LeftShift(3) = Multiply by 8 / RightShift(3) = Divide by 8 | ||
− | = | + | LeftShift(4) = Multiply by 16 / RightShift(4) = Divide by 16 |
− | |||
− | + | ==Downloadable macro reference== | |
− | :[[ | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
− | + | |- | |
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetScalerFloat''' | ||
+ | |- | ||
+ | | colspan="2" | Sets the Float scaler to be used when calling the calculate function. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT | ||
+ | | width="90%" | Scaler | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | '''Return | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetScalerInteger''' | ||
+ | |- | ||
+ | | colspan="2" | Sets the Integer scaler to be used when calling the calculate function. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT | ||
+ | | width="90%" | Scaler | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Calculate''' | ||
+ | |- | ||
+ | | colspan="2" | Performs the selected scaling on a value from the input buffer and passes to the output buffer. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | |||
− | ''' | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CalculateArray''' | ||
+ | |- | ||
+ | | colspan="2" | Performs the selected scaling on an entire buffer. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Property reference== | ==Property reference== | ||
− | |||
− | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | |
− | + | |- | |
− | + | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]] | |
− | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties''' | |
− | + | |- | |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |
− | + | | width="90%" | Connect To | |
− | Buffer | + | |- |
− | + | | colspan="2" | DSP component with output buffer to collect our data from. | |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | |
− | + | | width="90%" | Buffer Size | |
− | + | |- | |
− | + | | colspan="2" | Number of individual elements the buffer can store, default 1. | |
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | ||
+ | | width="90%" | Buffer Type | ||
+ | |- | ||
+ | | colspan="2" | Sets the buffer data type. | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | ||
+ | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Scaling | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | ||
+ | | width="90%" | Scale Type | ||
+ | |- | ||
+ | | colspan="2" | Defines the type of calculation performed on the input buffer to obtain the output value. A left shift is essentially an optimised multiply with the multiplier being the 2^scaler A right shift is essentially an optimised divide with the divider being the 2^scaler | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]] | ||
+ | | width="90%" | Rollover | ||
+ | |- | ||
+ | | colspan="2" | Allow the output buffer to rollover. For example 128 * 2 = 256 which would equate to 0 using an 8-bit buffer with rollover enabled. With rollover disabled the output would be set to 255 which is the max representable value. | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | ||
+ | | width="90%" | Initial Integer Scaler | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |} |
Latest revision as of 17:19, 9 November 2022
Author | Matrix Ltd |
Version | 1.1 |
Category | DSP |
Contents
Scale component
Allows the values in a single buffer to be scaled uniformly. Functions include: Multiply, Divide, LeftShift, RightShift, Float Multiply, Float Divide
Component Pack
DSP
Detailed description
No detailed description exists yet for this component
Examples
Here is an example which demonstrates variable scaling based on an analogue input.
Here are the traces as seen on the data recorder window.
The RightShift macro is a very efficient means of performing a division but only for values which are a power of 2.
The LeftShift macro is a very efficient means of performing a multiplication but only for values which are a power of 2.
LeftShift(1) = Multiply by 2 / RightShift(1) = Divide by 2
LeftShift(2) = Multiply by 4 / RightShift(2) = Divide by 4
LeftShift(3) = Multiply by 8 / RightShift(3) = Divide by 8
LeftShift(4) = Multiply by 16 / RightShift(4) = Divide by 16
Downloadable macro reference
![]() |
SetScalerFloat |
Sets the Float scaler to be used when calling the calculate function. | |
![]() |
Scaler |
![]() |
Return |
![]() |
SetScalerInteger |
Sets the Integer scaler to be used when calling the calculate function. | |
![]() |
Scaler |
![]() |
Return |
![]() |
Calculate |
Performs the selected scaling on a value from the input buffer and passes to the output buffer. | |
![]() |
Return |
![]() |
CalculateArray |
Performs the selected scaling on an entire buffer. | |
![]() |
Return |