Simple DSP

Summary

Doc_BoxAlgorithm_SimpleDSP.png
  • Plugin name : Simple DSP
  • Version : 1.0
  • Author : Bruno Renier / Yann Renard
  • Company : INRIA / IRISA
  • Short description : Apply mathematical formulaes to matrices.
  • Documentation template generation date : Jan 9 2018

Description

This plugin is used to apply a mathematical formulae to each sample of an incoming signal and output the resulting signal. It thus acts as a simple DSP.

The author may add up to 15 additional inputs. In such circumstances, each input would be identified by a letter from A to P.

Also the type of the inputs could be changed to any streamed matrix derived type. Thus you can process signal, spectrum or feature vector if you need.

Inputs

You can use from 1 to 16 inputs.

1. Input - A

Input signal

  • Type identifier : Signal (0x5ba36127, 0x195feae1)

Outputs

1. Output

Filtered signal.

  • Type identifier : Signal (0x5ba36127, 0x195feae1)

Settings

1. Equation

Formula to apply to incoming data (identified as 'X'). See Miscellaneous for more details.

  • Type identifier : String (0x79a9edeb, 0x245d83fc)
  • Default value : [ x ]

Examples

Let's consider that we want to compute the natural logarithm of the absolute value of the input signal plus one. We just have to type the equation like that :

log(abs(X) + 1)

Another example : if you want to sum the cosinus of X minus Pi with its sinus plus Pi, you can enter this equation :

cos(X - M_PI) + sin(X + M_PI)

Miscellaneous

The equation can use at most 16 variables, for 16 input signals. The variable names are the 16 first letters of the alphabet, i.e. 'a' (or 'A') to 'p' (or 'P') matches inputs 1 to 16. NB : The first input variable can be named 'x' or 'X'.

Here is a list of supported functions/operators :

  • Operators
    • +
    • -
    • *
    • /
  • Unary functions
    • abs
    • acos
    • asin
    • atan
    • ceil
    • cos
    • exp
    • floor
    • log
    • log10
    • sin
    • sqrt
    • tan
  • Binary function
    • pow
  • Comparison operators
    • >
    • >=
    • <
    • <=
    • ==
    • = (equivalent to ==)
    • !=
    • <> (equivalent to !=)
  • Boolean operators
    • & as and
    • && also as and
    • | as or
    • || also as or
    • ! as not
    • ~ as xor
    • ^ also as xor
  • ternary operator
    • ? :

There are also a few defined constants :

  • M_PI
  • M_PI_2
  • M_PI_4
  • M_1_PI
  • M_2_PI
  • M_2_SQRTPI
  • M_SQRT2
  • M_SQRT1_2
  • M_E
  • M_LOG2E
  • M_LOG10E
  • M_LN2
  • M_LN10

(note : their meaning is the same as the constants of the same name in math.c)

Furthermore, the equation parser is totally case-insensitive. So you can write "COS(m_pi+x)" or "cos(M_PI+X)", it doesn't matter.

Don't worry about the whitespaces and blank characters, they are automatically skipped by the equation parser. That means, for instance, that both "X+1" and "X + 1" work.

This plugin implements basic constant folding. That means that when the plugin analyses the equation, if it can compute some parts of it before compilation, it will. For now, it does not support rational equations simplification.