delta
Functions
-
int main(int argc, char *argv[])
delta [ option ] [ infile ]
-l int
length of vector \((1 \le M + 1)\)
-m int
order of vector \((0 \le M)\)
-d double+
delta coefficients
-D str
filename of double-type delta coefficients
-r int+
width of 1st (and 2nd) regression coefficients
-magic double
magic number
infile str
double-type static feature vectors
stdout
double-type static and dynamic feature vectors
The below examples calculate the first and second order dynamic features from 15-dimensional coefficient vectors in
data.d
.delta -l 15 -d -0.5 0.0 0.5 -d 1.0 -2.0 1.0 < data.d > data.delta
This is equivalent to
echo -0.5 0.0 0.5 | x2x +ad > delta.win echo 1.0 -2.0 1.0 | x2x +ad > accel.win delta -l 15 -D delta.win -D accel.win < data.d > data.delta
If data contains a special number such as an unvoiced symbol in a sequence of fundamental frequencies, use -magic option:
delta -l 15 -D delta.win -magic -1e+10 < data.lf0 > data.lf0.delta
-r option specifies the width of regression coefficients, \(L^{(1)}\) and \(L^{(2)}\). The first and second derivatives are then calculated as follows:
\[\begin{split}\begin{eqnarray} \Delta^{(1)} x_t &=& \frac{\displaystyle\sum_{\tau=-L^{(1)}}^{L^{(1)}} \tau \, x_{t+\tau}} {\displaystyle\sum_{\tau=-L^{(1)}}^{L^{(1)}} \tau^2}, \\ \Delta^{(2)} x_t &=& \frac{\displaystyle\sum_{\tau=-L^{(2)}}^{L^{(2)}} (a_0 \tau^2 - a_1) x_{t+\tau}} {2 \cdot (a_2 a_0 - a_1^2)}, \end{eqnarray}\end{split}\]where\[\begin{split}\begin{eqnarray} a_0 &=& \displaystyle\sum_{\tau=-L^{(2)}}^{L^{(2)}} 1, \\ a_1 &=& \displaystyle\sum_{\tau=-L^{(2)}}^{L^{(2)}} \tau^2, \\ a_2 &=& \displaystyle\sum_{\tau=-L^{(2)}}^{L^{(2)}} \tau^4. \end{eqnarray}\end{split}\]- Parameters:
argc – [in] Number of arguments.
argv – [in] Argument vector.
- Returns:
0 on success, 1 on failure.
See also
-
class DeltaCalculation : public sptk::InputSourceInterface
Calculate derivatives.
The input is the \(M\)-th order static feature components:
\[ \begin{array}{cccc} x_t(0), & x_t(1), & \ldots, & x_t(M), \end{array} \]and the output is composed of the set of dynamic feature components:\[ \begin{array}{cccccc} \Delta^{(1)} x_t(0), & \ldots, & \Delta^{(1)} x_t(M), & \Delta^{(2)} x_t(0), & \ldots, & \Delta^{(D)} x_t(M). \end{array} \]The derivatives are derived as
\[ \Delta^{(d)} x(m) = \sum_{\tau=-L^{(d)}}^{L^{(d)}} w^{(d)}_{\tau} x_{t+\tau}(m) \]where \(w^{(d)}\) is the \(d\)-th window coefficients and \(L^{(d)}\) is half the width of the window.Public Functions
-
DeltaCalculation(int num_order, const std::vector<std::vector<double>> &window_coefficients, InputSourceInterface *input_source, bool use_magic_number, double magic_number = 0.0)
- Parameters:
num_order – [in] Order of coefficients, \(M\).
window_coefficients – [in] Window coefficients. e.g.) { {1.0}, {-0.5, 0.0, 0.5} }
input_source – [in] Static components sequence.
use_magic_number – [in] Whether to use a magic number.
magic_number – [in] A magic number.
-
inline int GetNumOrder() const
- Returns:
Order of coefficients.
-
inline double GetMagicNumber() const
- Returns:
Magic number.
-
inline virtual int GetSize() const override
- Returns:
Output size.
-
inline virtual bool IsValid() const override
- Returns:
True if this object is valid.
-
virtual bool Get(std::vector<double> *delta) override
- Parameters:
delta – [out] Delta components.
- Returns:
True on success, false on failure.
-
DeltaCalculation(int num_order, const std::vector<std::vector<double>> &window_coefficients, InputSourceInterface *input_source, bool use_magic_number, double magic_number = 0.0)