You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(125) |
Nov
(7) |
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
(9) |
Jun
(150) |
Jul
(7) |
Aug
|
Sep
|
Oct
|
Nov
(15) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
(183) |
2010 |
Jan
|
Feb
(1) |
Mar
(26) |
Apr
(23) |
May
(4) |
Jun
(8) |
Jul
(9) |
Aug
(19) |
Sep
(6) |
Oct
(27) |
Nov
(5) |
Dec
(135) |
2011 |
Jan
(1) |
Feb
|
Mar
|
Apr
(22) |
May
(8) |
Jun
(8) |
Jul
(2) |
Aug
(12) |
Sep
(3) |
Oct
(13) |
Nov
(31) |
Dec
(40) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(11) |
Jun
(27) |
Jul
(6) |
Aug
(19) |
Sep
(14) |
Oct
(8) |
Nov
(10) |
Dec
(82) |
2013 |
Jan
(12) |
Feb
(14) |
Mar
(11) |
Apr
(4) |
May
(2) |
Jun
(2) |
Jul
|
Aug
(11) |
Sep
(16) |
Oct
(2) |
Nov
(23) |
Dec
(86) |
2014 |
Jan
(1) |
Feb
(18) |
Mar
(5) |
Apr
(13) |
May
(2) |
Jun
(8) |
Jul
(1) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
(65) |
2015 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
(2) |
Sep
(1) |
Oct
(2) |
Nov
(6) |
Dec
(41) |
2016 |
Jan
(2) |
Feb
(2) |
Mar
(3) |
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
(5) |
Aug
(8) |
Sep
(3) |
Oct
(26) |
Nov
(11) |
Dec
(45) |
2017 |
Jan
(12) |
Feb
(9) |
Mar
(4) |
Apr
(8) |
May
(20) |
Jun
(13) |
Jul
(18) |
Aug
(6) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv24709 Modified Files: Makefile linear_predictive_coefficients_to_line_spectral_pairs.cc Added Files: line_spectral_pairs_to_linear_predictive_coefficients.cc line_spectral_pairs_to_linear_predictive_coefficients.h Log Message: add a class for lsp2lpc Index: linear_predictive_coefficients_to_line_spectral_pairs.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/linear_predictive_coefficients_to_line_spectral_pairs.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** linear_predictive_coefficients_to_line_spectral_pairs.cc 26 Jan 2017 10:33:53 -0000 1.1 --- linear_predictive_coefficients_to_line_spectral_pairs.cc 7 Feb 2017 10:00:38 -0000 1.2 *************** *** 45,49 **** #include "linear_predictive_coefficients_to_line_spectral_pairs.h" ! #include <cmath> // std::acos, std::ceil, std::fabs #include <cstddef> // std::size_t --- 45,49 ---- #include "linear_predictive_coefficients_to_line_spectral_pairs.h" ! #include <cmath> // std::acos, std::ceil, std::fabs, std::floor #include <cstddef> // std::size_t *************** *** 56,61 **** double epsilon) : num_order_(num_order), ! num_symmetric_polynomial_order_(std::ceil((num_order + 1) / 2)), ! num_asymmetric_polynomial_order_(num_order / 2), num_split_(num_split), num_iteration_(num_iteration), --- 56,63 ---- double epsilon) : num_order_(num_order), ! num_symmetric_polynomial_order_( ! static_cast<int>(std::ceil(num_order * 0.5))), ! num_asymmetric_polynomial_order_( ! static_cast<int>(std::floor(num_order * 0.5))), num_split_(num_split), num_iteration_(num_iteration), --- NEW FILE: line_spectral_pairs_to_linear_predictive_coefficients.h --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // // All rights reserved. // // // // Redistribution and use in source and binary forms, with or // // without modification, are permitted provided that the following // // conditions are met: // // // // - Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above // // copyright notice, this list of conditions and the following // // disclaimer in the documentation and/or other materials provided // // with the distribution. // // - Neither the name of the SPTK working group nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND // // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS // // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // ----------------------------------------------------------------- // #ifndef SPTK_SRC_LINE_SPECTRAL_PAIRS_TO_LINEAR_PREDICTIVE_COEFFICIENTS_H_ #define SPTK_SRC_LINE_SPECTRAL_PAIRS_TO_LINEAR_PREDICTIVE_COEFFICIENTS_H_ #include <vector> // std::vector #include "sptk_utils.h" namespace sptk { class LineSpectralPairsToLinearPredictiveCoefficients { public: class Buffer { public: Buffer() { } virtual ~Buffer() { } private: std::vector<double> p_; std::vector<double> q_; std::vector<double> a0_; std::vector<double> a1_; std::vector<double> a2_; std::vector<double> b0_; std::vector<double> b1_; std::vector<double> b2_; friend class LineSpectralPairsToLinearPredictiveCoefficients; DISALLOW_COPY_AND_ASSIGN(Buffer); }; // explicit LineSpectralPairsToLinearPredictiveCoefficients(int num_order); // virtual ~LineSpectralPairsToLinearPredictiveCoefficients() { } // int GetNumOrder() const { return num_order_; } // bool IsValid() const { return is_valid_; } // bool Run( const std::vector<double>& line_spectral_pairs, std::vector<double>* linear_predictive_coefficients, LineSpectralPairsToLinearPredictiveCoefficients::Buffer* buffer) const; private: // const int num_order_; // const int num_symmetric_polynomial_order_; // const int num_asymmetric_polynomial_order_; // bool is_valid_; // DISALLOW_COPY_AND_ASSIGN(LineSpectralPairsToLinearPredictiveCoefficients); }; } // namespace sptk #endif // SPTK_SRC_LINE_SPECTRAL_PAIRS_TO_LINEAR_PREDICTIVE_COEFFICIENTS_H_ Index: Makefile =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/Makefile,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Makefile 26 Jan 2017 10:33:53 -0000 1.26 --- Makefile 7 Feb 2017 10:00:38 -0000 1.27 *************** *** 66,69 **** --- 66,70 ---- input_source_preprocessing_for_filter_gain.cc \ levinson_durbin_recursion.cc \ + line_spectral_pairs_to_linear_predictive_coefficients.cc \ linear_predictive_coefficients_to_cepstrum.cc \ linear_predictive_coefficients_to_line_spectral_pairs.cc \ --- NEW FILE: line_spectral_pairs_to_linear_predictive_coefficients.cc --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // // All rights reserved. // // // // Redistribution and use in source and binary forms, with or // // without modification, are permitted provided that the following // // conditions are met: // // // // - Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above // // copyright notice, this list of conditions and the following // // disclaimer in the documentation and/or other materials provided // // with the distribution. // // - Neither the name of the SPTK working group nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND // // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS // // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // ----------------------------------------------------------------- // #include "line_spectral_pairs_to_linear_predictive_coefficients.h" #include <algorithm> // std::fill_n #include <cmath> // std::ceil, std::cos, std::floor #include <cstddef> // std::size_t namespace sptk { LineSpectralPairsToLinearPredictiveCoefficients:: LineSpectralPairsToLinearPredictiveCoefficients(int num_order) : num_order_(num_order), num_symmetric_polynomial_order_( static_cast<int>(std::ceil(num_order * 0.5))), num_asymmetric_polynomial_order_( static_cast<int>(std::floor(num_order * 0.5))), is_valid_(true) { if (num_order < 0) { is_valid_ = false; } } bool LineSpectralPairsToLinearPredictiveCoefficients::Run( const std::vector<double>& line_spectral_pairs, std::vector<double>* linear_predictive_coefficients, LineSpectralPairsToLinearPredictiveCoefficients::Buffer* buffer) const { // check inputs if (!is_valid_ || line_spectral_pairs.size() != static_cast<std::size_t>(num_order_ + 1) || NULL == linear_predictive_coefficients || NULL == buffer) { return false; } // prepare memory if (linear_predictive_coefficients->size() < static_cast<std::size_t>(num_order_ + 1)) { linear_predictive_coefficients->resize(num_order_ + 1); } // the first element of vector represents a gain (*linear_predictive_coefficients)[0] = line_spectral_pairs[0]; if (0 == num_order_) return true; // prepare buffer if (buffer->p_.size() < static_cast<std::size_t>(num_asymmetric_polynomial_order_)) { buffer->p_.resize(num_asymmetric_polynomial_order_); } if (buffer->q_.size() < static_cast<std::size_t>(num_symmetric_polynomial_order_)) { buffer->q_.resize(num_symmetric_polynomial_order_); } if (buffer->a0_.size() < static_cast<std::size_t>(num_asymmetric_polynomial_order_ + 1)) { buffer->a0_.resize(num_asymmetric_polynomial_order_ + 1); } if (buffer->a1_.size() < static_cast<std::size_t>(num_asymmetric_polynomial_order_)) { buffer->a1_.resize(num_asymmetric_polynomial_order_); } if (buffer->a2_.size() < static_cast<std::size_t>(num_asymmetric_polynomial_order_)) { buffer->a2_.resize(num_asymmetric_polynomial_order_); } if (buffer->b0_.size() < static_cast<std::size_t>(num_symmetric_polynomial_order_ + 1)) { buffer->b0_.resize(num_symmetric_polynomial_order_ + 1); } if (buffer->b1_.size() < static_cast<std::size_t>(num_symmetric_polynomial_order_)) { buffer->b1_.resize(num_symmetric_polynomial_order_); } if (buffer->b2_.size() < static_cast<std::size_t>(num_symmetric_polynomial_order_)) { buffer->b2_.resize(num_symmetric_polynomial_order_); } const double* input(&(line_spectral_pairs[0])); double* output(&((*linear_predictive_coefficients)[0])); double* p(&buffer->p_[0]); double* q(&buffer->q_[0]); double* a0(&buffer->a0_[0]); double* a1(&buffer->a1_[0]); double* a2(&buffer->a2_[0]); double* b0(&buffer->b0_[0]); double* b1(&buffer->b1_[0]); double* b2(&buffer->b2_[0]); double c0(1.0); double c1(0.0); double c2(0.0); // calculate line spectral pairs filter parameters for (int i(0), j(2); i < num_asymmetric_polynomial_order_; ++i, j += 2) { p[i] = -2.0 * std::cos(sptk::kTwoPi * input[j]); } for (int i(0), j(1); i < num_symmetric_polynomial_order_; ++i, j += 2) { q[i] = -2.0 * std::cos(sptk::kTwoPi * input[j]); } std::fill_n(a1, num_asymmetric_polynomial_order_, 0.0); std::fill_n(a2, num_asymmetric_polynomial_order_, 0.0); std::fill_n(b1, num_symmetric_polynomial_order_, 0.0); std::fill_n(b2, num_symmetric_polynomial_order_, 0.0); // calculate impulse response of analysis filter const bool is_odd(num_order_ % 2 == 1); for (int j(0); j <= num_order_; ++j) { if (is_odd) { a0[0] = c0 - c2; b0[0] = c0; c2 = c1; c1 = c0; } else { a0[0] = c0 - c1; b0[0] = c0 + c1; c1 = c0; } for (int i(0); i < num_asymmetric_polynomial_order_; ++i) { a0[i + 1] = a0[i] + p[i] * a1[i] + a2[i]; a2[i] = a1[i]; a1[i] = a0[i]; } for (int i(0); i < num_symmetric_polynomial_order_; ++i) { b0[i + 1] = b0[i] + q[i] * b1[i] + b2[i]; b2[i] = b1[i]; b1[i] = b0[i]; } if (0 == j) { c0 = 0.0; } else { output[j] = 0.5 * (a0[num_asymmetric_polynomial_order_] + b0[num_symmetric_polynomial_order_]); } } return true; } } // namespace sptk |
From: fujishita t. <fjs...@us...> - 2017-02-07 06:55:21
|
Update of /cvsroot/sp-tk/SPTK/doc/ref_e In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv16007 Modified Files: fdrw.tex Log Message: modify fdrw reference Index: fdrw.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/fdrw.tex,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** fdrw.tex 30 Jan 2017 07:13:54 -0000 1.25 --- fdrw.tex 7 Feb 2017 06:55:19 -0000 1.26 *************** *** 100,105 **** drawn on the X window environment: \begin{quote} ! \verb!impulse | dfs -a 1 0.8 0.5 | fdrw -H 0.3 | xgr! \end{quote} The graph width is 10cm and its height is 3cm. \par --- 100,108 ---- drawn on the X window environment: \begin{quote} ! \verb!impulse | dfs -a 1 0.8 0.5 | fdrw -W 1.0 -H 0.3 | xgr! \end{quote} + \hspace{3cm} + \includegraphics[scale=0.7]{fig/fdrw_1.pdf} + The graph width is 10cm and its height is 3cm. \par *************** *** 109,117 **** \verb!impulse | dfs -a 1 0.8 0.5 | spec | fdrw -y -60 40 | xgr! \end{quote} The $y$ axis goes from $-60$ dB to $40$ dB. \par The running spectrum can be draw on the X window environment by: \begin{quote} ! \verb!fig -g 0 -W 0.4 << EOF ! \\ \verb!~~~~x 0 5 !\\ \verb!~~~~xscale 0 1 2 3 4 5 !\\ --- 112,123 ---- \verb!impulse | dfs -a 1 0.8 0.5 | spec | fdrw -y -60 40 | xgr! \end{quote} + \hspace{3cm} + \includegraphics[scale=0.7]{fig/fdrw_2.pdf} + The $y$ axis goes from $-60$ dB to $40$ dB. \par The running spectrum can be draw on the X window environment by: \begin{quote} ! \verb!fig -g 0 -W 0.4 << EOF ; ! \\ \verb!~~~~x 0 5 !\\ \verb!~~~~xscale 0 1 2 3 4 5 !\\ *************** *** 119,125 **** \verb!EOF!\\ \verb!spec < data |\ !\\ ! \verb!fdrw -W 0.4 -H 0.2 -g 0 -n 129 -y -30 30 -z 3 |\ !\\ \verb!xgr ! \end{quote} The command {\em psgr} prints the output to a laser printer in the same manner as it is printed on the screen. --- 125,134 ---- \verb!EOF!\\ \verb!spec < data |\ !\\ ! \verb!fdrw -W 0.4 -H 0.2 -g 0 -n 257 -y -40 40 -z 1.7 |\ !\\ \verb!xgr ! \end{quote} + \hspace{3cm} + \includegraphics[width=4cm,height=18cm]{fig/fdrw_3.pdf} + The command {\em psgr} prints the output to a laser printer in the same manner as it is printed on the screen. |
From: fujishita t. <fjs...@us...> - 2017-02-02 07:19:18
|
Update of /cvsroot/sp-tk/SPTK/doc/ref_e In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv418 Modified Files: Makefile.in appendix.tex bcp.tex dct.tex df2.tex dtw.tex fft2.tex fftr2.tex fig.tex glogsp.tex gmm.tex grlogsp.tex gseries.tex idct.tex ifft.tex ifft2.tex lbg.tex lmadf.tex main.tex merge.tex Log Message: change eps file to pdf file Index: fig.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/fig.tex,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** fig.tex 22 Dec 2016 10:52:58 -0000 1.28 --- fig.tex 2 Feb 2017 07:19:15 -0000 1.29 *************** *** 71,77 **** \argm{g}{G}{draw grid ($0 \sim 2$)\\ \begin{tabular}{cccc} ! &\includegraphics[width=2cm]{fig/g0.eps} ! &\includegraphics[width=2cm]{fig/g1.eps} ! &\includegraphics[width=2cm]{fig/g2.eps}\\ $G$&0&1&2 \end{tabular}\\\hspace*{\fill}}{2} --- 71,77 ---- \argm{g}{G}{draw grid ($0 \sim 2$)\\ \begin{tabular}{cccc} ! &\includegraphics[width=2cm]{fig/g0.pdf} ! &\includegraphics[width=2cm]{fig/g1.pdf} ! &\includegraphics[width=2cm]{fig/g2.pdf}\\ $G$&0&1&2 \end{tabular}\\\hspace*{\fill}}{2} *************** *** 158,162 **** xscale 0~1.0 ~s1.5 ~'2 ~$\backslash$2.5 ~'3.14 ~''$\backslash$pi'' ~@4 ~''x'' ~5\\ ! \includegraphics[width=9cm]{fig/scale.eps} \end{minipage}\\ --- 158,162 ---- xscale 0~1.0 ~s1.5 ~'2 ~$\backslash$2.5 ~'3.14 ~''$\backslash$pi'' ~@4 ~''x'' ~5\\ ! \includegraphics[width=9cm]{fig/scale.pdf} \end{minipage}\\ *************** *** 183,188 **** \begin{tabular}{cc} ! \includegraphics{fig/fig-print1.eps}& ! \includegraphics{fig/fig-print2.eps}\\ print&printc \end{tabular}p --- 183,188 ---- \begin{tabular}{cc} ! \includegraphics{fig/fig-print1.pdf}& ! \includegraphics{fig/fig-print2.pdf}\\ print&printc \end{tabular}p *************** *** 258,262 **** (Example)\\ \begin{minipage}[t]{4.3cm} ! \includegraphics[width=4cm]{fig/grid.eps} \end{minipage} \begin{minipage}[b]{4.5cm} --- 258,262 ---- (Example)\\ \begin{minipage}[t]{4.3cm} ! \includegraphics[width=4cm]{fig/grid.pdf} \end{minipage} \begin{minipage}[b]{4.5cm} *************** *** 312,316 **** (Example)\\ \begin{minipage}[t]{4.3cm} ! \includegraphics[width=4cm]{fig/circle.eps} \end{minipage} \begin{minipage}[b]{4.5cm} --- 312,316 ---- (Example)\\ \begin{minipage}[t]{4.3cm} ! \includegraphics[width=4cm]{fig/circle.pdf} \end{minipage} \begin{minipage}[b]{4.5cm} *************** *** 346,350 **** (Example)\\ \begin{minipage}[t]{4.3cm} ! \includegraphics[width=4cm]{fig/box.eps} \end{minipage} \begin{minipage}[b]{4.5cm} --- 346,350 ---- (Example)\\ \begin{minipage}[t]{4.3cm} ! \includegraphics[width=4cm]{fig/box.pdf} \end{minipage} \begin{minipage}[b]{4.5cm} *************** *** 376,380 **** (Example)\\ \begin{minipage}[t]{4.3cm} ! \includegraphics[width=4cm]{fig/clip.eps} \end{minipage} \begin{minipage}[b]{4.5cm} --- 376,380 ---- (Example)\\ \begin{minipage}[t]{4.3cm} ! \includegraphics[width=4cm]{fig/clip.pdf} \end{minipage} \begin{minipage}[b]{4.5cm} *************** *** 451,455 **** \begin{center} \leavevmode ! \includegraphics[width=12cm]{fig/mark.eps} \\ \end{center} --- 451,455 ---- \begin{center} \leavevmode ! \includegraphics[width=12cm]{fig/mark.pdf} \\ \end{center} *************** *** 460,464 **** \leavevmode ! \includegraphics{fig/pen-line.eps} \\ ps:~~ The types of output generated by the pen command --- 460,464 ---- \leavevmode ! \includegraphics{fig/pen-line.pdf} \\ ps:~~ The types of output generated by the pen command *************** *** 482,490 **** {\large \hspace{-1.5ex}$\bullet$ The following types of joins can be defined:}\\ ! \includegraphics[width=9cm]{fig/join-type.eps}\\ \vspace{5mm} {\large \hspace{-1.5ex}$\bullet$ paint type:}\\ ! \includegraphics{fig/paint.eps}\\ ps:~~~From $1 \sim 3$ only a frame is draw, and for $-9$ and $-19$ the center is white and no frame is draw. --- 482,490 ---- {\large \hspace{-1.5ex}$\bullet$ The following types of joins can be defined:}\\ ! \includegraphics[width=9cm]{fig/join-type.pdf}\\ \vspace{5mm} {\large \hspace{-1.5ex}$\bullet$ paint type:}\\ ! \includegraphics{fig/paint.pdf}\\ ps:~~~From $1 \sim 3$ only a frame is draw, and for $-9$ and $-19$ the center is white and no frame is draw. Index: fftr2.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/fftr2.tex,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** fftr2.tex 22 Dec 2016 10:52:58 -0000 1.20 --- fftr2.tex 2 Feb 2017 07:19:15 -0000 1.21 *************** *** 58,62 **** \begin{center} \leavevmode ! \includegraphics{fig/fftr2.eps} \end{center} \end{qsection} --- 58,62 ---- \begin{center} \leavevmode ! \includegraphics{fig/fftr2.pdf} \end{center} \end{qsection} Index: dct.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/dct.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** dct.tex 22 Dec 2016 10:52:58 -0000 1.13 --- dct.tex 2 Feb 2017 07:19:15 -0000 1.14 *************** *** 56,60 **** \begin{center} \leavevmode ! \includegraphics{fig/dct.eps} \end{center} The Discrete Cosine Transform II can be written as: --- 56,60 ---- \begin{center} \leavevmode ! \includegraphics{fig/dct.pdf} \end{center} The Discrete Cosine Transform II can be written as: Index: bcp.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/bcp.tex,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** bcp.tex 22 Dec 2016 10:52:57 -0000 1.23 --- bcp.tex 2 Feb 2017 07:19:15 -0000 1.24 *************** *** 64,68 **** \begin{center} \leavevmode ! \includegraphics{fig/bcp.eps} \caption{Example of the bcp command} \end{center} --- 64,68 ---- \begin{center} \leavevmode ! \includegraphics{fig/bcp.pdf} \caption{Example of the bcp command} \end{center} Index: Makefile.in =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/Makefile.in,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** Makefile.in 22 Dec 2016 10:52:57 -0000 1.33 --- Makefile.in 2 Feb 2017 07:19:14 -0000 1.34 *************** *** 180,213 **** zerodf.tex \ ref.tex - EPSF = fig/bcp.eps \ - fig/box.eps \ - fig/circle.eps \ - fig/clip.eps \ - fig/dct.eps \ - fig/df2.eps \ - fig/fft2-comp.eps \ - fig/fft2-quad.eps \ - fig/fft2-trans.eps \ - fig/fft2.eps \ - fig/fftr2.eps \ - fig/fig-print1.eps \ - fig/fig-print2.eps \ - fig/g0.eps \ - fig/g1.eps \ - fig/g2.eps \ - fig/glogsp-on.eps \ - fig/glogsp-sample.eps \ - fig/grid.eps \ - fig/grlogsp-on.eps \ - fig/idct.eps \ - fig/ifft.eps \ - fig/ifft2.eps \ - fig/join-type.eps \ - fig/mark.eps \ - fig/merge.eps \ - fig/paint.eps \ - fig/pen-line.eps \ - fig/scale.eps \ - fig/sptk_sigproc.eps --- 180,183 ---- *************** *** 281,287 **** all: $(TARGET) ! $(PS): $(DVI) $(EPSF) ! $(DVI): $(AUX) $(IND) $(EPSF) $(IND): $(AUX) --- 251,257 ---- all: $(TARGET) ! $(PS): $(DVI) ! $(DVI): $(AUX) $(IND) $(IND): $(AUX) *************** *** 289,293 **** $(AUX): $(INC) ! $(PDF): $(DVI) $(EPSF) ############################################################ --- 259,263 ---- $(AUX): $(INC) ! $(PDF): $(DVI) ############################################################ Index: appendix.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/appendix.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** appendix.tex 21 Dec 2012 09:50:23 -0000 1.4 --- appendix.tex 2 Feb 2017 07:19:15 -0000 1.5 *************** *** 6,8 **** \vspace{1.0cm} ! \includegraphics[width=\hsize]{fig/sptk_sigproc.eps} --- 6,8 ---- \vspace{1.0cm} ! \includegraphics[width=\hsize]{fig/sptk_sigproc.pdf} Index: fft2.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/fft2.tex,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** fft2.tex 22 Dec 2016 10:52:58 -0000 1.18 --- fft2.tex 2 Feb 2017 07:19:15 -0000 1.19 *************** *** 59,63 **** \begin{center} \leavevmode ! \includegraphics{fig/fft2.eps} \end{center} \end{qsection} --- 59,63 ---- \begin{center} \leavevmode ! \includegraphics{fig/fft2.pdf} \end{center} \end{qsection} *************** *** 73,77 **** \begin{center} \leavevmode ! \includegraphics{fig/fft2-trans.eps} \end{center}~}{FALSE} \argm{c}{}{When results are transposed, 1 boundary data is copied from the --- 73,77 ---- \begin{center} \leavevmode ! \includegraphics{fig/fft2-trans.pdf} \end{center}~}{FALSE} \argm{c}{}{When results are transposed, 1 boundary data is copied from the *************** *** 79,83 **** \begin{center} \leavevmode ! \includegraphics{fig/fft2-comp.eps} \end{center}~}{FALSE} \argm{q}{}{Output first $1/4$ data of FFT results only. --- 79,83 ---- \begin{center} \leavevmode ! \includegraphics{fig/fft2-comp.pdf} \end{center}~}{FALSE} \argm{q}{}{Output first $1/4$ data of FFT results only. *************** *** 86,90 **** \begin{center} \leavevmode ! \includegraphics{fig/fft2-quad.eps} \end{center}~}{FALSE} %\hspace*{\fill} \argm{A}{}{output amplitude}{FALSE} --- 86,90 ---- \begin{center} \leavevmode ! \includegraphics{fig/fft2-quad.pdf} \end{center}~}{FALSE} %\hspace*{\fill} \argm{A}{}{output amplitude}{FALSE} Index: ifft.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/ifft.tex,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ifft.tex 22 Dec 2016 10:52:58 -0000 1.18 --- ifft.tex 2 Feb 2017 07:19:15 -0000 1.19 *************** *** 56,60 **** \begin{center} \leavevmode ! \includegraphics{fig/ifft.eps} \end{center} \end{qsection} --- 56,60 ---- \begin{center} \leavevmode ! \includegraphics{fig/ifft.pdf} \end{center} \end{qsection} Index: ifft2.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/ifft2.tex,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** ifft2.tex 22 Dec 2016 10:52:58 -0000 1.21 --- ifft2.tex 2 Feb 2017 07:19:15 -0000 1.22 *************** *** 57,61 **** \begin{center} \leavevmode ! \includegraphics{fig/ifft2.eps} \end{center} \end{qsection} --- 57,61 ---- \begin{center} \leavevmode ! \includegraphics{fig/ifft2.pdf} \end{center} \end{qsection} *************** *** 72,76 **** \begin{center} \leavevmode ! \includegraphics{fig/fft2-quad.eps} \end{center}~}{FALSE} %\hspace*{\fill} \argm{R}{}{output only real part}{FALSE} --- 72,76 ---- \begin{center} \leavevmode ! \includegraphics{fig/fft2-quad.pdf} \end{center}~}{FALSE} %\hspace*{\fill} \argm{R}{}{output only real part}{FALSE} Index: lmadf.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/lmadf.tex,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** lmadf.tex 22 Dec 2016 10:52:58 -0000 1.27 --- lmadf.tex 2 Feb 2017 07:19:15 -0000 1.28 *************** *** 174,178 **** \begin{center} \leavevmode ! \includegraphics{fig/FIRflt.eps} \end{center} \begin{center} --- 174,178 ---- \begin{center} \leavevmode ! \includegraphics{fig/FIRflt.pdf} \end{center} \begin{center} *************** *** 184,188 **** \begin{center} \leavevmode ! \includegraphics{fig/transflt.eps} \end{center} \begin{center} --- 184,188 ---- \begin{center} \leavevmode ! \includegraphics{fig/transflt.pdf} \end{center} \begin{center} Index: df2.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/df2.tex,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** df2.tex 22 Dec 2016 10:52:58 -0000 1.25 --- df2.tex 2 Feb 2017 07:19:15 -0000 1.26 *************** *** 82,85 **** \end{quote} \hspace{3cm} ! \includegraphics[width=4cm]{fig/df2.eps} \end{qsection} --- 82,85 ---- \end{quote} \hspace{3cm} ! \includegraphics[width=4cm]{fig/df2.pdf} \end{qsection} Index: main.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/main.tex,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** main.tex 22 Dec 2016 10:52:58 -0000 1.55 --- main.tex 2 Feb 2017 07:19:15 -0000 1.56 *************** *** 43,52 **** % ----------------------------------------------------------------- % \documentclass[12pt]{book} ! \usepackage[dvips]{graphicx} \usepackage{fleqn} \usepackage{makeidx} \usepackage[square,sort,comma,numbers]{natbib} \usepackage{cmndref} ! \usepackage[dvips, dvipdfm, bookmarks=true, --- 43,52 ---- % ----------------------------------------------------------------- % \documentclass[12pt]{book} ! \usepackage[dvipdfmx]{graphicx} \usepackage{fleqn} \usepackage{makeidx} \usepackage[square,sort,comma,numbers]{natbib} \usepackage{cmndref} ! \usepackage[dvipdfmx, dvipdfm, bookmarks=true, Index: idct.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/idct.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** idct.tex 22 Dec 2016 10:52:58 -0000 1.7 --- idct.tex 2 Feb 2017 07:19:15 -0000 1.8 *************** *** 56,60 **** \begin{center} \leavevmode ! \includegraphics{fig/idct.eps} \end{center} The Inverse Discrete Cosine Transformation II is given by --- 56,60 ---- \begin{center} \leavevmode ! \includegraphics{fig/idct.pdf} \end{center} The Inverse Discrete Cosine Transformation II is given by Index: merge.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/merge.tex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** merge.tex 22 Dec 2016 10:52:58 -0000 1.24 --- merge.tex 2 Feb 2017 07:19:15 -0000 1.25 *************** *** 56,60 **** sending the result to standard output, as described below. ! \hspace{1cm}\includegraphics{fig/merge.eps} \end{qsection} --- 56,60 ---- sending the result to standard output, as described below. ! \hspace{1cm}\includegraphics{fig/merge.pdf} \end{qsection} Index: dtw.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/dtw.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dtw.tex 22 Dec 2016 10:52:58 -0000 1.11 --- dtw.tex 2 Feb 2017 07:19:15 -0000 1.12 *************** *** 147,161 **** \begin{center} \begin{tabular}{cccc} \\[-1ex] ! &\includegraphics[height=2cm]{fig/path1.eps} ! &\includegraphics[height=2cm]{fig/path2.eps} ! &\includegraphics[height=2cm]{fig/path3.eps}\\ &$P=1$&$P=2$&$P=3$\\ &&&\\ ! &\includegraphics[height=3cm]{fig/path4.eps} ! &\includegraphics[height=3cm]{fig/path5.eps} ! &\includegraphics[height=3cm]{fig/path6.eps}\\ &$P=4$&$P=5$&$P=6$\\ &&&\\ ! &\includegraphics[height=3cm]{fig/path7.eps} &&\\ &$P=7$&&\\ --- 147,161 ---- \begin{center} \begin{tabular}{cccc} \\[-1ex] ! &\includegraphics[height=2cm]{fig/path1.pdf} ! &\includegraphics[height=2cm]{fig/path2.pdf} ! &\includegraphics[height=2cm]{fig/path3.pdf}\\ &$P=1$&$P=2$&$P=3$\\ &&&\\ ! &\includegraphics[height=3cm]{fig/path4.pdf} ! &\includegraphics[height=3cm]{fig/path5.pdf} ! &\includegraphics[height=3cm]{fig/path6.pdf}\\ &$P=4$&$P=5$&$P=6$\\ &&&\\ ! &\includegraphics[height=3cm]{fig/path7.pdf} &&\\ &$P=7$&&\\ Index: lbg.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/lbg.tex,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** lbg.tex 22 Dec 2016 10:52:58 -0000 1.27 --- lbg.tex 2 Feb 2017 07:19:15 -0000 1.28 *************** *** 112,116 **** \begin{center} \fbox{ ! \includegraphics[width=5cm]{./fig/lbg_step0.eps} } \end{center} --- 112,116 ---- \begin{center} \fbox{ ! \includegraphics[width=5cm]{./fig/lbg_step0.pdf} } \end{center} *************** *** 121,125 **** \begin{center} \fbox{ ! \includegraphics[width=5cm]{./fig/lbg_step1.eps} } \end{center} --- 121,125 ---- \begin{center} \fbox{ ! \includegraphics[width=5cm]{./fig/lbg_step1.pdf} } \end{center} *************** *** 135,139 **** \begin{center} \fbox{ ! \includegraphics[width=5cm]{./fig/lbg_step2.eps} } \end{center} --- 135,139 ---- \begin{center} \fbox{ ! \includegraphics[width=5cm]{./fig/lbg_step2.pdf} } \end{center} Index: grlogsp.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/grlogsp.tex,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** grlogsp.tex 22 Dec 2016 10:52:58 -0000 1.26 --- grlogsp.tex 2 Feb 2017 07:19:15 -0000 1.27 *************** *** 84,88 **** \end{minipage} \begin{minipage}{4cm} ! \includegraphics{fig/grlogsp-on.eps} \end{minipage}\\\hspace*{\fill}\\ $(YO + 100 , X)$ [mm] if -t is specified.}{1} --- 84,88 ---- \end{minipage} \begin{minipage}{4cm} ! \includegraphics{fig/grlogsp-on.pdf} \end{minipage}\\\hspace*{\fill}\\ $(YO + 100 , X)$ [mm] if -t is specified.}{1} Index: glogsp.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/glogsp.tex,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** glogsp.tex 22 Dec 2016 10:52:58 -0000 1.23 --- glogsp.tex 2 Feb 2017 07:19:15 -0000 1.24 *************** *** 77,81 **** \begin{minipage}{4.5cm} \leavevmode ! \includegraphics{fig/glogsp-on.eps} \end{minipage}\\\hspace*{\fill}}{1} \argm{x}{X}{ $x$ scale\\ --- 77,81 ---- \begin{minipage}{4.5cm} \leavevmode ! \includegraphics{fig/glogsp-on.pdf} \end{minipage}\\\hspace*{\fill}}{1} \argm{x}{X}{ $x$ scale\\ *************** *** 121,125 **** \begin{center} \leavevmode ! \includegraphics{fig/glogsp-sample.eps} \end{center} \end{qsection} --- 121,125 ---- \begin{center} \leavevmode ! \includegraphics{fig/glogsp-sample.pdf} \end{center} \end{qsection} Index: gseries.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/gseries.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** gseries.tex 22 Dec 2016 10:52:58 -0000 1.7 --- gseries.tex 2 Feb 2017 07:19:15 -0000 1.8 *************** *** 104,113 **** In the following example, {\em gseries} reads impulse response in float format from {\em data.f} and writes the output ! in encapsulated Postscript format to {\em data.eps}. \begin{quote} \verb!gseries +f < data.f | psgr > data.eps! \end{quote} The following example replaces the magic number 0 in {\em data.f} by 1.0 and ! writes the output to {\em data.eps}. \begin{quote} \verb!gseriese +f -magic 0 -MAGIC 1.0 < data.f | \!\\ --- 104,113 ---- In the following example, {\em gseries} reads impulse response in float format from {\em data.f} and writes the output ! in encapsulated Postscript format to {\em data.pdf}. \begin{quote} \verb!gseries +f < data.f | psgr > data.eps! \end{quote} The following example replaces the magic number 0 in {\em data.f} by 1.0 and ! writes the output to {\em data.pdf}. \begin{quote} \verb!gseriese +f -magic 0 -MAGIC 1.0 < data.f | \!\\ Index: gmm.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/gmm.tex,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** gmm.tex 22 Dec 2016 10:52:58 -0000 1.23 --- gmm.tex 2 Feb 2017 07:19:15 -0000 1.24 *************** *** 261,270 **** \begin{minipage}[b]{0.45\hsize} \begin{center} ! \includegraphics[width=0.8\hsize]{fig/GMM_1.eps} \\ (a) diagonal \\(without -c1 and -c2 option) \end{center} \vspace{3mm} \begin{center} ! \includegraphics[width=0.8\hsize]{fig/GMM_3.eps} \\ (c) block-wise full covariance \\(with -c2 option) \end{center} --- 261,270 ---- \begin{minipage}[b]{0.45\hsize} \begin{center} ! \includegraphics[width=0.8\hsize]{fig/GMM_1.pdf} \\ (a) diagonal \\(without -c1 and -c2 option) \end{center} \vspace{3mm} \begin{center} ! \includegraphics[width=0.8\hsize]{fig/GMM_3.pdf} \\ (c) block-wise full covariance \\(with -c2 option) \end{center} *************** *** 272,281 **** \begin{minipage}[b]{0.45\hsize} \begin{center} ! \includegraphics[width=0.8\hsize]{fig/GMM_2.eps} \\ (b) inter-block correlation \\(with -c1 option) \end{center} \vspace{3mm} \begin{center} ! \includegraphics[width=0.8\hsize]{fig/GMM_4.eps} \\ (d) full covariance \\(with both -c1 and -c2 option) \end{center} --- 272,281 ---- \begin{minipage}[b]{0.45\hsize} \begin{center} ! \includegraphics[width=0.8\hsize]{fig/GMM_2.pdf} \\ (b) inter-block correlation \\(with -c1 option) \end{center} \vspace{3mm} \begin{center} ! \includegraphics[width=0.8\hsize]{fig/GMM_4.pdf} \\ (d) full covariance \\(with both -c1 and -c2 option) \end{center} |
Update of /cvsroot/sp-tk/SPTK/doc/ref_e/fig In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv28215 Added Files: FIRflt.pdf GMM_1.pdf GMM_2.pdf GMM_3.pdf GMM_4.pdf bcp.pdf box.pdf circle.pdf clip.pdf dct.pdf df2.pdf fft2-comp.pdf fft2-quad.pdf fft2-trans.pdf fft2.pdf fftr2.pdf fig-print1.pdf fig-print2.pdf g0.pdf g1.pdf g2.pdf glogsp-on.pdf glogsp-sample.pdf grid.pdf grlogsp-on.pdf idct.pdf ifft.pdf ifft2.pdf join-type.pdf lbg_step0.pdf lbg_step1.pdf lbg_step2.pdf mark.pdf merge.pdf paint.pdf path1.pdf path2.pdf path3.pdf path4.pdf path5.pdf path6.pdf path7.pdf pen-line.pdf scale.pdf sptk_sigproc.pdf transflt.pdf Log Message: change eps file to pdf file --- NEW FILE: box.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: fft2-quad.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: fig-print1.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: GMM_1.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: join-type.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: path4.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: transflt.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: GMM_3.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: fft2-comp.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: clip.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: bcp.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: lbg_step1.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: fig-print2.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: merge.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: scale.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: fft2.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: df2.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: dct.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: g0.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: path6.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: glogsp-on.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: lbg_step0.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: path7.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: g1.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: g2.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: mark.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: path2.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ifft2.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: GMM_2.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: GMM_4.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: idct.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: fftr2.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: grid.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: path5.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: lbg_step2.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: sptk_sigproc.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: paint.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: grlogsp-on.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: glogsp-sample.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: fft2-trans.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: FIRflt.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: circle.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: path1.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ifft.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: pen-line.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: path3.pdf --- (This appears to be a binary file; contents omitted.) |
From: fujishita t. <fjs...@us...> - 2017-02-02 05:25:53
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv23267 Modified Files: fft.cc fftr.cc ifft.cc levdur.cc lpc.cc lpc2par.cc mgc2sp.cc Log Message: fix code format Index: lpc2par.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/lpc2par.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** lpc2par.cc 13 Jan 2017 03:19:10 -0000 1.1 --- lpc2par.cc 2 Feb 2017 05:25:50 -0000 1.2 *************** *** 63,66 **** --- 63,67 ---- const int kDefaultNumOrder(25); const double kDefaultGamma(1.0); + const int kDefaultBehaviorForUnstableCoefficient(kIgnore); void PrintUsage(std::ostream* stream) { *************** *** 75,79 **** *stream << " -g g : gamma of generalized cepstrum [" << kDefaultGamma << "]" << std::endl; // NOLINT *stream << " -c c : gamma of generalized cepstrum = -1 / (int) c" << std::endl; // NOLINT ! *stream << " -e e : check whether the derived PARCOR [0]" << std::endl; // NOLINT *stream << " coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; --- 76,80 ---- *stream << " -g g : gamma of generalized cepstrum [" << kDefaultGamma << "]" << std::endl; // NOLINT *stream << " -c c : gamma of generalized cepstrum = -1 / (int) c" << std::endl; // NOLINT ! *stream << " -e e : check whether the derived PARCOR [" << kDefaultBehaviorForUnstableCoefficient << "]" << std::endl; // NOLINT *stream << " coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; *************** *** 101,105 **** int num_order(kDefaultNumOrder); double gamma(kDefaultGamma); ! BehaviorForUnstableCoefficients behavior(kIgnore); for (;;) { --- 102,108 ---- int num_order(kDefaultNumOrder); double gamma(kDefaultGamma); ! BehaviorForUnstableCoefficients behavior( ! static_cast<BehaviorForUnstableCoefficients>( ! kDefaultBehaviorForUnstableCoefficient)); for (;;) { *************** *** 141,162 **** } case 'e': { - int tmp; - if (!sptk::ConvertStringToInteger(optarg, &tmp)) { - std::ostringstream error_message; - error_message << "The argument for the -e option must be an integer"; - sptk::PrintErrorMessage("lpc2par", error_message); - return 1; - } - const int min(0); const int max(static_cast<int>(kNumKindsOfBehavior) - 1); ! if (!sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -e option must be in range" ! << " (" << min << " .. " << max << ")"; sptk::PrintErrorMessage("lpc2par", error_message); return 1; } - behavior = static_cast<BehaviorForUnstableCoefficients>(tmp); break; --- 144,158 ---- } case 'e': { const int min(0); const int max(static_cast<int>(kNumKindsOfBehavior) - 1); ! int tmp; ! if (!sptk::ConvertStringToInteger(optarg, &tmp) || ! !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -e option must be an integer " ! << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("lpc2par", error_message); return 1; } behavior = static_cast<BehaviorForUnstableCoefficients>(tmp); break; Index: fft.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/fft.cc,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** fft.cc 22 Dec 2016 16:09:07 -0000 1.10 --- fft.cc 2 Feb 2017 05:25:50 -0000 1.11 *************** *** 65,68 **** --- 65,69 ---- const int kDefaultFftSize(256); + const int kDefaultOutputFormat(kOutputRealAndImaginaryParts); void PrintUsage(std::ostream* stream) { *************** *** 76,80 **** *stream << " -l l : FFT size [" << kDefaultFftSize << "]" << std::endl; // NOLINT *stream << " -m m : order of sequence [l-1]" << std::endl; ! *stream << " -o o : output format [0]" << std::endl; *stream << " 0 (real and imaginary parts)" << std::endl; *stream << " 1 (real part)" << std::endl; --- 77,81 ---- *stream << " -l l : FFT size [" << kDefaultFftSize << "]" << std::endl; // NOLINT *stream << " -m m : order of sequence [l-1]" << std::endl; ! *stream << " -o o : output format [" << kDefaultOutputFormat << "]" << std::endl; // NOLINT *stream << " 0 (real and imaginary parts)" << std::endl; *stream << " 1 (real part)" << std::endl; *************** *** 99,103 **** int num_order(kDefaultFftSize - 1); bool is_num_order_specified(false); ! OutputFormats output_format(kOutputRealAndImaginaryParts); for (;;) { --- 100,104 ---- int num_order(kDefaultFftSize - 1); bool is_num_order_specified(false); ! OutputFormats output_format(static_cast<OutputFormats>(kDefaultOutputFormat)); for (;;) { *************** *** 128,150 **** } case 'o': { - int given_integer(-1); - if (!sptk::ConvertStringToInteger(optarg, &given_integer)) { - std::ostringstream error_message; - error_message << "The argument for the -o option must be an integer"; - sptk::PrintErrorMessage("fft", error_message); - return 1; - } - const int min(0); const int max(static_cast<int>(kNumOutputFormats) - 1); ! if (!sptk::IsInRange(given_integer, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -o option must be in range" ! << " (" << min << " .. " << max << ")"; sptk::PrintErrorMessage("fft", error_message); return 1; } ! ! output_format = static_cast<OutputFormats>(given_integer); break; } --- 129,144 ---- } case 'o': { const int min(0); const int max(static_cast<int>(kNumOutputFormats) - 1); ! int tmp; ! if (!sptk::ConvertStringToInteger(optarg, &tmp) || ! !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -o option must be an integer " ! << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("fft", error_message); return 1; } ! output_format = static_cast<OutputFormats>(tmp); break; } Index: lpc.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/lpc.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** lpc.cc 14 Jan 2017 08:05:53 -0000 1.6 --- lpc.cc 2 Feb 2017 05:25:50 -0000 1.7 *************** *** 65,68 **** --- 65,69 ---- const int kDefaultNumOrder(25); const double kDefaultEpsilon(1.0e-6); + const int kDefaultBehaviorForUnstableCoefficient(kIgnore); void PrintUsage(std::ostream* stream) { *************** *** 78,82 **** *stream << " -f f : minimum value of the determinant of [" << kDefaultEpsilon << "]" << std::endl; // NOLINT *stream << " the normal matrix" << std::endl; ! *stream << " -e e : check whether the derived linear [0]" << std::endl; // NOLINT *stream << " predictive coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; --- 79,83 ---- *stream << " -f f : minimum value of the determinant of [" << kDefaultEpsilon << "]" << std::endl; // NOLINT *stream << " the normal matrix" << std::endl; ! *stream << " -e e : check whether the derived linear [" << kDefaultBehaviorForUnstableCoefficient << "]" << std::endl; // NOLINT *stream << " predictive coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; *************** *** 103,107 **** int num_order(kDefaultNumOrder); double epsilon(kDefaultEpsilon); ! BehaviorForUnstableCoefficients behavior(kIgnore); for (;;) { --- 104,110 ---- int num_order(kDefaultNumOrder); double epsilon(kDefaultEpsilon); ! BehaviorForUnstableCoefficients behavior( ! static_cast<BehaviorForUnstableCoefficients>( ! kDefaultBehaviorForUnstableCoefficient)); for (;;) { *************** *** 143,165 **** } case 'e': { - int given_integer(-1); - if (!sptk::ConvertStringToInteger(optarg, &given_integer)) { - std::ostringstream error_message; - error_message << "The argument for the -e option must be an integer"; - sptk::PrintErrorMessage("lpc", error_message); - return 1; - } - const int min(0); const int max(static_cast<int>(kNumKindsOfBehavior) - 1); ! if (!sptk::IsInRange(given_integer, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -e option must be in range" ! << " (" << min << " .. " << max << ")"; sptk::PrintErrorMessage("lpc", error_message); return 1; } ! ! behavior = static_cast<BehaviorForUnstableCoefficients>(given_integer); break; } --- 146,161 ---- } case 'e': { const int min(0); const int max(static_cast<int>(kNumKindsOfBehavior) - 1); ! int tmp; ! if (!sptk::ConvertStringToInteger(optarg, &tmp) || ! !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -e option must be an integer " ! << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("lpc", error_message); return 1; } ! behavior = static_cast<BehaviorForUnstableCoefficients>(tmp); break; } Index: ifft.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/ifft.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ifft.cc 22 Dec 2016 16:09:07 -0000 1.6 --- ifft.cc 2 Feb 2017 05:25:50 -0000 1.7 *************** *** 62,65 **** --- 62,66 ---- const int kDefaultFftSize(256); + const int kDefaultOutputFormat(kOutputRealAndImaginaryParts); void PrintUsage(std::ostream* stream) { *************** *** 72,76 **** *stream << " options:" << std::endl; *stream << " -l l : FFT size [" << kDefaultFftSize << "]" << std::endl; // NOLINT ! *stream << " -o o : output format [0]" << std::endl; *stream << " 0 (real and imaginary parts)" << std::endl; *stream << " 1 (real part)" << std::endl; --- 73,77 ---- *stream << " options:" << std::endl; *stream << " -l l : FFT size [" << kDefaultFftSize << "]" << std::endl; // NOLINT ! *stream << " -o o : output format [" << kDefaultOutputFormat << "]" << std::endl; // NOLINT *stream << " 0 (real and imaginary parts)" << std::endl; *stream << " 1 (real part)" << std::endl; *************** *** 91,95 **** int main(int argc, char* argv[]) { int fft_size(kDefaultFftSize); ! OutputFormats output_format(kOutputRealAndImaginaryParts); for (;;) { --- 92,96 ---- int main(int argc, char* argv[]) { int fft_size(kDefaultFftSize); ! OutputFormats output_format(static_cast<OutputFormats>(kDefaultOutputFormat)); for (;;) { *************** *** 108,130 **** } case 'o': { - int given_integer(-1); - if (!sptk::ConvertStringToInteger(optarg, &given_integer)) { - std::ostringstream error_message; - error_message << "The argument for the -o option must be an integer"; - sptk::PrintErrorMessage("ifft", error_message); - return 1; - } - const int min(0); const int max(static_cast<int>(kNumOutputFormats) - 1); ! if (!sptk::IsInRange(given_integer, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -o option must be in range" ! << " (" << min << " .. " << max << ")"; sptk::PrintErrorMessage("ifft", error_message); return 1; } ! ! output_format = static_cast<OutputFormats>(given_integer); break; } --- 109,124 ---- } case 'o': { const int min(0); const int max(static_cast<int>(kNumOutputFormats) - 1); ! int tmp; ! if (!sptk::ConvertStringToInteger(optarg, &tmp) || ! !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -o option must be an integer " ! << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("ifft", error_message); return 1; } ! output_format = static_cast<OutputFormats>(tmp); break; } Index: levdur.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/levdur.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** levdur.cc 13 Jan 2017 03:21:09 -0000 1.7 --- levdur.cc 2 Feb 2017 05:25:50 -0000 1.8 *************** *** 63,66 **** --- 63,67 ---- const int kDefaultNumOrder(25); const double kDefaultEpsilon(1.0e-6); + const int kDefaultBehaviorForUnstableCoefficient(kIgnore); void PrintUsage(std::ostream* stream) { *************** *** 76,80 **** *stream << " -f f : minimum value of the determinant of [" << kDefaultEpsilon << "]" << std::endl; // NOLINT *stream << " the normal matrix" << std::endl; ! *stream << " -e e : check whether the derived linear [0]" << std::endl; // NOLINT *stream << " predictive coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; --- 77,81 ---- *stream << " -f f : minimum value of the determinant of [" << kDefaultEpsilon << "]" << std::endl; // NOLINT *stream << " the normal matrix" << std::endl; ! *stream << " -e e : check whether the derived linear [" << kDefaultBehaviorForUnstableCoefficient << "]" << std::endl; // NOLINT *stream << " predictive coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; *************** *** 100,104 **** int num_order(kDefaultNumOrder); double epsilon(kDefaultEpsilon); ! BehaviorForUnstableCoefficients behavior(kIgnore); for (;;) { --- 101,107 ---- int num_order(kDefaultNumOrder); double epsilon(kDefaultEpsilon); ! BehaviorForUnstableCoefficients behavior( ! static_cast<BehaviorForUnstableCoefficients>( ! kDefaultBehaviorForUnstableCoefficient)); for (;;) { *************** *** 129,151 **** } case 'e': { - int given_integer(-1); - if (!sptk::ConvertStringToInteger(optarg, &given_integer)) { - std::ostringstream error_message; - error_message << "The argument for the -e option must be an integer"; - sptk::PrintErrorMessage("levdur", error_message); - return 1; - } - const int min(0); const int max(static_cast<int>(kNumKindsOfBehavior) - 1); ! if (!sptk::IsInRange(given_integer, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -e option must be in range" ! << " (" << min << " .. " << max << ")"; sptk::PrintErrorMessage("levdur", error_message); return 1; } ! ! behavior = static_cast<BehaviorForUnstableCoefficients>(given_integer); break; } --- 132,147 ---- } case 'e': { const int min(0); const int max(static_cast<int>(kNumKindsOfBehavior) - 1); ! int tmp; ! if (!sptk::ConvertStringToInteger(optarg, &tmp) || ! !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -e option must be an integer " ! << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("levdur", error_message); return 1; } ! behavior = static_cast<BehaviorForUnstableCoefficients>(tmp); break; } Index: fftr.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/fftr.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** fftr.cc 13 Jan 2017 06:49:33 -0000 1.1 --- fftr.cc 2 Feb 2017 05:25:50 -0000 1.2 *************** *** 65,68 **** --- 65,69 ---- const int kDefaultFftSize(256); + const int kDefaultOutputFormat(kOutputRealAndImaginaryParts); const bool kDefaultHalfSizeOutputFlag(false); *************** *** 77,81 **** *stream << " -l l : FFT size [" << kDefaultFftSize << "]" << std::endl; // NOLINT *stream << " -m m : order of sequence [l-1]" << std::endl; ! *stream << " -o o : output format [0]" << std::endl; *stream << " 0 (real and imaginary parts)" << std::endl; *stream << " 1 (real part)" << std::endl; --- 78,82 ---- *stream << " -l l : FFT size [" << kDefaultFftSize << "]" << std::endl; // NOLINT *stream << " -m m : order of sequence [l-1]" << std::endl; ! *stream << " -o o : output format [" << kDefaultOutputFormat << "]" << std::endl; // NOLINT *stream << " 0 (real and imaginary parts)" << std::endl; *stream << " 1 (real part)" << std::endl; *************** *** 101,106 **** int num_order(kDefaultFftSize - 1); bool is_num_order_specified(false); bool half_size_output_flag(kDefaultHalfSizeOutputFlag); - OutputFormats output_format(kOutputRealAndImaginaryParts); for (;;) { --- 102,107 ---- int num_order(kDefaultFftSize - 1); bool is_num_order_specified(false); + OutputFormats output_format(static_cast<OutputFormats>(kDefaultOutputFormat)); bool half_size_output_flag(kDefaultHalfSizeOutputFlag); for (;;) { *************** *** 131,153 **** } case 'o': { - int given_integer(-1); - if (!sptk::ConvertStringToInteger(optarg, &given_integer)) { - std::ostringstream error_message; - error_message << "The argument for the -o option must be an integer"; - sptk::PrintErrorMessage("fftr", error_message); - return 1; - } - const int min(0); const int max(static_cast<int>(kNumOutputFormats) - 1); ! if (!sptk::IsInRange(given_integer, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -o option must be in range" ! << " (" << min << " .. " << max << ")"; sptk::PrintErrorMessage("fftr", error_message); return 1; } ! ! output_format = static_cast<OutputFormats>(given_integer); break; } --- 132,147 ---- } case 'o': { const int min(0); const int max(static_cast<int>(kNumOutputFormats) - 1); ! int tmp; ! if (!sptk::ConvertStringToInteger(optarg, &tmp) || ! !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -o option must be an integer " ! << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("fftr", error_message); return 1; } ! output_format = static_cast<OutputFormats>(tmp); break; } Index: mgc2sp.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mgc2sp.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mgc2sp.cc 26 Dec 2016 07:41:20 -0000 1.1 --- mgc2sp.cc 2 Feb 2017 05:25:50 -0000 1.2 *************** *** 74,77 **** --- 74,78 ---- const bool kDefaultMultiplicationFlag(false); const int kDefaultFftSize(256); + const int kDefaultOutputFormat(kLogAmplitudeSpectrumInDecibels); void PrintUsage(std::ostream* stream) { *************** *** 91,95 **** *stream << " -u : regard input as multiplied by gamma [" << sptk::ConvertBooleanToString(kDefaultMultiplicationFlag) << "]" << std::endl; // NOLINT *stream << " -l l : FFT size [" << kDefaultFftSize << "]" << std::endl; // NOLINT ! *stream << " -o o : output format [0]" << std::endl; // NOLINT *stream << " 0 (20*log|H(z)|)" << std::endl; *stream << " 1 (ln|H(z)|)" << std::endl; --- 92,96 ---- *stream << " -u : regard input as multiplied by gamma [" << sptk::ConvertBooleanToString(kDefaultMultiplicationFlag) << "]" << std::endl; // NOLINT *stream << " -l l : FFT size [" << kDefaultFftSize << "]" << std::endl; // NOLINT ! *stream << " -o o : output format [" << kDefaultOutputFormat << "]" << std::endl; // NOLINT *stream << " 0 (20*log|H(z)|)" << std::endl; *stream << " 1 (ln|H(z)|)" << std::endl; *************** *** 122,126 **** bool multiplication_flag(kDefaultMultiplicationFlag); int fft_size(kDefaultFftSize); ! OutputFormats output_format(kLogAmplitudeSpectrumInDecibels); for (;;) { --- 123,127 ---- bool multiplication_flag(kDefaultMultiplicationFlag); int fft_size(kDefaultFftSize); ! OutputFormats output_format(static_cast<OutputFormats>(kDefaultOutputFormat)); for (;;) { *************** *** 188,205 **** } case 'o': { - int tmp; - if (!sptk::ConvertStringToInteger(optarg, &tmp)) { - std::ostringstream error_message; - error_message << "The argument for the -o option must be an integer"; - sptk::PrintErrorMessage("mgc2sp", error_message); - return 1; - } - const int min(0); const int max(static_cast<int>(kNumOutputFormats) - 1); ! if (!sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -o option must be in range" ! << " (" << min << " .. " << max << ")"; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; --- 189,200 ---- } case 'o': { const int min(0); const int max(static_cast<int>(kNumOutputFormats) - 1); ! int tmp; ! if (!sptk::ConvertStringToInteger(optarg, &tmp) || ! !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -o option must be an integer " ! << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; |
From: Takenori Y. <tak...@us...> - 2017-01-30 14:07:07
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv7450 Modified Files: gnorm.cc ignorm.cc Log Message: fix usage Index: gnorm.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/gnorm.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gnorm.cc 16 Dec 2016 09:36:55 -0000 1.2 --- gnorm.cc 30 Jan 2017 14:07:05 -0000 1.3 *************** *** 65,70 **** *stream << " gnorm [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of generalized cepstrum [" << kDefaultNumOrder << "]" << std::endl; // NOLINT ! *stream << " -g g : gamma [" << kDefaultGamma << "]" << std::endl; // NOLINT *stream << " -c c : gamma = -1 / (int) c" << std::endl; *stream << " -h : print this message" << std::endl; --- 65,70 ---- *stream << " gnorm [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of generalized cepstrum [" << kDefaultNumOrder << "]" << std::endl; // NOLINT ! *stream << " -g g : gamma [" << kDefaultGamma << "]" << std::endl; // NOLINT *stream << " -c c : gamma = -1 / (int) c" << std::endl; *stream << " -h : print this message" << std::endl; *************** *** 74,78 **** *stream << " normalized generalized cepstrum (double)" << std::endl; *stream << " notice:" << std::endl; ! *stream << " value of c must be c >= 1 (double)" << std::endl; *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; --- 74,78 ---- *stream << " normalized generalized cepstrum (double)" << std::endl; *stream << " notice:" << std::endl; ! *stream << " value of c must be c >= 1" << std::endl; *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; Index: ignorm.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/ignorm.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ignorm.cc 16 Dec 2016 09:36:55 -0000 1.2 --- ignorm.cc 30 Jan 2017 14:07:05 -0000 1.3 *************** *** 65,70 **** *stream << " ignorm [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of generalized cepstrum [" << kDefaultNumOrder << "]" << std::endl; // NOLINT ! *stream << " -g g : gamma [" << kDefaultGamma << "]" << std::endl; // NOLINT *stream << " -c c : gamma = -1 / (int) c" << std::endl; *stream << " -h : print this message" << std::endl; --- 65,70 ---- *stream << " ignorm [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of generalized cepstrum [" << kDefaultNumOrder << "]" << std::endl; // NOLINT ! *stream << " -g g : gamma [" << kDefaultGamma << "]" << std::endl; // NOLINT *stream << " -c c : gamma = -1 / (int) c" << std::endl; *stream << " -h : print this message" << std::endl; *************** *** 74,78 **** *stream << " generalized cepstrum (double)" << std::endl; *stream << " notice:" << std::endl; ! *stream << " value of c must be c >= 1 (double)" << std::endl; *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; --- 74,78 ---- *stream << " generalized cepstrum (double)" << std::endl; *stream << " notice:" << std::endl; ! *stream << " value of c must be c >= 1" << std::endl; *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; |
From: fujishita t. <fjs...@us...> - 2017-01-30 07:13:56
|
Update of /cvsroot/sp-tk/SPTK/doc/ref_e In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv19924 Modified Files: fdrw.tex Log Message: modify buffer size Index: fdrw.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/fdrw.tex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** fdrw.tex 22 Dec 2016 10:52:58 -0000 1.24 --- fdrw.tex 30 Jan 2017 07:13:54 -0000 1.25 *************** *** 87,94 **** for the assigned width. When the {\bf --n} option is omitted and the number of ! input samples is below 5000, then the block size is made equal to the number of samples. ! When the number of samples is above 5000, ! then the block size is made equal to 5000.} \desc{When the {\bf --y} option is omitted, the input data minimum value is set to $ymin$ --- 87,94 ---- for the assigned width. When the {\bf --n} option is omitted and the number of ! input samples is below 1000000, then the block size is made equal to the number of samples. ! When the number of samples is above 1000000, ! then the block size is made equal to 1000000.} \desc{When the {\bf --y} option is omitted, the input data minimum value is set to $ymin$ |
From: fujishita t. <fjs...@us...> - 2017-01-30 07:13:04
|
Update of /cvsroot/sp-tk/SPTK/src/bin/fig+fdrw In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv19881 Modified Files: fdrw.c Log Message: modify buffer size Index: fdrw.c =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/fig+fdrw/fdrw.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** fdrw.c 22 Dec 2016 10:53:03 -0000 1.32 --- fdrw.c 30 Jan 2017 07:13:02 -0000 1.33 *************** *** 119,123 **** #define YMIN -1.0 #define YMAX 1.0 ! #define BUF_LNG 5000 #define H 2.5 #define SC 1.5 --- 119,123 ---- #define YMIN -1.0 #define YMAX 1.0 ! #define BUF_LNG 1000000 #define H 2.5 #define SC 1.5 |
From: Takenori Y. <tak...@us...> - 2017-01-26 10:33:57
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv24100 Modified Files: Makefile sptk_utils.cc sptk_utils.h Added Files: linear_predictive_coefficients_to_line_spectral_pairs.cc linear_predictive_coefficients_to_line_spectral_pairs.h lpc2lsp.cc Log Message: add lpc2lsp command Index: sptk_utils.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/sptk_utils.cc,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** sptk_utils.cc 24 Jan 2017 12:29:58 -0000 1.12 --- sptk_utils.cc 26 Jan 2017 10:33:54 -0000 1.13 *************** *** 121,134 **** bool WriteStream(int write_size, const std::vector<double>& sequence_to_write, std::ostream* output_stream) { ! if (write_size <= 0 || NULL == output_stream) { return false; } ! if (sequence_to_write.size() < static_cast<std::size_t>(write_size)) { return false; } ! output_stream->write(reinterpret_cast<const char*>(&(sequence_to_write[0])), ! sizeof(sequence_to_write[0]) * write_size); return !output_stream->fail(); --- 121,141 ---- bool WriteStream(int write_size, const std::vector<double>& sequence_to_write, std::ostream* output_stream) { ! return WriteStream(0, write_size, sequence_to_write, output_stream); ! } ! ! bool WriteStream(int begin, int end, ! const std::vector<double>& sequence_to_write, ! std::ostream* output_stream) { ! if (begin < 0 || end <= begin || NULL == output_stream) { return false; } ! if (sequence_to_write.size() < static_cast<std::size_t>(end)) { return false; } ! output_stream->write( ! reinterpret_cast<const char*>(&(sequence_to_write[0]) + begin), ! sizeof(sequence_to_write[0]) * (end - begin)); return !output_stream->fail(); --- NEW FILE: linear_predictive_coefficients_to_line_spectral_pairs.cc --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // // All rights reserved. // // // // Redistribution and use in source and binary forms, with or // // without modification, are permitted provided that the following // // conditions are met: // // // // - Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above // // copyright notice, this list of conditions and the following // // disclaimer in the documentation and/or other materials provided // // with the distribution. // // - Neither the name of the SPTK working group nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND // // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS // // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // ----------------------------------------------------------------- // #include "linear_predictive_coefficients_to_line_spectral_pairs.h" #include <cmath> // std::acos, std::ceil, std::fabs #include <cstddef> // std::size_t namespace sptk { LinearPredictiveCoefficientsToLineSpectralPairs:: LinearPredictiveCoefficientsToLineSpectralPairs(int num_order, int num_split, int num_iteration, double epsilon) : num_order_(num_order), num_symmetric_polynomial_order_(std::ceil((num_order + 1) / 2)), num_asymmetric_polynomial_order_(num_order / 2), num_split_(num_split), num_iteration_(num_iteration), epsilon_(epsilon), is_valid_(true) { if (num_order < 0 || num_split < 1 || num_iteration < 1 || epsilon < 0.0) { is_valid_ = false; } } bool LinearPredictiveCoefficientsToLineSpectralPairs::Run( const std::vector<double>& linear_predictive_coefficients, std::vector<double>* line_spectral_pairs, LinearPredictiveCoefficientsToLineSpectralPairs::Buffer* buffer) const { // check inputs if (!is_valid_ || linear_predictive_coefficients.size() != static_cast<std::size_t>(num_order_ + 1) || NULL == line_spectral_pairs || NULL == buffer) { return false; } // prepare memory if (line_spectral_pairs->size() < static_cast<std::size_t>(num_order_ + 1)) { line_spectral_pairs->resize(num_order_ + 1); } (*line_spectral_pairs)[0] = linear_predictive_coefficients[0]; if (0 == num_order_) return true; // prepare buffer if (buffer->c1_.size() < static_cast<std::size_t>(num_symmetric_polynomial_order_ + 1)) { buffer->c1_.resize(num_symmetric_polynomial_order_ + 1); } if (buffer->c2_.size() < static_cast<std::size_t>(num_asymmetric_polynomial_order_ + 1)) { buffer->c2_.resize(num_asymmetric_polynomial_order_ + 1); } // calculate symmetric and antisymmetric polynomials const double* p1(&(linear_predictive_coefficients[0]) + 1); const double* p2(&(linear_predictive_coefficients[0]) + num_order_); double* c1(&buffer->c1_[0]); double* c2(&buffer->c2_[0]); c1[num_symmetric_polynomial_order_] = 1.0; c2[num_asymmetric_polynomial_order_] = 1.0; if (num_order_ % 2 == 0) { for (int i(num_symmetric_polynomial_order_ - 1); 0 <= i; --i, ++p1, --p2) { c1[i] = *p1 + *p2 - c1[i + 1]; c2[i] = *p1 - *p2 + c2[i + 1]; } } else { for (int i(num_asymmetric_polynomial_order_ - 1); 0 <= i; --i, ++p1, --p2) { c1[i + 1] = *p1 + *p2; c2[i] = (i == num_asymmetric_polynomial_order_ - 1) ? *p1 - *p2 : *p1 - *p2 + c2[i + 2]; } c1[0] = *p1 + *p2; } c1[0] *= 0.5; c2[0] *= 0.5; // set initial condition int order(0); std::vector<double>* c(&buffer->c1_); double x_prev(1.0); double y_prev; if (!CalculateChebyshevPolynomial(*c, x_prev, &y_prev)) return false; // search roots of polynomials const double delta(1.0 / num_split_); const double x_max(1.0 - delta); const double x_min(-1.0 - delta); for (double x(x_max); x_min < x; x -= delta) { double y; if (!CalculateChebyshevPolynomial(*c, x, &y)) return false; if (y * y_prev <= 0.0) { double x_lower(x); double x_upper(x_prev); double y_lower(y); double y_upper(y_prev); for (int i(0); i < num_iteration_; ++i) { double x_mid((x_lower + x_upper) * 0.5); double y_mid; if (!CalculateChebyshevPolynomial(*c, x_mid, &y_mid)) return false; if (y_mid * y_upper <= 0.0) { x_lower = x_mid; y_lower = y_mid; } else { x_upper = x_mid; y_upper = y_mid; } if (std::fabs(y_mid) <= epsilon_) break; } const double x_interpolated((y_lower * x_upper - y_upper * x_lower) / (y_lower - y_upper)); (*line_spectral_pairs)[++order] = std::acos(x_interpolated) / sptk::kTwoPi; if (num_order_ == order) return true; // update variables c = (c == &buffer->c1_) ? &buffer->c2_ : &buffer->c1_; x = x_interpolated; if (!CalculateChebyshevPolynomial(*c, x, &y)) return false; } x_prev = x; y_prev = y; } return false; } bool LinearPredictiveCoefficientsToLineSpectralPairs:: CalculateChebyshevPolynomial(const std::vector<double>& coefficients, double x, double* y) const { if (coefficients.empty() || NULL == y) { return false; } const double* c(&coefficients[0]); double b2(0.0); double b1(0.0); for (int i(coefficients.size() - 1); 0 < i; --i) { const double b0(2.0 * x * b1 - b2 + c[i]); b2 = b1; b1 = b0; } *y = x * b1 - b2 + c[0]; return true; } } // namespace sptk Index: Makefile =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/Makefile,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Makefile 23 Jan 2017 05:19:36 -0000 1.25 --- Makefile 26 Jan 2017 10:33:53 -0000 1.26 *************** *** 9,13 **** # Science and Engineering # # # ! # 1996-2016 Nagoya Institute of Technology # # Department of Computer Science # # # --- 9,13 ---- # Science and Engineering # # # ! # 1996-2017 Nagoya Institute of Technology # # Department of Computer Science # # # *************** *** 67,70 **** --- 67,71 ---- levinson_durbin_recursion.cc \ linear_predictive_coefficients_to_cepstrum.cc \ + linear_predictive_coefficients_to_line_spectral_pairs.cc \ linear_predictive_coefficients_to_parcor_coefficients.cc \ m_sequence_generation.cc \ --- NEW FILE: linear_predictive_coefficients_to_line_spectral_pairs.h --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // // All rights reserved. // // // // Redistribution and use in source and binary forms, with or // // without modification, are permitted provided that the following // // conditions are met: // // // // - Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above // // copyright notice, this list of conditions and the following // // disclaimer in the documentation and/or other materials provided // // with the distribution. // // - Neither the name of the SPTK working group nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND // // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS // // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // ----------------------------------------------------------------- // #ifndef SPTK_SRC_LINEAR_PREDICTIVE_COEFFICIENTS_TO_LINE_SPECTRAL_PAIRS_H_ #define SPTK_SRC_LINEAR_PREDICTIVE_COEFFICIENTS_TO_LINE_SPECTRAL_PAIRS_H_ #include <vector> // std::vector #include "sptk_utils.h" namespace sptk { class LinearPredictiveCoefficientsToLineSpectralPairs { public: class Buffer { public: Buffer() { } virtual ~Buffer() { } private: std::vector<double> c1_; std::vector<double> c2_; friend class LinearPredictiveCoefficientsToLineSpectralPairs; DISALLOW_COPY_AND_ASSIGN(Buffer); }; // LinearPredictiveCoefficientsToLineSpectralPairs(int num_order, int num_split, int num_iteration, double epsilon); // virtual ~LinearPredictiveCoefficientsToLineSpectralPairs() { } // int GetNumOrder() const { return num_order_; } // int GetNumSplit() const { return num_split_; } // int GetNumIteration() const { return num_iteration_; } // double GetEpsilon() const { return epsilon_; } // bool IsValid() const { return is_valid_; } // bool Run( const std::vector<double>& linear_predictive_coefficients, std::vector<double>* line_spectral_pairs, LinearPredictiveCoefficientsToLineSpectralPairs::Buffer* buffer) const; private: // bool CalculateChebyshevPolynomial(const std::vector<double>& coefficients, double x, double* y) const; // const int num_order_; // const int num_symmetric_polynomial_order_; // const int num_asymmetric_polynomial_order_; // const int num_split_; // const int num_iteration_; // const double epsilon_; // bool is_valid_; // DISALLOW_COPY_AND_ASSIGN(LinearPredictiveCoefficientsToLineSpectralPairs); }; } // namespace sptk #endif // SPTK_SRC_LINEAR_PREDICTIVE_COEFFICIENTS_TO_LINE_SPECTRAL_PAIRS_H_ --- NEW FILE: lpc2lsp.cc --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // // All rights reserved. // // // // Redistribution and use in source and binary forms, with or // // without modification, are permitted provided that the following // // conditions are met: // // // // - Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above // // copyright notice, this list of conditions and the following // // disclaimer in the documentation and/or other materials provided // // with the distribution. // // - Neither the name of the SPTK working group nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND // // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS // // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // ----------------------------------------------------------------- // #include <unistd.h> #include <algorithm> #include <cmath> #include <fstream> #include <functional> #include <iostream> #include <sstream> #include <vector> #include "linear_predictive_coefficients_to_line_spectral_pairs.h" #include "sptk_utils.h" namespace { enum OutputGainTypes { kLinearGain = 0, kLogGain, kWithoutGain, kNumOutputGainTypes }; enum OutputFormats { kNormalizedFrequencyInRadians = 0, kNormalizedFrequencyInCycles, kFrequecnyInkHz, kFrequecnyInHz, kNumOutputFormats }; const int kDefaultNumOrder(25); const double kDefaultSamplingFrequency(10.0); const int kDefaultOutputGainType(kLinearGain); const int kDefaultOutputFormat(kNormalizedFrequencyInRadians); const int kDefaultNumSplit(128); const int kDefaultNumIteration(4); const double kDefaultEpsilon(1e-6); void PrintUsage(std::ostream* stream) { // clang-format off *stream << std::endl; *stream << " lpc2lsp - transform linear predictive coefficients to " << std::endl; // NOLINT *stream << " line spectral pairs" << std::endl; *stream << std::endl; *stream << " usage:" << std::endl; *stream << " lpc2lsp [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; *stream << " -m m : order of linear predictive coefficients [" << kDefaultNumOrder << "]" << std::endl; // NOLINT *stream << " -s s : sampling frequency [" << kDefaultSamplingFrequency << "]" << std::endl; // NOLINT *stream << " -k k : output gain type [" << kDefaultOutputGainType << "]" << std::endl; // NOLINT *stream << " 0 (linear gain)" << std::endl; *stream << " 1 (log gain)" << std::endl; *stream << " 2 (without gain)" << std::endl; *stream << " -o o : output format [" << kDefaultOutputFormat << "]" << std::endl; // NOLINT *stream << " 0 (normalized frequency [0...pi])" << std::endl; *stream << " 1 (normalized frequency [0...1/2])" << std::endl; *stream << " 2 (frequency [kHz])" << std::endl; *stream << " 3 (frequency [Hz])" << std::endl; *stream << " -h : print this message" << std::endl; *stream << " (level 2)" << std::endl; *stream << " -n n : split number of unit circle [" << kDefaultNumSplit << "]" << std::endl; // NOLINT *stream << " -i i : maximum number of interpolation [" << kDefaultNumIteration << "]" << std::endl; // NOLINT *stream << " -d d : end condition of interpolation [" << kDefaultEpsilon << "]" << std::endl; // NOLINT *stream << " infile:" << std::endl; *stream << " linear predictive coefficients (double) [stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; *stream << " line spectral pairs (double)" << std::endl; *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; *stream << std::endl; // clang-format on } } // namespace int main(int argc, char* argv[]) { int num_order(kDefaultNumOrder); double sampling_frequency(kDefaultSamplingFrequency); OutputGainTypes output_gain_type( static_cast<OutputGainTypes>(kDefaultOutputGainType)); OutputFormats output_format(static_cast<OutputFormats>(kDefaultOutputFormat)); int num_split(kDefaultNumSplit); int num_iteration(kDefaultNumIteration); double epsilon(kDefaultEpsilon); for (;;) { const char option_char(getopt(argc, argv, "m:s:k:o:n:i:d:h")); if (-1 == option_char) break; switch (option_char) { case 'm': { if (!sptk::ConvertStringToInteger(optarg, &num_order) || num_order < 0) { std::ostringstream error_message; error_message << "The argument for the -m option must be a " << "non-negative integer"; sptk::PrintErrorMessage("lpc2lsp", error_message); return 1; } break; } case 's': { if (!sptk::ConvertStringToDouble(optarg, &sampling_frequency) || sampling_frequency <= 0.0) { std::ostringstream error_message; error_message << "The argument for the -s option must be a positive number"; sptk::PrintErrorMessage("lpc2lsp", error_message); return 1; } break; } case 'k': { const int min(0); const int max(static_cast<int>(kNumOutputGainTypes) - 1); int tmp; if (!sptk::ConvertStringToInteger(optarg, &tmp) || !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; error_message << "The argument for the -k option must be an integer " << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("lpc2lsp", error_message); return 1; } output_gain_type = static_cast<OutputGainTypes>(tmp); break; } case 'o': { const int min(0); const int max(static_cast<int>(kNumOutputFormats) - 1); int tmp; if (!sptk::ConvertStringToInteger(optarg, &tmp) || !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; error_message << "The argument for the -o option must be an integer " << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("lpc2lsp", error_message); return 1; } output_format = static_cast<OutputFormats>(tmp); break; } case 'n': { if (!sptk::ConvertStringToInteger(optarg, &num_split) || num_split <= 0) { std::ostringstream error_message; error_message << "The argument for the -n option must be a positive integer"; sptk::PrintErrorMessage("lpc2lsp", error_message); return 1; } break; } case 'i': { if (!sptk::ConvertStringToInteger(optarg, &num_iteration) || num_iteration <= 0) { std::ostringstream error_message; error_message << "The argument for the -i option must be a positive integer"; sptk::PrintErrorMessage("lpc2lsp", error_message); return 1; } break; } case 'd': { if (!sptk::ConvertStringToDouble(optarg, &epsilon) || epsilon < 0.0) { std::ostringstream error_message; error_message << "The argument for the -d option must be a non-negative number"; sptk::PrintErrorMessage("lpc2lsp", error_message); return 1; } break; } case 'h': { PrintUsage(&std::cout); return 0; } default: { PrintUsage(&std::cerr); return 1; } } } // get input file const char* input_file((optind < argc) ? argv[argc - 1] : NULL); // open stream std::ifstream ifs; ifs.open(input_file, std::ios::in | std::ios::binary); if (ifs.fail() && NULL != input_file) { std::ostringstream error_message; error_message << "Cannot open file " << input_file; sptk::PrintErrorMessage("lpc2lsp", error_message); return 1; } std::istream& input_stream(ifs.fail() ? std::cin : ifs); // prepare to transform sptk::LinearPredictiveCoefficientsToLineSpectralPairs linear_predictive_coefficients_to_line_spectral_pairs( num_order, num_split, num_iteration, epsilon); sptk::LinearPredictiveCoefficientsToLineSpectralPairs::Buffer buffer; if (!linear_predictive_coefficients_to_line_spectral_pairs.IsValid()) { std::ostringstream error_message; error_message << "Failed to set condition for transformation"; sptk::PrintErrorMessage("lpc2lsp", error_message); return 1; } const int length(num_order + 1); std::vector<double> linear_predictive_coefficients(length); std::vector<double> line_spectral_pairs(length); while (sptk::ReadStream(false, length, &linear_predictive_coefficients, &input_stream)) { if (!linear_predictive_coefficients_to_line_spectral_pairs.Run( linear_predictive_coefficients, &line_spectral_pairs, &buffer)) { std::ostringstream error_message; error_message << "Failed to transform linear predictive coefficients to " "line spectral pairs"; sptk::PrintErrorMessage("lpc2lsp", error_message); return 1; } switch (output_format) { case kNormalizedFrequencyInRadians: { std::transform(line_spectral_pairs.begin() + 1, line_spectral_pairs.end(), line_spectral_pairs.begin() + 1, std::bind1st(std::multiplies<double>(), sptk::kTwoPi)); break; } case kNormalizedFrequencyInCycles: { // nothing to do break; } case kFrequecnyInkHz: { std::transform( line_spectral_pairs.begin() + 1, line_spectral_pairs.end(), line_spectral_pairs.begin() + 1, std::bind1st(std::multiplies<double>(), sampling_frequency)); break; } case kFrequecnyInHz: { std::transform(line_spectral_pairs.begin() + 1, line_spectral_pairs.end(), line_spectral_pairs.begin() + 1, std::bind1st(std::multiplies<double>(), 1000.0 * sampling_frequency)); break; } default: { break; } } if (kLogGain == output_gain_type) { line_spectral_pairs[0] = std::log(line_spectral_pairs[0]); } const int begin(kWithoutGain == output_gain_type ? 1 : 0); if (!sptk::WriteStream(begin, length, line_spectral_pairs, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write line spectral pairs"; sptk::PrintErrorMessage("lpc2lsp", error_message); return 1; } } return 0; } Index: sptk_utils.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/sptk_utils.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** sptk_utils.h 26 Dec 2016 07:41:20 -0000 1.8 --- sptk_utils.h 26 Jan 2017 10:33:54 -0000 1.9 *************** *** 61,64 **** --- 61,65 ---- static const char* const kVersion("4.0"); static const double kPi(3.141592653589793); + static const double kTwoPi(6.283185307179586); static const double kNp(8.685889638065035); // 1 Np = 20 / ln(10) dB *************** *** 70,73 **** --- 71,77 ---- bool WriteStream(int write_size, const std::vector<double>& sequence_to_write, std::ostream* output_stream); + bool WriteStream(int begin, int end, + const std::vector<double>& sequence_to_write, + std::ostream* output_stream); const char* ConvertBooleanToString(bool input); bool ConvertStringToInteger(const std::string& input, int* output); |
From: Takenori Y. <tak...@us...> - 2017-01-24 12:30:01
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv29413 Modified Files: sptk_utils.cc Log Message: fix a bug Index: sptk_utils.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/sptk_utils.cc,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** sptk_utils.cc 26 Dec 2016 07:41:20 -0000 1.11 --- sptk_utils.cc 24 Jan 2017 12:29:58 -0000 1.12 *************** *** 172,176 **** bool IsInRange(int num, int min, int max) { ! return (num < min || max < num); } --- 172,176 ---- bool IsInRange(int num, int min, int max) { ! return (min <= num && num <= max); } |
From: fujishita t. <fjs...@us...> - 2017-01-23 05:19:38
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv5181 Modified Files: Makefile Added Files: par2lpc.cc parcor_coefficients_to_linear_predictive_coefficients.cc parcor_coefficients_to_linear_predictive_coefficients.h Log Message: add par2lpc command --- NEW FILE: parcor_coefficients_to_linear_predictive_coefficients.h --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // // All rights reserved. // // // // Redistribution and use in source and binary forms, with or // // without modification, are permitted provided that the following // // conditions are met: // // // // - Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above // // copyright notice, this list of conditions and the following // // disclaimer in the documentation and/or other materials provided // // with the distribution. // // - Neither the name of the SPTK working group nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND // // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS // // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // ----------------------------------------------------------------- // #ifndef SPTK_SRC_PARCOR_COEFFICIENTS_TO_LINEAR_PREDICTIVE_COEFFICIENTS_H_ #define SPTK_SRC_PARCOR_COEFFICIENTS_TO_LINEAR_PREDICTIVE_COEFFICIENTS_H_ #include <vector> // std::vector #include "sptk_utils.h" namespace sptk { class ParcorCoefficientsToLinearPredictiveCoefficients { public: class Buffer { public: Buffer() { } virtual ~Buffer() { } private: std::vector<double> k_; friend class ParcorCoefficientsToLinearPredictiveCoefficients; DISALLOW_COPY_AND_ASSIGN(Buffer); }; // explicit ParcorCoefficientsToLinearPredictiveCoefficients(int num_order) : num_order_(num_order), is_valid_(true) { if (num_order_ < 0) { is_valid_ = false; } } // virtual ~ParcorCoefficientsToLinearPredictiveCoefficients() { } // int GetNumOrder() const { return num_order_; } // bool IsValid() const { return is_valid_; } // bool Run( const std::vector<double>& parcor_coefficients, std::vector<double>* linear_predictive_coefficients, ParcorCoefficientsToLinearPredictiveCoefficients::Buffer* buffer) const; private: // const int num_order_; // bool is_valid_; // DISALLOW_COPY_AND_ASSIGN(ParcorCoefficientsToLinearPredictiveCoefficients); }; } // namespace sptk #endif // SPTK_SRC_PARCOR_COEFFICIENTS_TO_LINEAR_PREDICTIVE_COEFFICIENTS_H_ --- NEW FILE: parcor_coefficients_to_linear_predictive_coefficients.cc --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // // All rights reserved. // // // // Redistribution and use in source and binary forms, with or // // without modification, are permitted provided that the following // // conditions are met: // // // // - Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above // // copyright notice, this list of conditions and the following // // disclaimer in the documentation and/or other materials provided // // with the distribution. // // - Neither the name of the SPTK working group nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND // // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS // // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // ----------------------------------------------------------------- // #include "parcor_coefficients_to_linear_predictive_coefficients.h" #include <algorithm> // std::copy #include <cstddef> // std::size_t namespace sptk { bool ParcorCoefficientsToLinearPredictiveCoefficients::Run( const std::vector<double>& parcor_coefficients, std::vector<double>* linear_predictive_coefficients, ParcorCoefficientsToLinearPredictiveCoefficients::Buffer* buffer) const { // check inputs if (!is_valid_ || parcor_coefficients.size() != static_cast<std::size_t>(num_order_ + 1) || NULL == linear_predictive_coefficients || NULL == buffer) { return false; } // prepare memory const int output_length(num_order_ + 1); if (linear_predictive_coefficients->size() < static_cast<std::size_t>(output_length)) { linear_predictive_coefficients->resize(output_length); } (*linear_predictive_coefficients)[0] = parcor_coefficients[0]; if (0 == num_order_) { return true; } // prepare buffer if (buffer->k_.size() < static_cast<std::size_t>(output_length)) { buffer->k_.resize(output_length); } // get value double* output(&((*linear_predictive_coefficients)[0])); // transform parcor coefficients to linear predictive coefficients std::copy(parcor_coefficients.begin(), parcor_coefficients.end(), buffer->k_.begin()); double* k(&buffer->k_[0]); for (int i(1); i <= num_order_; ++i) { for (int j(1); j < i; ++j) { output[j] = k[j] + k[i] * k[i - j]; } for (int j(1); j < i; ++j) { k[j] = output[j]; } } output[num_order_] = k[num_order_]; return true; } } // namespace sptk Index: Makefile =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/Makefile,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Makefile 13 Jan 2017 03:19:11 -0000 1.24 --- Makefile 23 Jan 2017 05:19:36 -0000 1.25 *************** *** 70,73 **** --- 70,74 ---- m_sequence_generation.cc \ normal_distributed_random_value_generation.cc \ + parcor_coefficients_to_linear_predictive_coefficients.cc \ sptk_utils.cc --- NEW FILE: par2lpc.cc --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // // All rights reserved. // // // // Redistribution and use in source and binary forms, with or // // without modification, are permitted provided that the following // // conditions are met: // // // // - Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above // // copyright notice, this list of conditions and the following // // disclaimer in the documentation and/or other materials provided // // with the distribution. // // - Neither the name of the SPTK working group nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND // // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS // // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // ----------------------------------------------------------------- // #include <unistd.h> #include <fstream> #include <iostream> #include <sstream> #include <vector> #include "parcor_coefficients_to_linear_predictive_coefficients.h" #include "sptk_utils.h" namespace { const int kDefaultNumOrder(25); void PrintUsage(std::ostream* stream) { // clang-format off *stream << std::endl; *stream << " par2lpc - transform PARCOR coefficients to linear predictive coefficients" << std::endl; // NOLINT *stream << std::endl; *stream << " usage:" << std::endl; *stream << " par2lpc [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; *stream << " -m m : order of linear predictive coefficients [" << kDefaultNumOrder << "]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; *stream << " PARCOR coefficients (double) [stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; *stream << " linear predictive coefficients (double)" << std::endl; *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; *stream << std::endl; // clang-format on } } // namespace int main(int argc, char* argv[]) { int num_order(kDefaultNumOrder); for (;;) { const char option_char(getopt(argc, argv, "m:h")); if (-1 == option_char) break; switch (option_char) { case 'm': { if (!sptk::ConvertStringToInteger(optarg, &num_order) || num_order < 0) { std::ostringstream error_message; error_message << "The argument for the -m option must be a " << "non-negative integer"; sptk::PrintErrorMessage("par2lpc", error_message); return 1; } break; } case 'h': { PrintUsage(&std::cout); return 0; } default: { PrintUsage(&std::cerr); return 1; } } } // get input file const char* input_file((optind < argc) ? argv[argc - 1] : NULL); // open stream std::ifstream ifs; ifs.open(input_file, std::ios::in | std::ios::binary); if (ifs.fail() && NULL != input_file) { std::ostringstream error_message; error_message << "Cannot open file " << input_file; sptk::PrintErrorMessage("par2lpc", error_message); return 1; } std::istream& input_stream(ifs.fail() ? std::cin : ifs); sptk::ParcorCoefficientsToLinearPredictiveCoefficients parcor_coefficients_to_linear_predictive_coefficients(num_order); sptk::ParcorCoefficientsToLinearPredictiveCoefficients::Buffer buffer; if (!parcor_coefficients_to_linear_predictive_coefficients.IsValid()) { std::ostringstream error_message; error_message << "Failed to set the condition"; sptk::PrintErrorMessage("par2lpc", error_message); return 1; } const int length(num_order + 1); std::vector<double> parcor_coefficients(length); std::vector<double> linear_predictive_coefficients(length); for (int frame_index(0); sptk::ReadStream(false, length, &parcor_coefficients, &input_stream); ++frame_index) { if (!parcor_coefficients_to_linear_predictive_coefficients.Run( parcor_coefficients, &linear_predictive_coefficients, &buffer)) { std::ostringstream error_message; error_message << "Failed to transform PARCOR coefficients to " << "linear predictive coefficients"; sptk::PrintErrorMessage("par2lpc", error_message); return 1; } if (!sptk::WriteStream(length, linear_predictive_coefficients, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write linear predictive coefficients"; sptk::PrintErrorMessage("par2lpc", error_message); return 1; } } return 0; } |
From: Keiichiro O. <ur...@us...> - 2017-01-23 00:41:26
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv22616 Modified Files: mgc2mgc.cc Log Message: modify comments Index: mgc2mgc.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mgc2mgc.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mgc2mgc.cc 13 Jan 2017 06:55:17 -0000 1.3 --- mgc2mgc.cc 23 Jan 2017 00:41:23 -0000 1.4 *************** *** 93,98 **** *stream << " value of c must be c >= 1" << std::endl; *stream << " value of C must be C >= 1" << std::endl; ! *stream << " if -u is used without -n, input is regarded as 1+g/mgc[0],g*mgc[1],...,g*mgc[m]" << std::endl; // NOLINT ! *stream << " if -U is used without -N, output is regarded as 1+g/mgc[0],g*mgc[1],...,g*mgc[m]" << std::endl; // NOLINT *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; --- 93,98 ---- *stream << " value of c must be c >= 1" << std::endl; *stream << " value of C must be C >= 1" << std::endl; ! *stream << " if -u is used without -n, input is regarded as 1+g*mgc[0],g*mgc[1],...,g*mgc[m]" << std::endl; // NOLINT ! *stream << " if -U is used without -N, output is regarded as 1+g*mgc[0],g*mgc[1],...,g*mgc[m]" << std::endl; // NOLINT *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; *************** *** 263,267 **** while (sptk::ReadStream(false, input_length, &generalized_cepstrum, &input_stream)) { ! // input modification: 1*g/mgc[0] -> mgc[0] if (!input_normalization_flag && input_multiplication_flag) (*generalized_cepstrum.begin()) = --- 263,267 ---- while (sptk::ReadStream(false, input_length, &generalized_cepstrum, &input_stream)) { ! // input modification: 1+g*mgc[0] -> mgc[0] if (!input_normalization_flag && input_multiplication_flag) (*generalized_cepstrum.begin()) = |
From: Takenori Y. <tak...@us...> - 2017-01-14 08:05:55
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv10993 Modified Files: lpc.cc Log Message: fix a bug Index: lpc.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/lpc.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** lpc.cc 13 Jan 2017 03:21:09 -0000 1.5 --- lpc.cc 14 Jan 2017 08:05:53 -0000 1.6 *************** *** 223,227 **** bool is_stable(false); if (!recursion.Run(autocorrelation_sequence, ! &linear_predictive_coefficients, &buffer, &is_stable)) { std::ostringstream error_message; error_message << "Failed to solve an autocorrelation normal equation"; --- 223,227 ---- bool is_stable(false); if (!recursion.Run(autocorrelation_sequence, ! &linear_predictive_coefficients, &is_stable, &buffer)) { std::ostringstream error_message; error_message << "Failed to solve an autocorrelation normal equation"; |
From: Takenori Y. <tak...@us...> - 2017-01-13 06:55:19
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv5539 Modified Files: mgc2mgc.cc Log Message: fix comments Index: mgc2mgc.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mgc2mgc.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mgc2mgc.cc 26 Dec 2016 07:41:20 -0000 1.2 --- mgc2mgc.cc 13 Jan 2017 06:55:17 -0000 1.3 *************** *** 92,95 **** --- 92,96 ---- *stream << " notice:" << std::endl; *stream << " value of c must be c >= 1" << std::endl; + *stream << " value of C must be C >= 1" << std::endl; *stream << " if -u is used without -n, input is regarded as 1+g/mgc[0],g*mgc[1],...,g*mgc[m]" << std::endl; // NOLINT *stream << " if -U is used without -N, output is regarded as 1+g/mgc[0],g*mgc[1],...,g*mgc[m]" << std::endl; // NOLINT *************** *** 262,266 **** while (sptk::ReadStream(false, input_length, &generalized_cepstrum, &input_stream)) { ! // input modification: 1*g/c[0] -> c[0] if (!input_normalization_flag && input_multiplication_flag) (*generalized_cepstrum.begin()) = --- 263,267 ---- while (sptk::ReadStream(false, input_length, &generalized_cepstrum, &input_stream)) { ! // input modification: 1*g/mgc[0] -> mgc[0] if (!input_normalization_flag && input_multiplication_flag) (*generalized_cepstrum.begin()) = *************** *** 274,278 **** return 1; } ! // output modification: c[0] -> 1+g*c[0] if (!output_normalization_flag && output_multiplication_flag) (*transformed_generalized_cepstrum.begin()) = --- 275,279 ---- return 1; } ! // output modification: mgc[0] -> 1+g*mgc[0] if (!output_normalization_flag && output_multiplication_flag) (*transformed_generalized_cepstrum.begin()) = |
From: Takenori Y. <tak...@us...> - 2017-01-13 06:49:35
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv5277 Added Files: fftr.cc Log Message: add fftr command --- NEW FILE: fftr.cc --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // // All rights reserved. // // // // Redistribution and use in source and binary forms, with or // // without modification, are permitted provided that the following // // conditions are met: // // // // - Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above // // copyright notice, this list of conditions and the following // // disclaimer in the documentation and/or other materials provided // // with the distribution. // // - Neither the name of the SPTK working group nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND // // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS // // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // ----------------------------------------------------------------- // #include <unistd.h> #include <cmath> #include <fstream> #include <iostream> #include <sstream> #include <vector> #include "fast_fourier_transform_for_real_sequence.h" #include "sptk_utils.h" namespace { enum OutputFormats { kOutputRealAndImaginaryParts = 0, kOutputRealPart, kOutputImaginaryPart, kOutputAmplitude, kOutputPower, kNumOutputFormats }; const int kDefaultFftSize(256); const bool kDefaultHalfSizeOutputFlag(false); void PrintUsage(std::ostream* stream) { // clang-format off *stream << std::endl; *stream << " fftr - FFT for real sequence" << std::endl; *stream << std::endl; *stream << " usage:" << std::endl; *stream << " fftr [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; *stream << " -l l : FFT size [" << kDefaultFftSize << "]" << std::endl; // NOLINT *stream << " -m m : order of sequence [l-1]" << std::endl; *stream << " -o o : output format [0]" << std::endl; *stream << " 0 (real and imaginary parts)" << std::endl; *stream << " 1 (real part)" << std::endl; *stream << " 2 (imaginary part)" << std::endl; *stream << " 3 (amplitude)" << std::endl; *stream << " 4 (power)" << std::endl; *stream << " -H : output half size [" << sptk::ConvertBooleanToString(kDefaultHalfSizeOutputFlag) << "]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; *stream << " data sequence (double) [stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; *stream << " FFT sequence (double)" << std::endl; *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; *stream << std::endl; // clang-format on } } // namespace int main(int argc, char* argv[]) { int fft_size(kDefaultFftSize); int num_order(kDefaultFftSize - 1); bool is_num_order_specified(false); bool half_size_output_flag(kDefaultHalfSizeOutputFlag); OutputFormats output_format(kOutputRealAndImaginaryParts); for (;;) { const char option_char(getopt(argc, argv, "l:m:o:Hh")); if (-1 == option_char) break; switch (option_char) { case 'l': { if (!sptk::ConvertStringToInteger(optarg, &fft_size)) { std::ostringstream error_message; error_message << "The argument for the -l option must be an integer"; sptk::PrintErrorMessage("fftr", error_message); return 1; } break; } case 'm': { if (!sptk::ConvertStringToInteger(optarg, &num_order) || num_order < 0) { std::ostringstream error_message; error_message << "The argument for the -m option must be a " << "non-negative integer"; sptk::PrintErrorMessage("fft", error_message); return 1; } is_num_order_specified = true; break; } case 'o': { int given_integer(-1); if (!sptk::ConvertStringToInteger(optarg, &given_integer)) { std::ostringstream error_message; error_message << "The argument for the -o option must be an integer"; sptk::PrintErrorMessage("fftr", error_message); return 1; } const int min(0); const int max(static_cast<int>(kNumOutputFormats) - 1); if (!sptk::IsInRange(given_integer, min, max)) { std::ostringstream error_message; error_message << "The argument for the -o option must be in range" << " (" << min << " .. " << max << ")"; sptk::PrintErrorMessage("fftr", error_message); return 1; } output_format = static_cast<OutputFormats>(given_integer); break; } case 'H': { half_size_output_flag = true; break; } case 'h': { PrintUsage(&std::cout); return 0; } default: { PrintUsage(&std::cerr); return 1; } } } // check order if (is_num_order_specified) { if (fft_size <= num_order) { std::ostringstream error_message; error_message << "The order of a sequence " << num_order << " should be less than the FFT size " << fft_size; sptk::PrintErrorMessage("fftr", error_message); return 1; } } else { num_order = fft_size - 1; } // get input file const char* input_file((optind < argc) ? argv[argc - 1] : NULL); // open stream std::ifstream ifs; ifs.open(input_file, std::ios::in | std::ios::binary); if (ifs.fail() && NULL != input_file) { std::ostringstream error_message; error_message << "Cannot open file " << input_file; sptk::PrintErrorMessage("fftr", error_message); return 1; } std::istream& input_stream(ifs.fail() ? std::cin : ifs); // prepare for fast Fourier transform sptk::FastFourierTransformForRealSequence fft(num_order, fft_size, false); sptk::FastFourierTransformForRealSequence::Buffer buffer; if (!fft.IsValid()) { std::ostringstream error_message; error_message << "FFT size must be a power of 2 and greater than 4"; sptk::PrintErrorMessage("fftr", error_message); return 1; } const int input_length(num_order + 1); const int output_length(half_size_output_flag ? (fft_size / 2 + 1) : fft_size); std::vector<double> input_x(input_length); std::vector<double> output_x(fft_size); std::vector<double> output_y(fft_size); while (sptk::ReadStream(true, input_length, &input_x, &input_stream)) { if (!fft.Run(input_x, &output_x, &output_y, &buffer)) { std::ostringstream error_message; error_message << "Failed to run fast Fourier transform"; sptk::PrintErrorMessage("fftr", error_message); return 1; } if (kOutputAmplitude == output_format) { for (int i(0); i < output_length; ++i) { output_x[i] = std::sqrt(output_x[i] * output_x[i] + output_y[i] * output_y[i]); } } else if (kOutputPower == output_format) { for (int i(0); i < output_length; ++i) { output_x[i] = output_x[i] * output_x[i] + output_y[i] * output_y[i]; } } if (kOutputImaginaryPart != output_format && !sptk::WriteStream(output_length, output_x, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write an output sequence"; sptk::PrintErrorMessage("fftr", error_message); return 1; } if ((kOutputRealAndImaginaryParts == output_format || kOutputImaginaryPart == output_format) && !sptk::WriteStream(output_length, output_y, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write an output sequence"; sptk::PrintErrorMessage("fftr", error_message); return 1; } } return 0; } |
From: fujishita t. <fjs...@us...> - 2017-01-13 03:21:11
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv26495 Modified Files: levdur.cc lpc.cc Log Message: modify option name Index: lpc.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/lpc.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** lpc.cc 24 Nov 2016 04:16:56 -0000 1.4 --- lpc.cc 13 Jan 2017 03:21:09 -0000 1.5 *************** *** 78,82 **** *stream << " -f f : minimum value of the determinant of [" << kDefaultEpsilon << "]" << std::endl; // NOLINT *stream << " the normal matrix" << std::endl; ! *stream << " -c c : check whether the derived linear [0]" << std::endl; // NOLINT *stream << " predictive coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; --- 78,82 ---- *stream << " -f f : minimum value of the determinant of [" << kDefaultEpsilon << "]" << std::endl; // NOLINT *stream << " the normal matrix" << std::endl; ! *stream << " -e e : check whether the derived linear [0]" << std::endl; // NOLINT *stream << " predictive coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; *************** *** 106,110 **** for (;;) { ! const char option_char(getopt(argc, argv, "l:m:f:c:h")); if (-1 == option_char) break; --- 106,110 ---- for (;;) { ! const char option_char(getopt(argc, argv, "l:m:f:e:h")); if (-1 == option_char) break; *************** *** 142,150 **** break; } ! case 'c': { int given_integer(-1); if (!sptk::ConvertStringToInteger(optarg, &given_integer)) { std::ostringstream error_message; ! error_message << "The argument for the -c option must be an integer"; sptk::PrintErrorMessage("lpc", error_message); return 1; --- 142,150 ---- break; } ! case 'e': { int given_integer(-1); if (!sptk::ConvertStringToInteger(optarg, &given_integer)) { std::ostringstream error_message; ! error_message << "The argument for the -e option must be an integer"; sptk::PrintErrorMessage("lpc", error_message); return 1; *************** *** 155,159 **** if (!sptk::IsInRange(given_integer, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -c option must be in range" << " (" << min << " .. " << max << ")"; sptk::PrintErrorMessage("lpc", error_message); --- 155,159 ---- if (!sptk::IsInRange(given_integer, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -e option must be in range" << " (" << min << " .. " << max << ")"; sptk::PrintErrorMessage("lpc", error_message); Index: levdur.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/levdur.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** levdur.cc 26 Dec 2016 07:41:20 -0000 1.6 --- levdur.cc 13 Jan 2017 03:21:09 -0000 1.7 *************** *** 76,80 **** *stream << " -f f : minimum value of the determinant of [" << kDefaultEpsilon << "]" << std::endl; // NOLINT *stream << " the normal matrix" << std::endl; ! *stream << " -c c : check whether the derived linear [0]" << std::endl; // NOLINT *stream << " predictive coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; --- 76,80 ---- *stream << " -f f : minimum value of the determinant of [" << kDefaultEpsilon << "]" << std::endl; // NOLINT *stream << " the normal matrix" << std::endl; ! *stream << " -e e : check whether the derived linear [0]" << std::endl; // NOLINT *stream << " predictive coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; *************** *** 103,107 **** for (;;) { ! const char option_char(getopt(argc, argv, "m:f:c:h")); if (-1 == option_char) break; --- 103,107 ---- for (;;) { ! const char option_char(getopt(argc, argv, "m:f:e:h")); if (-1 == option_char) break; *************** *** 128,136 **** break; } ! case 'c': { int given_integer(-1); if (!sptk::ConvertStringToInteger(optarg, &given_integer)) { std::ostringstream error_message; ! error_message << "The argument for the -c option must be an integer"; sptk::PrintErrorMessage("levdur", error_message); return 1; --- 128,136 ---- break; } ! case 'e': { int given_integer(-1); if (!sptk::ConvertStringToInteger(optarg, &given_integer)) { std::ostringstream error_message; ! error_message << "The argument for the -e option must be an integer"; sptk::PrintErrorMessage("levdur", error_message); return 1; *************** *** 141,145 **** if (!sptk::IsInRange(given_integer, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -c option must be in range" << " (" << min << " .. " << max << ")"; sptk::PrintErrorMessage("levdur", error_message); --- 141,145 ---- if (!sptk::IsInRange(given_integer, min, max)) { std::ostringstream error_message; ! error_message << "The argument for the -e option must be in range" << " (" << min << " .. " << max << ")"; sptk::PrintErrorMessage("levdur", error_message); |
From: fujishita t. <fjs...@us...> - 2017-01-13 03:19:13
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv26402 Modified Files: Makefile Added Files: lpc2par.cc linear_predictive_coefficients_to_parcor_coefficients.cc linear_predictive_coefficients_to_parcor_coefficients.h Log Message: add lpc2par command --- NEW FILE: lpc2par.cc --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // // All rights reserved. // // // // Redistribution and use in source and binary forms, with or // // without modification, are permitted provided that the following // // conditions are met: // // // // - Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above // // copyright notice, this list of conditions and the following // // disclaimer in the documentation and/or other materials provided // // with the distribution. // // - Neither the name of the SPTK working group nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND // // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS // // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // ----------------------------------------------------------------- // #include <unistd.h> #include <fstream> #include <iostream> #include <sstream> #include <vector> #include "linear_predictive_coefficients_to_parcor_coefficients.h" #include "sptk_utils.h" namespace { enum BehaviorForUnstableCoefficients { kIgnore = 0, kWarn, kExit, kNumKindsOfBehavior }; const int kDefaultNumOrder(25); const double kDefaultGamma(1.0); void PrintUsage(std::ostream* stream) { // clang-format off *stream << std::endl; *stream << " lpc2par - transform linear predictive coefficients to PARCOR coefficients" << std::endl; // NOLINT *stream << std::endl; *stream << " usage:" << std::endl; *stream << " lpc2par [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; *stream << " -m m : order of linear predictive coefficients [" << kDefaultNumOrder << "]" << std::endl; // NOLINT *stream << " -g g : gamma of generalized cepstrum [" << kDefaultGamma << "]" << std::endl; // NOLINT *stream << " -c c : gamma of generalized cepstrum = -1 / (int) c" << std::endl; // NOLINT *stream << " -e e : check whether the derived PARCOR [0]" << std::endl; // NOLINT *stream << " coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; *stream << " 1 (if the coefficients are unstable," << std::endl; // NOLINT *stream << " output the index to stderr)" << std::endl; *stream << " 2 (if the coefficients are unstable," << std::endl; // NOLINT *stream << " output the index to stderr and" << std::endl; *stream << " exit immediately)" << std::endl; *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; *stream << " linear predictive coefficients (double) [stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; *stream << " PARCOR coefficients (double)" << std::endl; *stream << " notice:" << std::endl; *stream << " value of c must be c >= 1" << std::endl; *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; *stream << std::endl; // clang-format on } } // namespace int main(int argc, char* argv[]) { int num_order(kDefaultNumOrder); double gamma(kDefaultGamma); BehaviorForUnstableCoefficients behavior(kIgnore); for (;;) { const char option_char(getopt(argc, argv, "m:g:c:e:h")); if (-1 == option_char) break; switch (option_char) { case 'm': { if (!sptk::ConvertStringToInteger(optarg, &num_order) || num_order < 0) { std::ostringstream error_message; error_message << "The argument for the -m option must be a " << "non-negative integer"; sptk::PrintErrorMessage("lpc2par", error_message); return 1; } break; } case 'g': { if (!sptk::ConvertStringToDouble(optarg, &gamma)) { std::ostringstream error_message; error_message << "The argument for the -g option must be numeric"; sptk::PrintErrorMessage("lpc2par", error_message); return 1; } break; } case 'c': { int tmp; if (!sptk::ConvertStringToInteger(optarg, &tmp) || tmp < 1) { std::ostringstream error_message; error_message << "The argument for the -c option must be a " << "positive integer"; sptk::PrintErrorMessage("lpc2par", error_message); return 1; } gamma = -1.0 / tmp; break; } case 'e': { int tmp; if (!sptk::ConvertStringToInteger(optarg, &tmp)) { std::ostringstream error_message; error_message << "The argument for the -e option must be an integer"; sptk::PrintErrorMessage("lpc2par", error_message); return 1; } const int min(0); const int max(static_cast<int>(kNumKindsOfBehavior) - 1); if (!sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; error_message << "The argument for the -e option must be in range" << " (" << min << " .. " << max << ")"; sptk::PrintErrorMessage("lpc2par", error_message); return 1; } behavior = static_cast<BehaviorForUnstableCoefficients>(tmp); break; } case 'h': { PrintUsage(&std::cout); return 0; } default: { PrintUsage(&std::cerr); return 1; } } } // get input file const char* input_file((optind < argc) ? argv[argc - 1] : NULL); // open stream std::ifstream ifs; ifs.open(input_file, std::ios::in | std::ios::binary); if (ifs.fail() && NULL != input_file) { std::ostringstream error_message; error_message << "Cannot open file " << input_file; sptk::PrintErrorMessage("lpc2par", error_message); return 1; } std::istream& input_stream(ifs.fail() ? std::cin : ifs); sptk::LinearPredictiveCoefficientsToParcorCoefficients linear_predictive_coefficients_to_parcor_coefficients(num_order, gamma); sptk::LinearPredictiveCoefficientsToParcorCoefficients::Buffer buffer; if (!linear_predictive_coefficients_to_parcor_coefficients.IsValid()) { std::ostringstream error_message; error_message << "Failed to set the condition"; sptk::PrintErrorMessage("lpc2par", error_message); return 1; } const int length(num_order + 1); std::vector<double> linear_predictive_coefficients(length); std::vector<double> parcor_coefficients(length); for (int frame_index(0); sptk::ReadStream( false, length, &linear_predictive_coefficients, &input_stream); ++frame_index) { bool is_stable(false); if (!linear_predictive_coefficients_to_parcor_coefficients.Run( linear_predictive_coefficients, &parcor_coefficients, &is_stable, &buffer)) { std::ostringstream error_message; error_message << "Failed to transform linear predictive coefficients to " << "PARCOR coefficients"; sptk::PrintErrorMessage("lpc2par", error_message); return 1; } if (!is_stable && kIgnore != behavior) { std::ostringstream error_message; error_message << frame_index << "th frame is unstable"; sptk::PrintErrorMessage("lpc2par", error_message); if (kExit == behavior) return 1; } if (!sptk::WriteStream(length, parcor_coefficients, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write PARCOR coefficients"; sptk::PrintErrorMessage("lpc2par", error_message); return 1; } } return 0; } Index: Makefile =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/Makefile,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Makefile 26 Dec 2016 07:41:20 -0000 1.23 --- Makefile 13 Jan 2017 03:19:11 -0000 1.24 *************** *** 67,70 **** --- 67,71 ---- levinson_durbin_recursion.cc \ linear_predictive_coefficients_to_cepstrum.cc \ + linear_predictive_coefficients_to_parcor_coefficients.cc \ m_sequence_generation.cc \ normal_distributed_random_value_generation.cc \ --- NEW FILE: linear_predictive_coefficients_to_parcor_coefficients.cc --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // // All rights reserved. // // // // Redistribution and use in source and binary forms, with or // // without modification, are permitted provided that the following // // conditions are met: // // // // - Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above // // copyright notice, this list of conditions and the following // // disclaimer in the documentation and/or other materials provided // // with the distribution. // // - Neither the name of the SPTK working group nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND // // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS // // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // ----------------------------------------------------------------- // #include "linear_predictive_coefficients_to_parcor_coefficients.h" #include <algorithm> // std::copy, std::fill_n, std::transform #include <cmath> // std::fabs #include <cstddef> // std::size_t #include <functional> // std::bind1st, std::multiplies namespace sptk { LinearPredictiveCoefficientsToParcorCoefficients:: LinearPredictiveCoefficientsToParcorCoefficients(int num_order, double gamma) : num_order_(num_order), gamma_(gamma), is_valid_(true) { if (num_order_ < 0) { is_valid_ = false; } } bool LinearPredictiveCoefficientsToParcorCoefficients::Run( const std::vector<double>& linear_predictive_coefficients, std::vector<double>* parcor_coefficients, bool* is_stable, LinearPredictiveCoefficientsToParcorCoefficients::Buffer* buffer) const { // check inputs if (!is_valid_ || linear_predictive_coefficients.size() != static_cast<std::size_t>(num_order_ + 1) || NULL == parcor_coefficients || NULL == buffer || NULL == is_stable) { return false; } // prepare memory const int output_length(num_order_ + 1); if (parcor_coefficients->size() < static_cast<std::size_t>(output_length)) { parcor_coefficients->resize(output_length); } // set value *is_stable = true; (*parcor_coefficients)[0] = linear_predictive_coefficients[0]; if (0 == num_order_) { return true; } if (0.0 == gamma_) { std::fill_n(parcor_coefficients->begin() + 1, num_order_, 0.0); return true; } // prepare buffer if (buffer->a_.size() < static_cast<std::size_t>(output_length)) { buffer->a_.resize(output_length); } // get value double* output(&((*parcor_coefficients)[0])); // transform linear predictive coefficients to parcor coefficients if (1.0 == gamma_) { std::copy(linear_predictive_coefficients.begin(), linear_predictive_coefficients.end(), buffer->a_.begin()); } else { buffer->a_[0] = linear_predictive_coefficients[0]; std::transform(linear_predictive_coefficients.begin() + 1, linear_predictive_coefficients.end(), buffer->a_.begin() + 1, std::bind1st(std::multiplies<double>(), gamma_)); } double* a(&buffer->a_[0]); for (int i(num_order_); 1 <= i; --i) { for (int j(1); j <= i; ++j) { output[j] = a[j]; } const double denominator(1.0 - output[i] * output[i]); if (0.0 == denominator) { return false; } if (1.0 <= std::fabs(output[i])) { *is_stable = false; } for (int j(1); j < i; ++j) { a[j] = (output[j] - output[i] * output[i - j]) / denominator; } } return true; } } // namespace sptk --- NEW FILE: linear_predictive_coefficients_to_parcor_coefficients.h --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // // All rights reserved. // // // // Redistribution and use in source and binary forms, with or // // without modification, are permitted provided that the following // // conditions are met: // // // // - Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above // // copyright notice, this list of conditions and the following // // disclaimer in the documentation and/or other materials provided // // with the distribution. // // - Neither the name of the SPTK working group nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND // // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS // // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // ----------------------------------------------------------------- // #ifndef SPTK_SRC_LINEAR_PREDICTIVE_COEFFICIENTS_TO_PARCOR_COEFFICIENTS_H_ #define SPTK_SRC_LINEAR_PREDICTIVE_COEFFICIENTS_TO_PARCOR_COEFFICIENTS_H_ #include <vector> // std::vector #include "sptk_utils.h" namespace sptk { class LinearPredictiveCoefficientsToParcorCoefficients { public: class Buffer { public: Buffer() { } virtual ~Buffer() { } private: std::vector<double> a_; friend class LinearPredictiveCoefficientsToParcorCoefficients; DISALLOW_COPY_AND_ASSIGN(Buffer); }; // LinearPredictiveCoefficientsToParcorCoefficients(int num_order, double gamma); // virtual ~LinearPredictiveCoefficientsToParcorCoefficients() { } // int GetNumOrder() const { return num_order_; } // double GetGamma() const { return gamma_; } // bool IsValid() const { return is_valid_; } // bool Run( const std::vector<double>& linear_predictive_coefficients, std::vector<double>* parcor_coefficients, bool* is_stable, LinearPredictiveCoefficientsToParcorCoefficients::Buffer* buffer) const; private: // const int num_order_; // const double gamma_; // bool is_valid_; // DISALLOW_COPY_AND_ASSIGN(LinearPredictiveCoefficientsToParcorCoefficients); }; } // namespace sptk #endif // SPTK_SRC_LINEAR_PREDICTIVE_COEFFICIENTS_TO_PARCOR_COEFFICIENTS_H_ |
From: Takenori Y. <tak...@us...> - 2016-12-27 04:25:57
|
Update of /cvsroot/sp-tk/SPTK/src/script In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv19227 Modified Files: glogsp.in grlogsp.in Log Message: add support for some frequencies Index: glogsp.in =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/script/glogsp.in,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** glogsp.in 22 Dec 2016 10:53:16 -0000 1.26 --- glogsp.in 27 Dec 2016 04:25:55 -0000 1.27 *************** *** 91,95 **** "" \ "Frequency (kHz)" \ ! "" "" "" "" "" \ "Frequency (kHz)" \ "" "" "" "" "" \ --- 91,97 ---- "" \ "Frequency (kHz)" \ ! "" \ ! "Frequency (kHz)" \ ! "" "" "" \ "Frequency (kHz)" \ "" "" "" "" "" \ *************** *** 100,104 **** --- 102,127 ---- "" "" "" "" "" "" "" "" \ "" "" "" "" "" "" "" \ + "Frequency (kHz)" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" \ + "Frequency (kHz)" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" \ "Frequency (kHz)" ) + set xs = ( "0 0.25 0.5" \ 0\ \'1.57\ \"\\pi/2\"\ \'3.14\ \"\\pi\" \ *************** *** 111,115 **** "" \ "0 2 4 6 8 10" \ ! "" "" "" "" "" \ "0 4 8 12 16" \ "" "" "" "" "" \ --- 134,140 ---- "" \ "0 2 4 6 8 10" \ ! "" \ ! "0 3 6 9 12" \ ! "" "" "" \ "0 4 8 12 16" \ "" "" "" "" "" \ *************** *** 120,124 **** "" "" "" "" "" "" "" "" \ "" "" "" "" "" "" "" \ ! "0 16 32 48" ) set xx = ( "0 0.5" \ "0 3.14" \ --- 145,170 ---- "" "" "" "" "" "" "" "" \ "" "" "" "" "" "" "" \ ! "0 16 32 48" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" \ ! "0 24 48 72 96" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" \ ! "0 48 96 144 192" ) ! set xx = ( "0 0.5" \ "0 3.14" \ *************** *** 131,135 **** "" \ "0 10" \ ! "" "" "" "" "" \ "0 16" \ "" "" "" "" "" \ --- 177,183 ---- "" \ "0 10" \ ! "" \ ! "0 12" \ ! "" "" "" \ "0 16" \ "" "" "" "" "" \ *************** *** 140,144 **** "" "" "" "" "" "" "" "" \ "" "" "" "" "" "" "" \ ! "0 48" ) set xl = ( 0.5 \ 3.14 \ --- 188,213 ---- "" "" "" "" "" "" "" "" \ "" "" "" "" "" "" "" \ ! "0 48" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" \ ! "0 96" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" \ ! "0 192" ) ! set xl = ( 0.5 \ 3.14 \ *************** *** 151,155 **** "" \ 10 \ ! "" "" "" "" "" \ 16 \ "" "" "" "" "" \ --- 220,226 ---- "" \ 10 \ ! "" \ ! 12 \ ! "" "" "" \ 16 \ "" "" "" "" "" \ *************** *** 160,164 **** "" "" "" "" "" "" "" "" \ "" "" "" "" "" "" "" \ ! 48 ) set on_x = (40 125 40 125 40 125) --- 231,255 ---- "" "" "" "" "" "" "" "" \ "" "" "" "" "" "" "" \ ! 48 \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" \ ! 96 \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" \ ! 192 ) set on_x = (40 125 40 125 40 125) *************** *** 290,303 **** echo2 ' -x x : x scale [1]' if ( $help ) then ! echo2 ' 1 (Normalized frequency <0, 0.5>)' ! echo2 ' 2 (Normalized frequency <0, pi/2, pi>)' ! echo2 ' 4 (Frequency <0, 1, 2, 3, 4 kHz>)' ! echo2 ' 5 (Frequency <0, 1, 2, 3, 4, 5 kHz>)' ! echo2 ' 8 (Frequency <0, 2, 4, 6, 8 kHz>)' ! echo2 ' 10 (Frequency <0, 2, 4, 6, 8, 10 kHz>)' ! echo2 ' 16 (Frequency <0, 4, 8, 12, 16 kHz>)' ! echo2 ' 22 (Frequency <0, 11, 22 kHz>)' ! echo2 ' 24 (Frequency <0, 6, 12, 18, 24 kHz>)' ! echo2 ' 48 (Frequency <0, 16, 32, 48 kHz>)' endif echo2 ' -y ymin ymax : y scale [0 100]' --- 381,397 ---- echo2 ' -x x : x scale [1]' if ( $help ) then ! echo2 ' 1 (Normalized frequency <0, 0.5>)' ! echo2 ' 2 (Normalized frequency <0, pi/2, pi>)' ! echo2 ' 4 (Frequency <0, 1, 2, 3, 4 kHz>)' ! echo2 ' 5 (Frequency <0, 1, 2, 3, 4, 5 kHz>)' ! echo2 ' 8 (Frequency <0, 2, 4, 6, 8 kHz>)' ! echo2 ' 10 (Frequency <0, 2, 4, 6, 8, 10 kHz>)' ! echo2 ' 12 (Frequency <0, 3, 6, 9, 12 kHz>)' ! echo2 ' 16 (Frequency <0, 4, 8, 12, 16 kHz>)' ! echo2 ' 22 (Frequency <0, 11, 22 kHz>)' ! echo2 ' 24 (Frequency <0, 6, 12, 18, 24 kHz>)' ! echo2 ' 48 (Frequency <0, 16, 32, 48 kHz>)' ! echo2 ' 96 (Frequency <0, 24, 48, 72, 96 kHz>)' ! echo2 ' 192 (Frequency <0, 48, 96,144,192 kHz>)' endif echo2 ' -y ymin ymax : y scale [0 100]' Index: grlogsp.in =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/script/grlogsp.in,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** grlogsp.in 22 Dec 2016 10:53:16 -0000 1.26 --- grlogsp.in 27 Dec 2016 04:25:55 -0000 1.27 *************** *** 99,103 **** "" \ "Frequency (kHz)" \ ! "" "" "" "" "" \ "Frequency (kHz)" \ "" "" "" "" "" \ --- 99,105 ---- "" \ "Frequency (kHz)" \ ! "" \ ! "Frequency (kHz)" \ ! "" "" "" \ "Frequency (kHz)" \ "" "" "" "" "" \ *************** *** 108,111 **** --- 110,133 ---- "" "" "" "" "" "" "" "" \ "" "" "" "" "" "" "" \ + "Frequency (kHz)" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" \ + "Frequency (kHz)" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" "" \ + "" "" "" "" "" "" "" \ "Frequency (kHz)" ) *************** *** 120,124 **** "" \ "0 2 4 6 8 10" \ ! "" "" "" "" "" \ "0 4 8 12 16" \ "" "" "" "" "" \ --- 142,148 ---- "" \ "0 2 4 6 8 10" \ ! "" \ ! "0 3 6 9 12" \ ! "" "" "" \ "0 4 8 12 16" \ "" "" "" "" "" \ *************** *** 129,133 **** "" "" "" "" "" "" "" "" \ "" "" "" "" "" "" "" \ ! "0 16 32 48" ) set xx = ( "0 0.5" \ --- 153,177 ---- "" "" "" "" "" "" "" "" \ "" "" "" "" "" "" "" \ ! "0 16 32 48" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" \ ! "0 24 48 72 96" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" \ ! "0 48 96 144 192" ) set xx = ( "0 0.5" \ *************** *** 141,145 **** "" \ "0 10" \ ! "" "" "" "" "" \ "0 16" \ "" "" "" "" "" \ --- 185,191 ---- "" \ "0 10" \ ! "" \ ! "0 12" \ ! "" "" "" \ "0 16" \ "" "" "" "" "" \ *************** *** 150,154 **** "" "" "" "" "" "" "" "" \ "" "" "" "" "" "" "" \ ! "0 48" ) set xl = ( 0.5 \ --- 196,220 ---- "" "" "" "" "" "" "" "" \ "" "" "" "" "" "" "" \ ! "0 48" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" \ ! "0 96" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" \ ! "0 192" ) set xl = ( 0.5 \ *************** *** 162,166 **** "" \ 10 \ ! "" "" "" "" "" \ 16 \ "" "" "" "" "" \ --- 228,234 ---- "" \ 10 \ ! "" \ ! 12 \ ! "" "" "" \ 16 \ "" "" "" "" "" \ *************** *** 171,175 **** "" "" "" "" "" "" "" "" \ "" "" "" "" "" "" "" \ ! 48 ) set on_x = (25 60 95 130 165 200 235 270 305 340) --- 239,263 ---- "" "" "" "" "" "" "" "" \ "" "" "" "" "" "" "" \ ! 48 \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" \ ! 96 \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" "" \ ! "" "" "" "" "" "" "" \ ! 192 ) set on_x = (25 60 95 130 165 200 235 270 305 340) *************** *** 345,358 **** echo2 ' -x x : x scale [1]' if ( $help ) then ! echo2 ' 1 (Normalized frequency <0, 0.5>)' ! echo2 ' 2 (Normalized frequency <0, pi/2, pi>)' ! echo2 ' 4 (Frequency <0, 1, 2, 3, 4 kHz>)' ! echo2 ' 5 (Frequency <0, 1, 2, 3, 4, 5 kHz>)' ! echo2 ' 8 (Frequency <0, 2, 4, 6, 8 kHz>)' ! echo2 ' 10 (Frequency <0, 2, 4, 6, 8, 10 kHz>)' ! echo2 ' 16 (Frequency <0, 4, 8, 12, 16 kHz>)' ! echo2 ' 22 (Frequency <0, 11, 22 kHz>)' ! echo2 ' 24 (Frequency <0, 6, 12, 18, 24 kHz>)' ! echo2 ' 48 (Frequency <0, 16, 32, 48 kHz>)' endif echo2 ' -y ymin : y minimum [-100]' --- 433,449 ---- echo2 ' -x x : x scale [1]' if ( $help ) then ! echo2 ' 1 (Normalized frequency <0, 0.5>)' ! echo2 ' 2 (Normalized frequency <0, pi/2, pi>)' ! echo2 ' 4 (Frequency <0, 1, 2, 3, 4 kHz>)' ! echo2 ' 5 (Frequency <0, 1, 2, 3, 4, 5 kHz>)' ! echo2 ' 8 (Frequency <0, 2, 4, 6, 8 kHz>)' ! echo2 ' 10 (Frequency <0, 2, 4, 6, 8, 10 kHz>)' ! echo2 ' 12 (Frequency <0, 3, 6, 9, 12 kHz>)' ! echo2 ' 16 (Frequency <0, 4, 8, 12, 16 kHz>)' ! echo2 ' 22 (Frequency <0, 11, 22 kHz>)' ! echo2 ' 24 (Frequency <0, 6, 12, 18, 24 kHz>)' ! echo2 ' 48 (Frequency <0, 16, 32, 48 kHz>)' ! echo2 ' 96 (Frequency <0, 24, 48, 72, 96 kHz>)' ! echo2 ' 192 (Frequency <0, 48, 96,144,192 kHz>)' endif echo2 ' -y ymin : y minimum [-100]' |
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv7746 Modified Files: .clang-format Makefile excitation_generation.cc excitation_generation.h fast_fourier_transform.cc fast_fourier_transform.h fast_fourier_transform_for_real_sequence.cc fast_fourier_transform_for_real_sequence.h generalized_cepstrum_transform.cc generalized_cepstrum_transform.h input_source_from_array.h input_source_from_vector.h levdur.cc levinson_durbin_recursion.cc levinson_durbin_recursion.h m_sequence_generation.cc m_sequence_generation.h mgc2mgc.cc normal_distributed_random_value_generation.cc normal_distributed_random_value_generation.h random_generation_interface.h sptk_utils.cc sptk_utils.h Added Files: generalized_cepstrum_to_spectrum.cc generalized_cepstrum_to_spectrum.h mgc2sp.cc Log Message: add mgc2sp command Index: mgc2mgc.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mgc2mgc.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mgc2mgc.cc 16 Dec 2016 09:36:32 -0000 1.1 --- mgc2mgc.cc 26 Dec 2016 07:41:20 -0000 1.2 *************** *** 73,97 **** *stream << " mgc2mgc [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of mel-generalized cepstrum (input) [" << kDefaultInputNumOrder << "]" << std::endl; // NOLINT ! *stream << " -a a : alpha of mel-generalized cepstrum (input) [" << kDefaultInputAlpha << "]" << std::endl; // NOLINT ! *stream << " -g g : gamma of mel-generalized cepstrum (input) [" << kDefaultInputGamma << "]" << std::endl; // NOLINT *stream << " -c c : gamma of mel-generalized cepstrum = -1 / (int) c (input)" << std::endl; // NOLINT ! *stream << " -n : regard input as normalized mel-generalized cepstrum [" << sptk::ConvertBooleanToString(kDefaultInputNormalizationFlag) << "]" << std::endl; // NOLINT ! *stream << " -u : regard input as multiplied by gamma [" << sptk::ConvertBooleanToString(kDefaultInputMultiplicationFlag) << "]" << std::endl; // NOLINT ! *stream << " -M M : order of mel-generalized cepstrum (input) [" << kDefaultOutputNumOrder << "]" << std::endl; // NOLINT ! *stream << " -A A : alpha of mel-generalized cepstrum (input) [" << kDefaultOutputAlpha << "]" << std::endl; // NOLINT ! *stream << " -G G : gamma of mel-generalized cepstrum (input) [" << kDefaultOutputGamma << "]" << std::endl; // NOLINT ! *stream << " -C C : gamma of mel-generalized cepstrum = -1 / (int) C (input)" << std::endl; // NOLINT ! *stream << " -N : regard input as normalized mel-generalized cepstrum [" << sptk::ConvertBooleanToString(kDefaultOutputNormalizationFlag) << "]" << std::endl; // NOLINT ! *stream << " -U : regard input as multiplied by gamma [" << sptk::ConvertBooleanToString(kDefaultOutputMultiplicationFlag) << "]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " mel-generalized cepstrum (double) [stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; *stream << " transformed mel-generalized cepstrum (double)" << std::endl; // NOLINT *stream << " notice:" << std::endl; ! *stream << " value of c must be c >= 1 (double)" << std::endl; ! *stream << " if -u is used without -n, input is regarded as 1+g/c[0],g*c[1],...,g*c[m]" << std::endl; // NOLINT ! *stream << " if -U is used without -N, ouputput is regarded as 1+g/c[0],g*c[1],...,g*c[m]" << std::endl; // NOLINT *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; --- 73,97 ---- *stream << " mgc2mgc [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of mel-generalized cepstrum (input) [" << kDefaultInputNumOrder << "]" << std::endl; // NOLINT ! *stream << " -a a : alpha of mel-generalized cepstrum (input) [" << kDefaultInputAlpha << "]" << std::endl; // NOLINT ! *stream << " -g g : gamma of mel-generalized cepstrum (input) [" << kDefaultInputGamma << "]" << std::endl; // NOLINT *stream << " -c c : gamma of mel-generalized cepstrum = -1 / (int) c (input)" << std::endl; // NOLINT ! *stream << " -n : regard input as normalized mel-generalized cepstrum [" << sptk::ConvertBooleanToString(kDefaultInputNormalizationFlag) << "]" << std::endl; // NOLINT ! *stream << " -u : regard input as multiplied by gamma [" << sptk::ConvertBooleanToString(kDefaultInputMultiplicationFlag) << "]" << std::endl; // NOLINT ! *stream << " -M M : order of mel-generalized cepstrum (output) [" << kDefaultOutputNumOrder << "]" << std::endl; // NOLINT ! *stream << " -A A : alpha of mel-generalized cepstrum (output) [" << kDefaultOutputAlpha << "]" << std::endl; // NOLINT ! *stream << " -G G : gamma of mel-generalized cepstrum (output) [" << kDefaultOutputGamma << "]" << std::endl; // NOLINT ! *stream << " -C C : gamma of mel-generalized cepstrum = -1 / (int) C (output)" << std::endl; // NOLINT ! *stream << " -N : regard output as normalized mel-generalized cepstrum [" << sptk::ConvertBooleanToString(kDefaultOutputNormalizationFlag) << "]" << std::endl; // NOLINT ! *stream << " -U : regard output as multiplied by gamma [" << sptk::ConvertBooleanToString(kDefaultOutputMultiplicationFlag) << "]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " mel-generalized cepstrum (double) [stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; *stream << " transformed mel-generalized cepstrum (double)" << std::endl; // NOLINT *stream << " notice:" << std::endl; ! *stream << " value of c must be c >= 1" << std::endl; ! *stream << " if -u is used without -n, input is regarded as 1+g/mgc[0],g*mgc[1],...,g*mgc[m]" << std::endl; // NOLINT ! *stream << " if -U is used without -N, output is regarded as 1+g/mgc[0],g*mgc[1],...,g*mgc[m]" << std::endl; // NOLINT *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; *************** *** 250,254 **** if (!generalized_cepstrum_transform.IsValid()) { std::ostringstream error_message; ! error_message << "Failed to set the condition."; sptk::PrintErrorMessage("mgc2mgc", error_message); return 1; --- 250,254 ---- if (!generalized_cepstrum_transform.IsValid()) { std::ostringstream error_message; ! error_message << "Failed to set the condition"; sptk::PrintErrorMessage("mgc2mgc", error_message); return 1; Index: sptk_utils.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/sptk_utils.cc,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** sptk_utils.cc 12 Oct 2016 12:14:38 -0000 1.10 --- sptk_utils.cc 26 Dec 2016 07:41:20 -0000 1.11 *************** *** 171,176 **** } ! bool IsInRange(int value, int min, int max) { ! return (value < min || max < value) ? false : true; } --- 171,182 ---- } ! bool IsInRange(int num, int min, int max) { ! return (num < min || max < num); ! } ! ! // check whether a number is a power of two, 2^p where p is a non-negative ! // integer. ! bool IsPowerOfTwo(int num) { ! return !((num < 1) || (num & (num - 1))); } Index: Makefile =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/Makefile,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Makefile 22 Dec 2016 16:09:06 -0000 1.22 --- Makefile 26 Dec 2016 07:41:20 -0000 1.23 *************** *** 56,59 **** --- 56,60 ---- generalized_cepstrum_gain_normalization.cc \ generalized_cepstrum_inverse_gain_normalization.cc \ + generalized_cepstrum_to_spectrum.cc \ generalized_cepstrum_transform.cc \ input_source_from_array.cc \ Index: levinson_durbin_recursion.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/levinson_durbin_recursion.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** levinson_durbin_recursion.h 24 Oct 2016 08:20:30 -0000 1.5 --- levinson_durbin_recursion.h 26 Dec 2016 07:41:20 -0000 1.6 *************** *** 90,94 **** bool Run(const std::vector<double>& autocorrelation_sequence, std::vector<double>* linear_predictive_coefficients, ! LevinsonDurbinRecursion::Buffer* buffer, bool* is_stable) const; private: --- 90,94 ---- bool Run(const std::vector<double>& autocorrelation_sequence, std::vector<double>* linear_predictive_coefficients, ! bool* is_stable, LevinsonDurbinRecursion::Buffer* buffer) const; private: Index: levdur.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/levdur.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** levdur.cc 24 Nov 2016 04:16:55 -0000 1.5 --- levdur.cc 26 Dec 2016 07:41:20 -0000 1.6 *************** *** 193,197 **** bool is_stable(false); if (!recursion.Run(autocorrelation_sequence, ! &linear_predictive_coefficients, &buffer, &is_stable)) { std::ostringstream error_message; error_message << "Failed to solve an autocorrelation normal equation"; --- 193,197 ---- bool is_stable(false); if (!recursion.Run(autocorrelation_sequence, ! &linear_predictive_coefficients, &is_stable, &buffer)) { std::ostringstream error_message; error_message << "Failed to solve an autocorrelation normal equation"; --- NEW FILE: generalized_cepstrum_to_spectrum.h --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // // All rights reserved. // // // // Redistribution and use in source and binary forms, with or // // without modification, are permitted provided that the following // // conditions are met: // // // // - Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above // // copyright notice, this list of conditions and the following // // disclaimer in the documentation and/or other materials provided // // with the distribution. // // - Neither the name of the SPTK working group nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND // // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS // // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // ----------------------------------------------------------------- // #ifndef SPTK_SRC_GENERALIZED_CEPSTRUM_TO_SPECTRUM_H_ #define SPTK_SRC_GENERALIZED_CEPSTRUM_TO_SPECTRUM_H_ #include <vector> // std::vector #include "fast_fourier_transform_for_real_sequence.h" #include "generalized_cepstrum_transform.h" #include "sptk_utils.h" namespace sptk { class GeneralizedCepstrumToSpectrum { public: class Buffer { public: Buffer() { } virtual ~Buffer() { } private: GeneralizedCepstrumTransform::Buffer generalized_cepstrum_transform_buffer_; FastFourierTransformForRealSequence::Buffer fast_fourier_transform_buffer_; std::vector<double> cepstrum_; friend class GeneralizedCepstrumToSpectrum; DISALLOW_COPY_AND_ASSIGN(Buffer); }; // GeneralizedCepstrumToSpectrum(int num_order, double alpha, double gamma, bool is_normalized, bool is_multiplied, int fft_size); // virtual ~GeneralizedCepstrumToSpectrum() { } // int GetNumOrder() const { return generalized_cepstrum_transform_.GetNumInputOrder(); } // double GetAlpha() const { return generalized_cepstrum_transform_.GetInputAlpha(); } // double GetGamma() const { return generalized_cepstrum_transform_.GetInputGamma(); } // bool IsNormalized() const { return generalized_cepstrum_transform_.IsNormalizedInput(); } // bool IsMultiplied() const { return generalized_cepstrum_transform_.IsMultipliedInput(); } // int GetFftSize() const { return fast_fourier_transform_.GetFftSize(); } // bool IsValid() const { return is_valid_; } // bool Run(const std::vector<double>& generalized_cepstrum, std::vector<double>* amplitude_spectrum, std::vector<double>* phase_spectrum, GeneralizedCepstrumToSpectrum::Buffer* buffer) const; private: // const GeneralizedCepstrumTransform generalized_cepstrum_transform_; // const FastFourierTransformForRealSequence fast_fourier_transform_; // bool is_valid_; // DISALLOW_COPY_AND_ASSIGN(GeneralizedCepstrumToSpectrum); }; } // namespace sptk #endif // SPTK_SRC_GENERALIZED_CEPSTRUM_TO_SPECTRUM_H_ Index: normal_distributed_random_value_generation.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/normal_distributed_random_value_generation.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** normal_distributed_random_value_generation.h 24 Oct 2016 08:20:30 -0000 1.4 --- normal_distributed_random_value_generation.h 26 Dec 2016 07:41:20 -0000 1.5 *************** *** 67,71 **** // ! bool Get(double *output); private: --- 67,71 ---- // ! bool Get(double* output); private: Index: generalized_cepstrum_transform.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/generalized_cepstrum_transform.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** generalized_cepstrum_transform.h 16 Dec 2016 09:36:32 -0000 1.3 --- generalized_cepstrum_transform.h 26 Dec 2016 07:41:20 -0000 1.4 *************** *** 75,80 **** virtual bool IsValid() const = 0; virtual bool Run( ! const std::vector<double> &input, std::vector<double> *output, ! FrequencyTransform::Buffer *frequency_transform_buffer) const = 0; }; --- 75,80 ---- virtual bool IsValid() const = 0; virtual bool Run( ! const std::vector<double>& input, std::vector<double>* output, ! FrequencyTransform::Buffer* frequency_transform_buffer) const = 0; }; *************** *** 89,93 **** // virtual ~GeneralizedCepstrumTransform() { ! for (std::vector<GeneralizedCepstrumTransform::ModuleInterface *>::iterator itr(modules_.begin()); itr != modules_.end(); ++itr) { --- 89,93 ---- // virtual ~GeneralizedCepstrumTransform() { ! for (std::vector<GeneralizedCepstrumTransform::ModuleInterface*>::iterator itr(modules_.begin()); itr != modules_.end(); ++itr) { *************** *** 152,157 **** // ! bool Run(const std::vector<double> &input, std::vector<double> *output, ! GeneralizedCepstrumTransform::Buffer *buffer) const; private: --- 152,157 ---- // ! bool Run(const std::vector<double>& input, std::vector<double>* output, ! GeneralizedCepstrumTransform::Buffer* buffer) const; private: *************** *** 190,194 **** // ! std::vector<GeneralizedCepstrumTransform::ModuleInterface *> modules_; // --- 190,194 ---- // ! std::vector<GeneralizedCepstrumTransform::ModuleInterface*> modules_; // Index: input_source_from_vector.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/input_source_from_vector.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** input_source_from_vector.h 20 Dec 2016 08:23:42 -0000 1.2 --- input_source_from_vector.h 26 Dec 2016 07:41:20 -0000 1.3 *************** *** 46,50 **** #define SPTK_SRC_INPUT_SOURCE_FROM_VECTOR_H_ ! #include <vector> // std::vector #include "input_source_interface.h" --- 46,50 ---- #define SPTK_SRC_INPUT_SOURCE_FROM_VECTOR_H_ ! #include <vector> // std::vector #include "input_source_interface.h" Index: m_sequence_generation.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/m_sequence_generation.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** m_sequence_generation.cc 24 Oct 2016 08:20:30 -0000 1.6 --- m_sequence_generation.cc 26 Dec 2016 07:41:20 -0000 1.7 *************** *** 63,67 **** } ! bool MSequenceGeneration::Get(double *output) { // check output if (NULL == output) { --- 63,67 ---- } ! bool MSequenceGeneration::Get(double* output) { // check output if (NULL == output) { Index: fast_fourier_transform_for_real_sequence.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/fast_fourier_transform_for_real_sequence.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** fast_fourier_transform_for_real_sequence.h 22 Dec 2016 16:09:06 -0000 1.1 --- fast_fourier_transform_for_real_sequence.h 26 Dec 2016 07:41:20 -0000 1.2 *************** *** 83,87 **** // ! int GetFFTSize() const { return fft_size_; } --- 83,87 ---- // ! int GetFftSize() const { return fft_size_; } Index: levinson_durbin_recursion.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/levinson_durbin_recursion.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** levinson_durbin_recursion.cc 30 Nov 2016 04:23:28 -0000 1.7 --- levinson_durbin_recursion.cc 26 Dec 2016 07:41:20 -0000 1.8 *************** *** 53,57 **** const std::vector<double>& autocorrelation_sequence, std::vector<double>* linear_predictive_coefficients, ! LevinsonDurbinRecursion::Buffer* buffer, bool* is_stable) const { // check inputs if (autocorrelation_sequence.empty() || --- 53,57 ---- const std::vector<double>& autocorrelation_sequence, std::vector<double>* linear_predictive_coefficients, ! bool* is_stable, LevinsonDurbinRecursion::Buffer* buffer) const { // check inputs if (autocorrelation_sequence.empty() || Index: sptk_utils.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/sptk_utils.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** sptk_utils.h 12 Oct 2016 12:14:38 -0000 1.7 --- sptk_utils.h 26 Dec 2016 07:41:20 -0000 1.8 *************** *** 60,63 **** --- 60,65 ---- static const char* const kVersion("4.0"); + static const double kPi(3.141592653589793); + static const double kNp(8.685889638065035); // 1 Np = 20 / ln(10) dB bool ReadStream(double* data_to_read, std::istream* input_stream); *************** *** 71,75 **** bool ConvertStringToInteger(const std::string& input, int* output); bool ConvertStringToDouble(const std::string& input, double* output); ! bool IsInRange(int value, int min, int max); void PrintErrorMessage(const std::string& program_name, const std::ostringstream& message); --- 73,78 ---- bool ConvertStringToInteger(const std::string& input, int* output); bool ConvertStringToDouble(const std::string& input, double* output); ! bool IsInRange(int num, int min, int max); ! bool IsPowerOfTwo(int num); void PrintErrorMessage(const std::string& program_name, const std::ostringstream& message); --- NEW FILE: mgc2sp.cc --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // // All rights reserved. // // // // Redistribution and use in source and binary forms, with or // // without modification, are permitted provided that the following // // conditions are met: // // // // - Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above // // copyright notice, this list of conditions and the following // // disclaimer in the documentation and/or other materials provided // // with the distribution. // // - Neither the name of the SPTK working group nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND // // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS // // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // ----------------------------------------------------------------- // #include <unistd.h> #include <algorithm> #include <cmath> #include <fstream> #include <functional> #include <iostream> #include <sstream> #include <vector> #include "generalized_cepstrum_to_spectrum.h" #include "sptk_utils.h" namespace { enum OutputFormats { kLogAmplitudeSpectrumInDecibels = 0, kLogAmplitudeSpectrum, kAmplitudeSpectrum, kPowerSpectrum, kPhaseSpectrumInNormalizedRadians, kPhaseSpectrumInRadians, kPhaseSpectrumInDegrees, kNumOutputFormats }; const int kDefaultNumOrder(25); const double kDefaultAlpha(0.0); const double kDefaultGamma(0.0); const bool kDefaultNormalizationFlag(false); const bool kDefaultMultiplicationFlag(false); const int kDefaultFftSize(256); void PrintUsage(std::ostream* stream) { // clang-format off *stream << std::endl; *stream << " mgc2sp - transform mel-generalized cepstral to spectrum" << std::endl; // NOLINT *stream << std::endl; *stream << " usage:" << std::endl; *stream << " mgc2sp [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; *stream << " -m m : order of mel-generalized cepstrum [" << kDefaultNumOrder << "]" << std::endl; // NOLINT *stream << " -a a : alpha of mel-generalized cepstrum [" << kDefaultAlpha << "]" << std::endl; // NOLINT *stream << " -g g : gamma of mel-generalized cepstrum [" << kDefaultGamma << "]" << std::endl; // NOLINT *stream << " -c c : gamma of mel-generalized cepstrum = -1 / (int) c" << std::endl; // NOLINT *stream << " -n : regard input as normalized [" << sptk::ConvertBooleanToString(kDefaultNormalizationFlag) << "]" << std::endl; // NOLINT *stream << " mel-generalized cepstrum" << std::endl; *stream << " -u : regard input as multiplied by gamma [" << sptk::ConvertBooleanToString(kDefaultMultiplicationFlag) << "]" << std::endl; // NOLINT *stream << " -l l : FFT size [" << kDefaultFftSize << "]" << std::endl; // NOLINT *stream << " -o o : output format [0]" << std::endl; // NOLINT *stream << " 0 (20*log|H(z)|)" << std::endl; *stream << " 1 (ln|H(z)|)" << std::endl; *stream << " 2 (|H(z)|)" << std::endl; *stream << " 3 (|H(z)|^2)" << std::endl; *stream << " 4 (arg|H(z)|/pi)" << std::endl; *stream << " 5 (arg|H(z)|)" << std::endl; *stream << " 6 (arg|H(z)|*180/pi)" << std::endl; *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; *stream << " mel-generalized cepstrum (double) [stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; *stream << " spectrum (double)" << std::endl; *stream << " notice:" << std::endl; *stream << " value of c must be c >= 1" << std::endl; *stream << " if -u is used without -n, input is regarded as 1+g/mgc[0],g*mgc[1],...,g*mgc[m]" << std::endl; // NOLINT *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; *stream << std::endl; // clang-format on } } // namespace int main(int argc, char* argv[]) { int num_order(kDefaultNumOrder); double alpha(kDefaultAlpha); double gamma(kDefaultGamma); bool normalization_flag(kDefaultNormalizationFlag); bool multiplication_flag(kDefaultMultiplicationFlag); int fft_size(kDefaultFftSize); OutputFormats output_format(kLogAmplitudeSpectrumInDecibels); for (;;) { const char option_char(getopt(argc, argv, "m:a:g:c:nul:o:h")); if (-1 == option_char) break; switch (option_char) { case 'm': { if (!sptk::ConvertStringToInteger(optarg, &num_order) || num_order < 0) { std::ostringstream error_message; error_message << "The argument for the -m option must be a " << "non-negative integer"; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; } break; } case 'a': { if (!sptk::ConvertStringToDouble(optarg, &alpha)) { std::ostringstream error_message; error_message << "The argument for the -a option must be numeric"; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; } break; } case 'g': { if (!sptk::ConvertStringToDouble(optarg, &gamma)) { std::ostringstream error_message; error_message << "The argument for the -g option must be numeric"; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; } break; } case 'c': { int tmp; if (!sptk::ConvertStringToInteger(optarg, &tmp) || tmp < 1) { std::ostringstream error_message; error_message << "The argument for the -c option must be a " << "positive integer"; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; } gamma = -1.0 / tmp; break; } case 'n': { normalization_flag = true; break; } case 'u': { multiplication_flag = true; break; } case 'l': { if (!sptk::ConvertStringToInteger(optarg, &fft_size)) { std::ostringstream error_message; error_message << "The argument for the -l option must be an integer"; sptk::PrintErrorMessage("fft", error_message); return 1; } break; } case 'o': { int tmp; if (!sptk::ConvertStringToInteger(optarg, &tmp)) { std::ostringstream error_message; error_message << "The argument for the -o option must be an integer"; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; } const int min(0); const int max(static_cast<int>(kNumOutputFormats) - 1); if (!sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; error_message << "The argument for the -o option must be in range" << " (" << min << " .. " << max << ")"; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; } output_format = static_cast<OutputFormats>(tmp); break; } case 'h': { PrintUsage(&std::cout); return 0; } default: { PrintUsage(&std::cerr); return 1; } } } // get input file const char* input_file((optind < argc) ? argv[argc - 1] : NULL); // open stream std::ifstream ifs; ifs.open(input_file, std::ios::in | std::ios::binary); if (ifs.fail() && NULL != input_file) { std::ostringstream error_message; error_message << "Cannot open file " << input_file; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; } std::istream& input_stream(ifs.fail() ? std::cin : ifs); // prepare for gain normalization sptk::GeneralizedCepstrumToSpectrum generalized_cepstrum_to_spectrum( num_order, alpha, gamma, normalization_flag, multiplication_flag, fft_size); sptk::GeneralizedCepstrumToSpectrum::Buffer buffer; if (!generalized_cepstrum_to_spectrum.IsValid()) { std::ostringstream error_message; error_message << "Failed to set the condition"; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; } const int input_length(num_order + 1); const int output_length(fft_size / 2 + 1); std::vector<double> generalized_cepstrum(input_length); std::vector<double> amplitude_spectrum(fft_size); std::vector<double> phase_spectrum(fft_size); while (sptk::ReadStream(false, input_length, &generalized_cepstrum, &input_stream)) { // input modification if (!normalization_flag && multiplication_flag) { (*generalized_cepstrum.begin()) = (*(generalized_cepstrum.begin()) - 1.0) / gamma; } // transform if (!generalized_cepstrum_to_spectrum.Run(generalized_cepstrum, &litude_spectrum, &phase_spectrum, &buffer)) { std::ostringstream error_message; error_message << "Failed to transform"; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; } switch (output_format) { case kLogAmplitudeSpectrumInDecibels: { std::transform(amplitude_spectrum.begin(), amplitude_spectrum.begin() + output_length, amplitude_spectrum.begin(), std::bind1st(std::multiplies<double>(), sptk::kNp)); break; } case kLogAmplitudeSpectrum: { // nothing to do break; } case kAmplitudeSpectrum: { std::transform(amplitude_spectrum.begin(), amplitude_spectrum.begin() + output_length, amplitude_spectrum.begin(), std::ptr_fun<double, double>(std::exp)); break; } case kPowerSpectrum: { std::transform(amplitude_spectrum.begin(), amplitude_spectrum.begin() + output_length, amplitude_spectrum.begin(), std::ptr_fun<double, double>( [](double x) { return std::exp(2.0 * x); })); break; } case kPhaseSpectrumInNormalizedRadians: { std::transform( phase_spectrum.begin(), phase_spectrum.begin() + output_length, phase_spectrum.begin(), std::bind1st(std::multiplies<double>(), 1.0 / sptk::kPi)); break; } case kPhaseSpectrumInRadians: { // nothing to do break; } case kPhaseSpectrumInDegrees: { std::transform( phase_spectrum.begin(), phase_spectrum.begin() + output_length, phase_spectrum.begin(), std::bind1st(std::multiplies<double>(), 180.0 / sptk::kPi)); break; } default: { break; } } switch (output_format) { case kLogAmplitudeSpectrumInDecibels: case kLogAmplitudeSpectrum: case kAmplitudeSpectrum: case kPowerSpectrum: { if (!sptk::WriteStream(output_length, amplitude_spectrum, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write amplitude spectrum"; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; } break; } case kPhaseSpectrumInNormalizedRadians: case kPhaseSpectrumInRadians: case kPhaseSpectrumInDegrees: { if (!sptk::WriteStream(output_length, phase_spectrum, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write phase spectrum"; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; } break; } default: { break; } } } return 0; } Index: fast_fourier_transform.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/fast_fourier_transform.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** fast_fourier_transform.h 24 Oct 2016 08:20:30 -0000 1.7 --- fast_fourier_transform.h 26 Dec 2016 07:41:20 -0000 1.8 *************** *** 55,60 **** public: // ! FastFourierTransform() : num_dimension_(0), inverse_(false) { ! } // --- 55,59 ---- public: // ! FastFourierTransform(int num_order, int fft_size, bool inverse); // *************** *** 62,76 **** } - // Set the number of dimensions and prepare the sine table. - bool SetNumDimension(int num_dimension); - // ! void SetInverseFlag(bool inverse) { ! inverse_ = inverse; } // ! int GetNumDimension() const { ! return num_dimension_; } --- 61,72 ---- } // ! int GetNumOrder() const { ! return num_order_; } // ! int GetFftSize() const { ! return fft_size_; } *************** *** 81,84 **** --- 77,85 ---- // + bool IsValid() const { + return is_valid_; + } + + // bool Run(const std::vector<double>& real_part_input, const std::vector<double>& imaginary_part_input, *************** *** 88,95 **** private: // ! int num_dimension_; // ! bool inverse_; // --- 89,105 ---- private: // ! const int num_order_; // ! const int fft_size_; ! ! // ! const int half_fft_size_; ! ! // ! const bool inverse_; ! ! // ! bool is_valid_; // Index: excitation_generation.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/excitation_generation.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** excitation_generation.h 24 Oct 2016 08:20:30 -0000 1.5 --- excitation_generation.h 26 Dec 2016 07:41:20 -0000 1.6 *************** *** 55,60 **** public: // ! ExcitationGeneration(InputSourceInterpolationWithMagicNumber *input_source, ! RandomGenerationInterface *random_generation); // --- 55,60 ---- public: // ! ExcitationGeneration(InputSourceInterpolationWithMagicNumber* input_source, ! RandomGenerationInterface* random_generation); // *************** *** 68,79 **** // ! bool Get(double *excitation, double *pulse, double *noise, double *pitch); private: // ! InputSourceInterpolationWithMagicNumber *input_source_; // ! RandomGenerationInterface *random_generation_; // --- 68,79 ---- // ! bool Get(double* excitation, double* pulse, double* noise, double* pitch); private: // ! InputSourceInterpolationWithMagicNumber* input_source_; // ! RandomGenerationInterface* random_generation_; // Index: fast_fourier_transform.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/fast_fourier_transform.cc,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** fast_fourier_transform.cc 30 Nov 2016 04:23:28 -0000 1.10 --- fast_fourier_transform.cc 26 Dec 2016 07:41:20 -0000 1.11 *************** *** 51,73 **** namespace sptk { ! bool FastFourierTransform::SetNumDimension(const int num_dimension) { ! if (num_dimension < 4 || num_dimension & (num_dimension - 1)) { ! return false; } ! const int table_size(num_dimension - num_dimension / 4 + 1); ! const double argument(M_PI / num_dimension * 2); ! ! if (sine_table_.size() != static_cast<std::size_t>(table_size)) { ! sine_table_.resize(table_size); ! for (int i(0); i < table_size; ++i) { ! sine_table_[i] = std::sin(argument * i); ! } ! sine_table_[num_dimension / 2] = 0.0; } ! ! num_dimension_ = num_dimension; ! ! return true; } --- 51,74 ---- namespace sptk { ! FastFourierTransform::FastFourierTransform(int num_order, int fft_size, ! bool inverse) ! : num_order_(num_order), ! fft_size_(fft_size), ! half_fft_size_(fft_size / 2), ! inverse_(inverse), ! is_valid_(true) { ! if (fft_size < 4 || !IsPowerOfTwo(fft_size) || fft_size <= num_order || ! num_order < 0) { ! is_valid_ = false; ! return; } ! const int table_size(fft_size - fft_size / 4 + 1); ! const double argument(sptk::kPi / fft_size * 2); ! sine_table_.resize(table_size); ! for (int i(0); i < table_size; ++i) { ! sine_table_[i] = std::sin(argument * i); } ! sine_table_[fft_size / 2] = 0.0; } *************** *** 77,97 **** std::vector<double>* real_part_output, std::vector<double>* imaginary_part_output) const { ! // check sine table and input ! if (sine_table_.empty() || NULL == real_part_output || ! NULL == imaginary_part_output) { return false; } // prepare memories ! if (real_part_output->size() != static_cast<std::size_t>(num_dimension_)) { ! real_part_output->resize(num_dimension_); ! } ! if (imaginary_part_output->size() != ! static_cast<std::size_t>(num_dimension_)) { ! imaginary_part_output->resize(num_dimension_); } ! if (real_part_output->size() < real_part_input.size() || ! imaginary_part_output->size() < imaginary_part_input.size()) { ! return false; } --- 78,95 ---- std::vector<double>* real_part_output, std::vector<double>* imaginary_part_output) const { ! // check inputs ! if (!is_valid_ || ! real_part_input.size() != static_cast<std::size_t>(num_order_ + 1) || ! imaginary_part_input.size() != static_cast<std::size_t>(num_order_ + 1) || ! NULL == real_part_output || NULL == imaginary_part_output) { return false; } // prepare memories ! if (real_part_output->size() < static_cast<std::size_t>(fft_size_)) { ! real_part_output->resize(fft_size_); } ! if (imaginary_part_output->size() < static_cast<std::size_t>(fft_size_)) { ! imaginary_part_output->resize(fft_size_); } *************** *** 106,135 **** imaginary_part_output->end(), 0.0); ! double* x; ! double* y; ! if (inverse_) { ! x = &((*imaginary_part_output)[0]); ! y = &((*real_part_output)[0]); ! } else { ! x = &((*real_part_output)[0]); ! y = &((*imaginary_part_output)[0]); ! } ! ! // set values ! const int half_num_dimension(num_dimension_ / 2); ! const int dec_num_dimension(num_dimension_ - 1); ! const double inverse_num_dimension(1.0 / num_dimension_); ! int lix(num_dimension_); ! int lmx(half_num_dimension); int lf(1); - while (1 < lmx) { double* sinp(const_cast<double*>(&(sine_table_[0]))); ! double* cosp(const_cast<double*>(&(sine_table_[0])) + num_dimension_ / 4); for (int i(0); i < lmx; ++i) { double* xpi(&(x[i])); double* ypi(&(y[i])); ! for (int li(lix); li <= num_dimension_; li += lix) { const double t1(*(xpi) - *(xpi + lmx)); const double t2(*(ypi) - *(ypi + lmx)); --- 104,122 ---- imaginary_part_output->end(), 0.0); ! double* x(inverse_ ? &((*imaginary_part_output)[0]) ! : &((*real_part_output)[0])); ! double* y(inverse_ ? &((*real_part_output)[0]) ! : &((*imaginary_part_output)[0])); ! int lix(fft_size_); ! int lmx(half_fft_size_); int lf(1); while (1 < lmx) { double* sinp(const_cast<double*>(&(sine_table_[0]))); ! double* cosp(const_cast<double*>(&(sine_table_[0])) + fft_size_ / 4); for (int i(0); i < lmx; ++i) { double* xpi(&(x[i])); double* ypi(&(y[i])); ! for (int li(lix); li <= fft_size_; li += lix) { const double t1(*(xpi) - *(xpi + lmx)); const double t2(*(ypi) - *(ypi + lmx)); *************** *** 151,156 **** double* xp(x); double* yp(y); ! ! for (int li(half_num_dimension); li--; xp += 2, yp += 2) { const double t1(*(xp) - *(xp + 1)); const double t2(*(yp) - *(yp + 1)); --- 138,142 ---- double* xp(x); double* yp(y); ! for (int li(half_fft_size_); li--; xp += 2, yp += 2) { const double t1(*(xp) - *(xp + 1)); const double t2(*(yp) - *(yp + 1)); *************** *** 161,169 **** } xp = x; yp = y; ! ! // bit reversal ! for (int lmx(0), j(0); lmx < dec_num_dimension; ++lmx) { const int lmxj(lmx - j); if (lmxj < 0) { --- 147,155 ---- } + // bit reversal xp = x; yp = y; ! const int dec_fft_size(fft_size_ - 1); ! for (int lmx(0), j(0); lmx < dec_fft_size; ++lmx) { const int lmxj(lmx - j); if (lmxj < 0) { *************** *** 176,180 **** } ! int li(half_num_dimension); while (li <= j) { j -= li; --- 162,166 ---- } ! int li(half_fft_size_); while (li <= j) { j -= li; *************** *** 190,196 **** xp = x; yp = y; ! for (int i(0); i < num_dimension_; ++i) { ! *(xp + i) *= inverse_num_dimension; ! *(yp + i) *= inverse_num_dimension; } } --- 176,183 ---- xp = x; yp = y; ! const double inverse_fft_size(1.0 / fft_size_); ! for (int i(0); i < fft_size_; ++i) { ! *xp++ *= inverse_fft_size; ! *yp++ *= inverse_fft_size; } } Index: m_sequence_generation.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/m_sequence_generation.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** m_sequence_generation.h 24 Oct 2016 08:20:30 -0000 1.5 --- m_sequence_generation.h 26 Dec 2016 07:41:20 -0000 1.6 *************** *** 64,68 **** // ! virtual bool Get(double *output); private: --- 64,68 ---- // ! virtual bool Get(double* output); private: Index: generalized_cepstrum_transform.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/generalized_cepstrum_transform.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** generalized_cepstrum_transform.cc 16 Dec 2016 09:36:31 -0000 1.4 --- generalized_cepstrum_transform.cc 26 Dec 2016 07:41:20 -0000 1.5 *************** *** 65,70 **** } virtual bool Run( ! const std::vector<double> &input, std::vector<double> *output, ! sptk::FrequencyTransform::Buffer *frequency_transform_buffer) const { if (!generalized_cepstrum_gain_normalization_.Run(input, output)) { return false; --- 65,70 ---- } virtual bool Run( ! const std::vector<double>& input, std::vector<double>* output, ! sptk::FrequencyTransform::Buffer* frequency_transform_buffer) const { if (!generalized_cepstrum_gain_normalization_.Run(input, output)) { return false; *************** *** 90,95 **** } virtual bool Run( ! const std::vector<double> &input, std::vector<double> *output, ! sptk::FrequencyTransform::Buffer *frequency_transform_buffer) const { if (!generalized_cepstrum_inverse_gain_normalization_.Run(input, output)) { return false; --- 90,95 ---- } virtual bool Run( ! const std::vector<double>& input, std::vector<double>* output, ! sptk::FrequencyTransform::Buffer* frequency_transform_buffer) const { if (!generalized_cepstrum_inverse_gain_normalization_.Run(input, output)) { return false; *************** *** 118,123 **** } virtual bool Run( ! const std::vector<double> &input, std::vector<double> *output, ! sptk::FrequencyTransform::Buffer *frequency_transform_buffer) const { if (!frequency_transform_.Run(input, output, frequency_transform_buffer)) { return false; --- 118,123 ---- } virtual bool Run( ! const std::vector<double>& input, std::vector<double>* output, ! sptk::FrequencyTransform::Buffer* frequency_transform_buffer) const { if (!frequency_transform_.Run(input, output, frequency_transform_buffer)) { return false; *************** *** 146,156 **** } virtual bool Run( ! const std::vector<double> &input, std::vector<double> *output, ! sptk::FrequencyTransform::Buffer *frequency_transform_buffer) const { if (output->size() != static_cast<std::size_t>(num_output_order_ + 1)) { output->resize(num_output_order_ + 1); } ! const double *c1(&(input)[0]); ! double *c2(&((*output)[0])); c2[0] = c1[0]; --- 146,156 ---- } virtual bool Run( ! const std::vector<double>& input, std::vector<double>* output, ! sptk::FrequencyTransform::Buffer* frequency_transform_buffer) const { if (output->size() != static_cast<std::size_t>(num_output_order_ + 1)) { output->resize(num_output_order_ + 1); } ! const double* c1(&(input)[0]); ! double* c2(&((*output)[0])); c2[0] = c1[0]; *************** *** 191,196 **** } virtual bool Run( ! const std::vector<double> &input, std::vector<double> *output, ! sptk::FrequencyTransform::Buffer *frequency_transform_buffer) const { if (output->size() != static_cast<std::size_t>(num_order_ + 1)) { output->resize(num_order_ + 1); --- 191,196 ---- } virtual bool Run( ! const std::vector<double>& input, std::vector<double>* output, ! sptk::FrequencyTransform::Buffer* frequency_transform_buffer) const { if (output->size() != static_cast<std::size_t>(num_order_ + 1)) { output->resize(num_order_ + 1); *************** *** 220,225 **** } virtual bool Run( ! const std::vector<double> &input, std::vector<double> *output, ! sptk::FrequencyTransform::Buffer *frequency_transform_buffer) const { if (output->size() != static_cast<std::size_t>(num_order_ + 1)) { output->resize(num_order_ + 1); --- 220,225 ---- } virtual bool Run( ! const std::vector<double>& input, std::vector<double>* output, ! sptk::FrequencyTransform::Buffer* frequency_transform_buffer) const { if (output->size() != static_cast<std::size_t>(num_order_ + 1)) { output->resize(num_order_ + 1); *************** *** 404,408 **** } ! for (std::vector<GeneralizedCepstrumTransform::ModuleInterface *>::iterator itr(modules_.begin()); itr != modules_.end(); ++itr) { --- 404,408 ---- } ! for (std::vector<GeneralizedCepstrumTransform::ModuleInterface*>::iterator itr(modules_.begin()); itr != modules_.end(); ++itr) { *************** *** 415,420 **** bool GeneralizedCepstrumTransform::Run( ! const std::vector<double> &input, std::vector<double> *output, ! GeneralizedCepstrumTransform::Buffer *buffer) const { if (!is_valid_ || static_cast<std::size_t>(num_input_order_ + 1) != input.size() || --- 415,420 ---- bool GeneralizedCepstrumTransform::Run( ! const std::vector<double>& input, std::vector<double>* output, ! GeneralizedCepstrumTransform::Buffer* buffer) const { if (!is_valid_ || static_cast<std::size_t>(num_input_order_ + 1) != input.size() || *************** *** 431,436 **** } ! for (std::vector<GeneralizedCepstrumTransform::ModuleInterface ! *>::const_iterator itr(modules_.begin()); itr != modules_.end(); ++itr) { if (itr != modules_.begin()) { --- 431,436 ---- } ! for (std::vector<GeneralizedCepstrumTransform::ModuleInterface*>:: ! const_iterator itr(modules_.begin()); itr != modules_.end(); ++itr) { if (itr != modules_.begin()) { Index: normal_distributed_random_value_generation.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/normal_distributed_random_value_generation.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** normal_distributed_random_value_generation.cc 12 Oct 2016 12:14:38 -0000 1.4 --- normal_distributed_random_value_generation.cc 26 Dec 2016 07:41:20 -0000 1.5 *************** *** 50,54 **** // pseudorandom generation ! double PseudoRandomGeneration(std::uint64_t *next) { if (NULL == next) { return 0.0; --- 50,54 ---- // pseudorandom generation ! double PseudoRandomGeneration(std::uint64_t* next) { if (NULL == next) { return 0.0; *************** *** 76,80 **** } ! bool NormalDistributedRandomValueGeneration::Get(double *output) { // check output if (NULL == output) { --- 76,80 ---- } ! bool NormalDistributedRandomValueGeneration::Get(double* output) { // check output if (NULL == output) { Index: random_generation_interface.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/random_generation_interface.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** random_generation_interface.h 24 Oct 2016 08:20:30 -0000 1.2 --- random_generation_interface.h 26 Dec 2016 07:41:20 -0000 1.3 *************** *** 60,64 **** // ! virtual bool Get(double *output) = 0; }; --- 60,64 ---- // ! virtual bool Get(double* output) = 0; }; Index: excitation_generation.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/excitation_generation.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** excitation_generation.cc 12 Oct 2016 12:14:38 -0000 1.4 --- excitation_generation.cc 26 Dec 2016 07:41:20 -0000 1.5 *************** *** 51,56 **** ExcitationGeneration::ExcitationGeneration( ! InputSourceInterpolationWithMagicNumber *input_source, ! RandomGenerationInterface *random_generation) : input_source_(input_source), random_generation_(random_generation), --- 51,56 ---- ExcitationGeneration::ExcitationGeneration( ! InputSourceInterpolationWithMagicNumber* input_source, ! RandomGenerationInterface* random_generation) : input_source_(input_source), random_generation_(random_generation), *************** *** 63,68 **** } ! bool ExcitationGeneration::Get(double *excitation, double *pulse, double *noise, ! double *pitch) { if (!is_valid_) { return false; --- 63,68 ---- } ! bool ExcitationGeneration::Get(double* excitation, double* pulse, double* noise, ! double* pitch) { if (!is_valid_) { return false; Index: .clang-format =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/.clang-format,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** .clang-format 24 Oct 2016 08:20:30 -0000 1.2 --- .clang-format 26 Dec 2016 07:41:20 -0000 1.3 *************** *** 2,3 **** --- 2,5 ---- AllowShortBlocksOnASingleLine: false AllowShortFunctionsOnASingleLine: false + DerivePointerAlignment: false + PointerAlignment: Left --- NEW FILE: generalized_cepstrum_to_spectrum.cc --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // // All rights reserved. // // // // Redistribution and use in source and binary forms, with or // // without modification, are permitted provided that the following // // conditions are met: // // // // - Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above // // copyright notice, this list of conditions and the following // // disclaimer in the documentation and/or other materials provided // // with the distribution. // // - Neither the name of the SPTK working group nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND // // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS // // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // ----------------------------------------------------------------- // #include "generalized_cepstrum_to_spectrum.h" namespace sptk { GeneralizedCepstrumToSpectrum::GeneralizedCepstrumToSpectrum( int num_order, double alpha, double gamma, bool is_normalized, bool is_multiplied, int fft_size) : generalized_cepstrum_transform_(num_order, alpha, gamma, is_normalized, is_multiplied, fft_size / 2, 0.0, 0.0, false, false), fast_fourier_transform_(fft_size / 2, fft_size, false), is_valid_(true) { if (!generalized_cepstrum_transform_.IsValid() || !fast_fourier_transform_.IsValid()) { is_valid_ = false; } } bool GeneralizedCepstrumToSpectrum::Run( const std::vector<double>& generalized_cepstrum, std::vector<double>* amplitude_spectrum, std::vector<double>* phase_spectrum, GeneralizedCepstrumToSpectrum::Buffer* buffer) const { if (!is_valid_ || generalized_cepstrum.size() != static_cast<std::size_t>(GetNumOrder() + 1) || NULL == amplitude_spectrum || NULL == phase_spectrum || NULL == buffer) { return false; } if (!generalized_cepstrum_transform_.Run( generalized_cepstrum, &buffer->cepstrum_, &buffer->generalized_cepstrum_transform_buffer_) || !fast_fourier_transform_.Run(buffer->cepstrum_, amplitude_spectrum, phase_spectrum, &buffer->fast_fourier_transform_buffer_)) { return false; } return true; } } // namespace sptk Index: fast_fourier_transform_for_real_sequence.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/fast_fourier_transform_for_real_sequence.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** fast_fourier_transform_for_real_sequence.cc 22 Dec 2016 16:09:06 -0000 1.1 -... [truncated message content] |
From: Keiichiro O. <ur...@us...> - 2016-12-25 05:10:50
|
Update of /cvsroot/sp-tk/SPTK/src/bin/vc/hts_engine_API In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv4108/bin/vc/hts_engine_API Modified Files: COPYING HTS_engine.h HTS_hidden.h HTS_misc.c HTS_pstream.c HTS_sstream.c Log Message: revert copyright of hts_engine API Index: HTS_engine.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/vc/hts_engine_API/HTS_engine.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** HTS_engine.h 22 Dec 2016 15:28:26 -0000 1.8 --- HTS_engine.h 25 Dec 2016 05:10:48 -0000 1.9 *************** *** 5,9 **** /* ----------------------------------------------------------------- */ /* */ ! /* Copyright (c) 2001-2016 Nagoya Institute of Technology */ /* Department of Computer Science */ /* */ --- 5,9 ---- /* ----------------------------------------------------------------- */ /* */ ! /* Copyright (c) 2001-2015 Nagoya Institute of Technology */ /* Department of Computer Science */ /* */ *************** *** 76,80 **** /* copyright ------------------------------------------------------- */ ! #define HTS_COPYRIGHT "The HMM-Based Speech Synthesis Engine \"hts_engine API\"\nVersion 1.10 (http://hts-engine.sourceforge.net/)\nCopyright (C) 2001-2016 Nagoya Institute of Technology\n 2001-2008 Tokyo Institute of Technology\nAll rights reserved.\n" /* audio ----------------------------------------------------------- */ --- 76,80 ---- /* copyright ------------------------------------------------------- */ ! #define HTS_COPYRIGHT "The HMM-Based Speech Synthesis Engine \"hts_engine API\"\nVersion 1.10 (http://hts-engine.sourceforge.net/)\nCopyright (C) 2001-2015 Nagoya Institute of Technology\n 2001-2008 Tokyo Institute of Technology\nAll rights reserved.\n" /* audio ----------------------------------------------------------- */ Index: HTS_misc.c =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/vc/hts_engine_API/HTS_misc.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** HTS_misc.c 22 Dec 2016 10:53:14 -0000 1.6 --- HTS_misc.c 25 Dec 2016 05:10:48 -0000 1.7 *************** *** 5,9 **** /* ----------------------------------------------------------------- */ /* */ ! /* Copyright (c) 2001-2016 Nagoya Institute of Technology */ /* Department of Computer Science */ /* */ --- 5,9 ---- /* ----------------------------------------------------------------- */ /* */ ! /* Copyright (c) 2001-2015 Nagoya Institute of Technology */ /* Department of Computer Science */ /* */ Index: HTS_pstream.c =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/vc/hts_engine_API/HTS_pstream.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** HTS_pstream.c 22 Dec 2016 10:53:14 -0000 1.7 --- HTS_pstream.c 25 Dec 2016 05:10:48 -0000 1.8 *************** *** 5,9 **** /* ----------------------------------------------------------------- */ /* */ ! /* Copyright (c) 2001-2016 Nagoya Institute of Technology */ /* Department of Computer Science */ /* */ --- 5,9 ---- /* ----------------------------------------------------------------- */ /* */ ! /* Copyright (c) 2001-2015 Nagoya Institute of Technology */ /* Department of Computer Science */ /* */ Index: HTS_hidden.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/vc/hts_engine_API/HTS_hidden.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** HTS_hidden.h 22 Dec 2016 10:53:14 -0000 1.7 --- HTS_hidden.h 25 Dec 2016 05:10:48 -0000 1.8 *************** *** 5,9 **** /* ----------------------------------------------------------------- */ /* */ ! /* Copyright (c) 2001-2016 Nagoya Institute of Technology */ /* Department of Computer Science */ /* */ --- 5,9 ---- /* ----------------------------------------------------------------- */ /* */ ! /* Copyright (c) 2001-2015 Nagoya Institute of Technology */ /* Department of Computer Science */ /* */ Index: HTS_sstream.c =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/vc/hts_engine_API/HTS_sstream.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** HTS_sstream.c 22 Dec 2016 10:53:14 -0000 1.8 --- HTS_sstream.c 25 Dec 2016 05:10:48 -0000 1.9 *************** *** 5,9 **** /* ----------------------------------------------------------------- */ /* */ ! /* Copyright (c) 2001-2016 Nagoya Institute of Technology */ /* Department of Computer Science */ /* */ --- 5,9 ---- /* ----------------------------------------------------------------- */ /* */ ! /* Copyright (c) 2001-2015 Nagoya Institute of Technology */ /* Department of Computer Science */ /* */ Index: COPYING =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/vc/hts_engine_API/COPYING,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** COPYING 22 Dec 2016 10:53:14 -0000 1.5 --- COPYING 25 Dec 2016 05:10:48 -0000 1.6 *************** *** 5,9 **** /* ----------------------------------------------------------------- */ /* */ ! /* Copyright (c) 2001-2016 Nagoya Institute of Technology */ /* Department of Computer Science */ /* */ --- 5,9 ---- /* ----------------------------------------------------------------- */ /* */ ! /* Copyright (c) 2001-2015 Nagoya Institute of Technology */ /* Department of Computer Science */ /* */ |
From: Keiichiro O. <ur...@us...> - 2016-12-25 05:00:50
|
Update of /cvsroot/sp-tk/SPTK/src/bin/acep In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv3489/src/bin/acep Modified Files: acep.c Log Message: format source code using indent command Index: acep.c =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/acep/acep.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** acep.c 22 Dec 2016 10:52:59 -0000 1.31 --- acep.c 25 Dec 2016 05:00:18 -0000 1.32 *************** *** 158,163 **** FILE *fp = stdin, *fpe = NULL; Boolean aveflag = AVEFLAG; ! double lambda = LAMBDA, step = STEP, tau = TAU, eps = EPS, ! *c, *avec, x; if ((cmnd = strrchr(argv[0], '/')) == NULL) --- 158,162 ---- FILE *fp = stdin, *fpe = NULL; Boolean aveflag = AVEFLAG; ! double lambda = LAMBDA, step = STEP, tau = TAU, eps = EPS, *c, *avec, x; if ((cmnd = strrchr(argv[0], '/')) == NULL) |
From: Keiichiro O. <ur...@us...> - 2016-12-25 05:00:22
|
Update of /cvsroot/sp-tk/SPTK/src/bin/root_pol In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv3489/src/bin/root_pol Modified Files: root_pol.c Log Message: format source code using indent command Index: root_pol.c =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/root_pol/root_pol.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** root_pol.c 22 Dec 2016 10:53:11 -0000 1.28 --- root_pol.c 25 Dec 2016 05:00:20 -0000 1.29 *************** *** 70,74 **** ************************************************************************/ ! static char *rcs_id = "$Id$"; --- 70,75 ---- ************************************************************************/ ! static char *rcs_id = ! "$Id$"; |
From: Keiichiro O. <ur...@us...> - 2016-12-25 05:00:21
|
Update of /cvsroot/sp-tk/SPTK/src/bin/ignorm In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv3489/src/bin/ignorm Modified Files: ignorm.c Log Message: format source code using indent command Index: ignorm.c =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/ignorm/ignorm.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** ignorm.c 22 Dec 2016 10:53:05 -0000 1.29 --- ignorm.c 25 Dec 2016 05:00:19 -0000 1.30 *************** *** 67,71 **** ************************************************************************/ ! static char *rcs_id = "$Id$"; --- 67,72 ---- ************************************************************************/ ! static char *rcs_id = ! "$Id$"; |
From: Keiichiro O. <ur...@us...> - 2016-12-25 05:00:20
|
Update of /cvsroot/sp-tk/SPTK/src/bin/extract In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv3489/src/bin/extract Modified Files: extract.c Log Message: format source code using indent command Index: extract.c =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/extract/extract.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** extract.c 22 Dec 2016 10:53:03 -0000 1.28 --- extract.c 25 Dec 2016 05:00:18 -0000 1.29 *************** *** 65,69 **** ************************************************************************/ ! static char *rcs_id = "$Id$"; --- 65,70 ---- ************************************************************************/ ! static char *rcs_id = ! "$Id$"; |
From: Takenori Y. <tak...@us...> - 2016-12-22 16:09:09
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv28419 Modified Files: Makefile fft.cc ifft.cc Added Files: fast_fourier_transform_for_real_sequence.cc fast_fourier_transform_for_real_sequence.h Log Message: add class of FFT for real sequence Index: ifft.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/ifft.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ifft.cc 12 Oct 2016 12:14:38 -0000 1.5 --- ifft.cc 22 Dec 2016 16:09:07 -0000 1.6 *************** *** 140,153 **** } - // check FFT size - sptk::FastFourierTransform fft; - if (!fft.SetNumDimension(fft_size)) { - std::ostringstream error_message; - error_message << "The FFT size must be a power of 2 and greater than 2"; - sptk::PrintErrorMessage("ifft", error_message); - return 1; - } - fft.SetInverseFlag(true); - // get input file const char* input_file((optind < argc) ? argv[argc - 1] : NULL); --- 140,143 ---- *************** *** 164,167 **** --- 154,166 ---- std::istream& input_stream(ifs.fail() ? std::cin : ifs); + // prepare for fast Fourier transform + sptk::FastFourierTransform fft(fft_size - 1, fft_size, true); + if (!fft.IsValid()) { + std::ostringstream error_message; + error_message << "FFT size must be a power of 2 and greater than 2"; + sptk::PrintErrorMessage("ifft", error_message); + return 1; + } + std::vector<double> input_x(fft_size); std::vector<double> input_y(fft_size); --- NEW FILE: fast_fourier_transform_for_real_sequence.h --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // // All rights reserved. // // // // Redistribution and use in source and binary forms, with or // // without modification, are permitted provided that the following // // conditions are met: // // // // - Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above // // copyright notice, this list of conditions and the following // // disclaimer in the documentation and/or other materials provided // // with the distribution. // // - Neither the name of the SPTK working group nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND // // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS // // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // ----------------------------------------------------------------- // #ifndef SPTK_SRC_FAST_FOURIER_TRANSFORM_FOR_REAL_SEQUENCE_H_ #define SPTK_SRC_FAST_FOURIER_TRANSFORM_FOR_REAL_SEQUENCE_H_ #include <vector> // std::vector #include "fast_fourier_transform.h" #include "sptk_utils.h" namespace sptk { class FastFourierTransformForRealSequence { public: class Buffer { public: Buffer() { } virtual ~Buffer() { } private: std::vector<double> real_part_input_; std::vector<double> imaginary_part_input_; friend class FastFourierTransformForRealSequence; DISALLOW_COPY_AND_ASSIGN(Buffer); }; // FastFourierTransformForRealSequence(int num_order, int fft_size, bool inverse); // virtual ~FastFourierTransformForRealSequence() { } // int GetNumOrder() const { return num_order_; } // int GetFFTSize() const { return fft_size_; } // bool GetInverseFlag() const { return inverse_; } // bool IsValid() const { return is_valid_; } // bool Run(const std::vector<double>& real_part_input, std::vector<double>* real_part_output, std::vector<double>* imaginary_part_output, FastFourierTransformForRealSequence::Buffer* buffer) const; private: // const int num_order_; // const int fft_size_; // const int half_fft_size_; // const bool inverse_; // const FastFourierTransform fast_fourier_transform_; // bool is_valid_; // std::vector<double> sine_table_; // DISALLOW_COPY_AND_ASSIGN(FastFourierTransformForRealSequence); }; } // namespace sptk #endif // SPTK_SRC_FAST_FOURIER_TRANSFORM_FOR_REAL_SEQUENCE_H_ Index: Makefile =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/Makefile,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Makefile 20 Dec 2016 08:23:42 -0000 1.21 --- Makefile 22 Dec 2016 16:09:06 -0000 1.22 *************** *** 52,55 **** --- 52,56 ---- excitation_generation.cc \ fast_fourier_transform.cc \ + fast_fourier_transform_for_real_sequence.cc \ frequency_transform.cc \ generalized_cepstrum_gain_normalization.cc \ --- NEW FILE: fast_fourier_transform_for_real_sequence.cc --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // // All rights reserved. // // // // Redistribution and use in source and binary forms, with or // // without modification, are permitted provided that the following // // conditions are met: // // // // - Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above // // copyright notice, this list of conditions and the following // // disclaimer in the documentation and/or other materials provided // // with the distribution. // // - Neither the name of the SPTK working group nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND // // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS // // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // ----------------------------------------------------------------- // #include "fast_fourier_transform_for_real_sequence.h" #include <algorithm> // std::fill #include <cmath> // std::sin #include <cstddef> // std::size_t namespace sptk { FastFourierTransformForRealSequence::FastFourierTransformForRealSequence( int num_order, int fft_size, bool inverse) : num_order_(num_order), fft_size_(fft_size), half_fft_size_(fft_size / 2), inverse_(inverse), fast_fourier_transform_(half_fft_size_ - 1, half_fft_size_, false), is_valid_(true) { if (!fast_fourier_transform_.IsValid() || fft_size <= num_order || num_order < 0) { is_valid_ = false; return; } const int table_size(fft_size - fft_size / 4 + 1); const double argument(M_PI / fft_size * 2); sine_table_.resize(table_size); for (int i(0); i < table_size; ++i) { sine_table_[i] = std::sin(argument * i); } sine_table_[fft_size / 2] = 0.0; } bool FastFourierTransformForRealSequence::Run( const std::vector<double>& real_part_input, std::vector<double>* real_part_output, std::vector<double>* imaginary_part_output, FastFourierTransformForRealSequence::Buffer* buffer) const { // check inputs if (!is_valid_ || real_part_input.size() != static_cast<std::size_t>(num_order_ + 1) || NULL == real_part_output || NULL == imaginary_part_output || NULL == buffer) { return false; } // prepare memories if (buffer->real_part_input_.size() != static_cast<std::size_t>(half_fft_size_)) { buffer->real_part_input_.resize(half_fft_size_); } if (buffer->imaginary_part_input_.size() != static_cast<std::size_t>(half_fft_size_)) { buffer->imaginary_part_input_.resize(half_fft_size_); } if (real_part_output->size() < static_cast<std::size_t>(fft_size_)) { real_part_output->resize(fft_size_); } if (imaginary_part_output->size() < static_cast<std::size_t>(fft_size_)) { imaginary_part_output->resize(fft_size_); } // get values and fill zero const int input_size(num_order_ + 1); for (int i(0), j(0); i < input_size; ++j) { buffer->real_part_input_[j] = real_part_input[i++]; if (input_size <= i) break; buffer->imaginary_part_input_[j] = real_part_input[i++]; } std::fill(buffer->real_part_input_.begin() + (input_size + 1) / 2, buffer->real_part_input_.end(), 0.0); std::fill(buffer->imaginary_part_input_.begin() + input_size / 2, buffer->imaginary_part_input_.end(), 0.0); // run fast Fourier transform if (!fast_fourier_transform_.Run(buffer->real_part_input_, buffer->imaginary_part_input_, real_part_output, imaginary_part_output)) { return false; } double* x(&((*real_part_output)[0])); double* y(&((*imaginary_part_output)[0])); double* xp(x); double* yp(y); double* xq(xp + fft_size_); double* yq(yp + fft_size_); *(xp + half_fft_size_) = *xp - *yp; *xp = *xp + *yp; *(yp + half_fft_size_) = 0; *yp = 0; double* sinp(const_cast<double*>(&(sine_table_[0]))); double* cosp(const_cast<double*>(&(sine_table_[0])) + fft_size_ / 4); for (int i(1), j(half_fft_size_ - 2); i < half_fft_size_; ++i, j -= 2) { ++xp; ++yp; ++sinp; ++cosp; const double xt(*xp - *(xp + j)); const double yt(*yp + *(yp + j)); *(--xq) = (*xp + *(xp + j) + *cosp * yt - *sinp * xt) * 0.5; *(--yq) = (-*yp + *(yp + j) + *sinp * yt + *cosp * xt) * 0.5; } xp = x + 1; yp = y + 1; xq = x + fft_size_; yq = y + fft_size_; for (int i(1); i < half_fft_size_; ++i) { *xp++ = *(--xq); *yp++ = -(*(--yq)); } if (inverse_) { xp = x; yp = y; const double inverse_fft_size(1.0 / fft_size_); for (int i(0); i < fft_size_; ++i) { *xp++ *= inverse_fft_size; *yp++ *= inverse_fft_size; } } return true; } } // namespace sptk Index: fft.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/fft.cc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** fft.cc 12 Oct 2016 12:14:38 -0000 1.9 --- fft.cc 22 Dec 2016 16:09:07 -0000 1.10 *************** *** 160,173 **** } - // check FFT size - sptk::FastFourierTransform fft; - if (!fft.SetNumDimension(fft_size)) { - std::ostringstream error_message; - error_message << "The FFT size must be a power of 2 and greater than 2"; - sptk::PrintErrorMessage("fft", error_message); - return 1; - } - fft.SetInverseFlag(false); - // check order if (is_num_order_specified) { --- 160,163 ---- *************** *** 197,200 **** --- 187,199 ---- std::istream& input_stream(ifs.fail() ? std::cin : ifs); + // prepare for fast Fourier transform + sptk::FastFourierTransform fft(num_order, fft_size, false); + if (!fft.IsValid()) { + std::ostringstream error_message; + error_message << "FFT size must be a power of 2 and greater than 2"; + sptk::PrintErrorMessage("fft", error_message); + return 1; + } + const int length(num_order + 1); std::vector<double> input_x(length); *************** *** 207,211 **** if (!fft.Run(input_x, input_y, &output_x, &output_y)) { std::ostringstream error_message; ! error_message << "Failed to run the fast Fourier transform"; sptk::PrintErrorMessage("fft", error_message); return 1; --- 206,210 ---- if (!fft.Run(input_x, input_y, &output_x, &output_y)) { std::ostringstream error_message; ! error_message << "Failed to run fast Fourier transform"; sptk::PrintErrorMessage("fft", error_message); return 1; |