snr

Functions

int main(int argc, char *argv[])

snr [ option ] file1 [ infile ]

  • -l int

    • frame length \((1 \le L)\)

  • -o int

    • output type \((0 \le O \le 2)\)

      • 0 SNR

      • 1 segmental SNR

      • 2 segmental SNR per frame

  • file1 str

    • double-type signal sequence, \(x_1\)

  • infile str

    • double-type signal+noise sequence, \(x_2\)

  • stdout

    • double-type SNR

The inputs of this commands are two signals:

\[\begin{split} \begin{array}{cccc} x_1(0), & x_1(1), & \ldots, & x_1(T-1), \\ x_2(0), & x_2(1), & \ldots, & x_2(T-1). \end{array} \end{split}\]
If \(O=2\), segmental SNR is calculated and output at every frame:
\[ \begin{array}{cccc} y(0), & y(1), & \ldots, & y(N-1), \end{array} \]
where \(N = \lfloor (T-1)/L \rfloor\) and
\[ y(n) = 10 \log_{10} \frac{\displaystyle\sum_{l=0}^{L-1} \{ x_1(nL + l) \}^2 } {\displaystyle\sum_{l=0}^{L-1} \{ x_2(nL + l) - x_1(nL + l) \}^2 }. \]
If \(O=1\), the output is averaged segmental SNR:
\[ y = \frac{1}{N} \sum_{n=0}^{N-1} y(n). \]
If \(O=0\), the output is a standard SNR:
\[ y = 10 \log_{10} \frac{\displaystyle\sum_{t=0}^{T-1} \{ x_1(t) \}^2 } {\displaystyle\sum_{t=0}^{T-1} \{ x_2(t) - x_1(t) \}^2 }. \]

Parameters:
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns:

0 on success, 1 on failure.

See also

rmse