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
|
From: fujishita t. <fjs...@us...> - 2017-07-10 04:40:43
|
Update of /cvsroot/sp-tk/SPTK/doc/ref_e In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv30637 Modified Files: norm0.tex Log Message: modify manual of norm0 command Index: norm0.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/norm0.tex,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** norm0.tex 22 Dec 2016 10:52:58 -0000 1.21 --- norm0.tex 10 Jul 2017 04:40:41 -0000 1.22 *************** *** 54,64 **** sending the result to standard output. ! For the input sequence \begin{displaymath} ! x(0), x(1), \dots, x(M), \end{displaymath} ! the normalized output sequence is \begin{displaymath} ! 1/x(0), x(1)/x(0), \dots, x(M)/x(0). \end{displaymath} --- 54,76 ---- sending the result to standard output. ! If the input data is a set of coefficients ! $b(0), b(1), \dots, b(M)$ of an all zero digital filter, \begin{displaymath} ! H(z) = \sum_{m=0}^{M} b(m) z^{-m}, \end{displaymath} ! the output data will be a set of coefficients ! $K, a(1), \dots, a(M)$ of an all pole digital filter: ! \begin{align} ! H(z) &= \frac{\displaystyle{\frac{1}{b(0)}}}{\displaystyle{1+\sum_{m=1}^{M}\frac{b(m)}{b(0)}z^{-m}}} \notag \\ ! &\equiv \frac{K}{\displaystyle{1+\sum_{m=1}^{M}a(m)z^{-m}}} \notag ! \end{align} ! Conversely, when a set of coefficients of an all pole digital filter is inputted, a set of coefficients of an all zero digital filter will be outputted. ! In this case, the input sequence \begin{displaymath} ! K, a(1), \dots, a(M) ! \end{displaymath} ! is normalized as follows. ! \begin{displaymath} ! 1/K, a(1)/K, \dots, a(M)/K \end{displaymath} *************** *** 71,80 **** \begin{qsection}{EXAMPLE} ! Speech data is read from {\em data.f} in float format, ! the 15-th order autocorrelation coefficients are evaluated ! and normalized, and the results is written to {\em data.nacorr}: \begin{quote} ! \verb!frame < data.f | window | acorr -m 15 |\ !\\ ! \verb!norm0 -m 15 > data.nacorr! \end{quote} \end{qsection} --- 83,89 ---- \begin{qsection}{EXAMPLE} ! In the example below, 15-th order coefficients of an all zero digital filter in float format are read from {\em data.z}, and then the coefficients of an all pole digital filter are written to {\em data.p}: \begin{quote} ! \verb!norm0 -m 15 data.z > data.p! \end{quote} \end{qsection} |
From: Natsumi K. <koi...@us...> - 2017-06-23 10:05:08
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv13773 Modified Files: ignorm.cc mgc2sp.cc nrand.cc Log Message: update usage of ignorm, mgc2sp and nrand Index: nrand.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/nrand.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** nrand.cc 22 Jun 2017 06:25:50 -0000 1.6 --- nrand.cc 23 Jun 2017 10:05:06 -0000 1.7 *************** *** 67,75 **** *stream << " nrand [ options ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -l l : output length ( int)[" << std::setw(5) << std::right << kDefaultOutputLength << "][ <= l <= ]" << std::endl; // NOLINT ! *stream << " -s s : seed ( int)[" << std::setw(5) << std::right << kDefaultSeed << "][ <= s <= ]" << std::endl; // NOLINT ! *stream << " -m m : mean (double)[" << std::setw(5) << std::right << kDefaultMean << "][ <= m <= ]" << std::endl; // NOLINT ! *stream << " -v v : variance (double)[" << std::setw(5) << std::right << kDefaultStandardDeviation * kDefaultStandardDeviation << "][ <= v <= ]" << std::endl; // NOLINT ! *stream << " -d d : standard deviation (double)[" << std::setw(5) << std::right << kDefaultStandardDeviation << "][ <= d <= ]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " stdout:" << std::endl; --- 67,75 ---- *stream << " nrand [ options ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -l l : output length ( int)[" << std::setw(5) << std::right << kDefaultOutputLength << "][ <= l <= ]" << std::endl; // NOLINT ! *stream << " -s s : seed ( int)[" << std::setw(5) << std::right << kDefaultSeed << "][ <= s <= ]" << std::endl; // NOLINT ! *stream << " -m m : mean (double)[" << std::setw(5) << std::right << kDefaultMean << "][ <= m <= ]" << std::endl; // NOLINT ! *stream << " -v v : variance (double)[" << std::setw(5) << std::right << kDefaultStandardDeviation * kDefaultStandardDeviation << "][ 0.0 <= v <= ]" << std::endl; // NOLINT ! *stream << " -d d : standard deviation (double)[" << std::setw(5) << std::right << kDefaultStandardDeviation << "][ 0.0 <= d <= ]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " stdout:" << std::endl; Index: ignorm.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/ignorm.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ignorm.cc 22 Jun 2017 06:25:50 -0000 1.6 --- ignorm.cc 23 Jun 2017 10:05:06 -0000 1.7 *************** *** 68,72 **** *stream << " -m m : order of generalized cepstrum ( int)[" << std::setw(5) << std::right << kDefaultNumOrder << "][ 0 <= m <= ]" << std::endl; // NOLINT *stream << " -g g : gamma (double)[" << std::setw(5) << std::right << kDefaultGamma << "][ <= g <= ]" << std::endl; // NOLINT ! *stream << " -c c : gamma = -1 / c ( int)[" << std::setw(5) << std::right << "N/A" << "][ 1 <= c <= ]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; --- 68,72 ---- *stream << " -m m : order of generalized cepstrum ( int)[" << std::setw(5) << std::right << kDefaultNumOrder << "][ 0 <= m <= ]" << std::endl; // NOLINT *stream << " -g g : gamma (double)[" << std::setw(5) << std::right << kDefaultGamma << "][ <= g <= ]" << std::endl; // NOLINT ! *stream << " -c c : gamma = -1 / c ( int)[" << std::setw(5) << std::right << "N/A" << "][ 1 <= c <= ]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; Index: mgc2sp.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mgc2sp.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** mgc2sp.cc 22 Jun 2017 06:25:50 -0000 1.7 --- mgc2sp.cc 23 Jun 2017 10:05:06 -0000 1.8 *************** *** 92,96 **** *stream << " mel-generalized cepstrum" << std::endl; *stream << " -u : regard input as multiplied by gamma ( bool)[" << std::setw(5) << std::right << sptk::ConvertBooleanToString(kDefaultMultiplicationFlag) << "]" << std::endl; // NOLINT ! *stream << " -l l : FFT size ( int)[" << std::setw(5) << std::right << kDefaultFftSize << "][ <= l <= ]" << std::endl; // NOLINT *stream << " -o o : output format ( int)[" << std::setw(5) << std::right << kDefaultOutputFormat << "][ 0 <= o <= 6 ]" << std::endl; // NOLINT *stream << " 0 (20*log|H(z)|)" << std::endl; --- 92,96 ---- *stream << " mel-generalized cepstrum" << std::endl; *stream << " -u : regard input as multiplied by gamma ( bool)[" << std::setw(5) << std::right << sptk::ConvertBooleanToString(kDefaultMultiplicationFlag) << "]" << std::endl; // NOLINT ! *stream << " -l l : FFT size ( int)[" << std::setw(5) << std::right << kDefaultFftSize << "][ 8 <= l <= ]" << std::endl; // NOLINT *stream << " -o o : output format ( int)[" << std::setw(5) << std::right << kDefaultOutputFormat << "][ 0 <= o <= 6 ]" << std::endl; // NOLINT *stream << " 0 (20*log|H(z)|)" << std::endl; |
From: fujishita t. <fjs...@us...> - 2017-06-23 05:44:36
|
Update of /cvsroot/sp-tk/SPTK/doc/ref_e In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv12049 Modified Files: Makefile.in main.tex Added Files: csm2lpc.tex Log Message: add reference of csm2lpc command Index: Makefile.in =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/Makefile.in,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** Makefile.in 2 Feb 2017 07:19:14 -0000 1.34 --- Makefile.in 23 Jun 2017 05:44:34 -0000 1.35 *************** *** 68,71 **** --- 68,72 ---- cdist.tex \ clip.tex \ + csm2lpc.tex \ da.tex \ dct.tex \ --- NEW FILE: csm2lpc.tex --- % ----------------------------------------------------------------- % % 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. % % ----------------------------------------------------------------- % \hypertarget{csm2lpc}{} \name{csm2lpc}{transform CSM to LPC}{speech parameter transformation} \begin{synopsis} \item [csm2lpc] [ --m $M$ ] [ --f $F$ ] [ {\em infile} ] \end{synopsis} \begin{qsection}{DESCRIPTION} {\em csm2lpc} calculates linear prediction coefficients (LPC) from $M$-th order composite sinusoidal modeling (CSM) parameters from {\em infile} (or standard input), sending the result to standard output. The CSM input format is \begin{displaymath} \omega(1), \dots , \omega\biggl(\frac{M+1}{2}\biggr), m(1), \dots , m\biggl(\frac{M+1}{2}\biggr). \end{displaymath} The autocorrelation function $v(l)$ is obtained from the CSM parameters: \begin{displaymath} v(l)=\sum_{i=1}^{\frac{M+1}{2}}m(i)\cos(l\cdot\omega(i)), \qquad l=0,1,\dots,M, \end{displaymath} By solving the autocorrelation matrix consists of $v(l)$ using the Levinson-Durbin algorithm (see \hyperlink{levdur}{levdur}), the corresponding LPC are obtained as \begin{displaymath} K , a(1), \dots , a(M). \end{displaymath} \end{qsection} \begin{options} \argm{m}{M}{order of LPC}{25} \argm{f}{F}{minimum value of the determinant of the normal matrix}{0} \end{options} \begin{qsection}{EXAMPLE} In the example below, 15-th order CSM coefficients in float format are read from {\em data.csm}, and then the LPC are written to {\em data.lpc}: \begin{quote} \verb! csm2lpc -m 15 data.csm > data.lpc! \end{quote} \end{qsection} \begin{qsection}{SEE ALSO} \hyperlink{lpc}{lpc}, \hyperlink{levdur}{levdur} \end{qsection} Index: main.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/main.tex,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** main.tex 2 Feb 2017 07:19:15 -0000 1.56 --- main.tex 23 Jun 2017 05:44:34 -0000 1.57 *************** *** 183,186 **** --- 183,187 ---- \include{cdist} \include{clip} + \include{csm2lpc} \include{da} %\include{dawrite} |
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv32625 Modified Files: acorr.cc b2mc.cc c2mpir.cc c2ndps.cc decimate.cc excite.cc fft.cc fftr.cc gnorm.cc ifft.cc ignorm.cc iulaw.cc levdur.cc lpc.cc lpc2c.cc lpc2lsp.cc lpc2par.cc lsp2lpc.cc ltcdf.cc mc2b.cc merge.cc mgc2mgc.cc mgc2sp.cc mglsp2sp.cc mseq.cc nan.cc ndps2c.cc nrand.cc par2lpc.cc poledf.cc ulaw.cc window.cc zerodf.cc Log Message: update usage Index: mgc2mgc.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mgc2mgc.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** mgc2mgc.cc 2 May 2017 07:25:40 -0000 1.8 --- mgc2mgc.cc 22 Jun 2017 06:25:50 -0000 1.9 *************** *** 45,48 **** --- 45,49 ---- #include <getopt.h> #include <fstream> + #include <iomanip> #include <iostream> #include <sstream> *************** *** 73,96 **** *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 << " 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 --- 74,95 ---- *stream << " mgc2mgc [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of mel-generalized cepstrum (input) ( int)[" << std::setw(5) << std::right << kDefaultInputNumOrder << "][ 0 <= m <= ]" << std::endl; // NOLINT ! *stream << " -a a : alpha of mel-generalized cepstrum (input) (double)[" << std::setw(5) << std::right << kDefaultInputAlpha << "][ <= a <= ]" << std::endl; // NOLINT ! *stream << " -g g : gamma of mel-generalized cepstrum (input) (double)[" << std::setw(5) << std::right << kDefaultInputGamma << "][ <= g <= ]" << std::endl; // NOLINT ! *stream << " -c c : gamma of mel-generalized cepstrum = -1 / c (input) ( int)[" << std::setw(5) << std::right << "N/A" << "][ 1 <= c <= ]" << std::endl; // NOLINT ! *stream << " -n : regard input as normalized mel-generalized cepstrum ( bool)[" << std::setw(5) << std::right << sptk::ConvertBooleanToString(kDefaultInputNormalizationFlag) << "]" << std::endl; // NOLINT ! *stream << " -u : regard input as multiplied by gamma ( bool)[" << std::setw(5) << std::right << sptk::ConvertBooleanToString(kDefaultInputMultiplicationFlag) << "]" << std::endl; // NOLINT ! *stream << " -M M : order of mel-generalized cepstrum (output) ( int)[" << std::setw(5) << std::right << kDefaultOutputNumOrder << "][ 0 <= M <= ]" << std::endl; // NOLINT ! *stream << " -A A : alpha of mel-generalized cepstrum (output) (double)[" << std::setw(5) << std::right << kDefaultOutputAlpha << "][ <= A <= ]" << std::endl; // NOLINT ! *stream << " -G G : gamma of mel-generalized cepstrum (output) (double)[" << std::setw(5) << std::right << kDefaultOutputGamma << "][ <= G <= ]" << std::endl; // NOLINT ! *stream << " -C C : gamma of mel-generalized cepstrum = -1 / C (output) ( int)[" << std::setw(5) << std::right << "N/A" << "][ 1 <= C <= ]" << std::endl; // NOLINT ! *stream << " -N : regard output as normalized mel-generalized cepstrum ( bool)[" << std::setw(5) << std::right << sptk::ConvertBooleanToString(kDefaultOutputNormalizationFlag) << "]" << std::endl; // NOLINT ! *stream << " -U : regard output as multiplied by gamma ( bool)[" << std::setw(5) << std::right << 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 << " 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 Index: lpc2par.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/lpc2par.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** lpc2par.cc 2 May 2017 07:10:22 -0000 1.4 --- lpc2par.cc 22 Jun 2017 06:25:50 -0000 1.5 *************** *** 45,48 **** --- 45,49 ---- #include <getopt.h> #include <fstream> + #include <iomanip> #include <iostream> #include <sstream> *************** *** 74,81 **** *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 [" << kDefaultBehaviorForUnstableCoefficients << "]" << std::endl; // NOLINT *stream << " coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; --- 75,82 ---- *stream << " lpc2par [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of linear predictive coefficients ( int)[" << std::setw(5) << std::right << kDefaultNumOrder << "][ 0 <= m <= ]" << std::endl; // NOLINT ! *stream << " -g g : gamma of generalized cepstrum (double)[" << std::setw(5) << std::right << kDefaultGamma << "][ <= g <= ]" << std::endl; // NOLINT ! *stream << " -c c : gamma of generalized cepstrum = -1 / c ( int)[" << std::setw(5) << std::right << "N/A" << "][ 1 <= c <= ]" << std::endl; // NOLINT ! *stream << " -e e : check whether the derived PARCOR ( int)[" << std::setw(5) << std::right << kDefaultBehaviorForUnstableCoefficients << "][ 0 <= e <= 2 ]" << std::endl; // NOLINT *stream << " coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; *************** *** 87,95 **** *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; --- 88,94 ---- *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; // NOLINT *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; Index: par2lpc.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/par2lpc.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** par2lpc.cc 23 Jan 2017 05:19:34 -0000 1.1 --- par2lpc.cc 22 Jun 2017 06:25:50 -0000 1.2 *************** *** 45,48 **** --- 45,49 ---- #include <unistd.h> #include <fstream> + #include <iomanip> #include <iostream> #include <sstream> *************** *** 64,73 **** *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; --- 65,74 ---- *stream << " par2lpc [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of linear predictive coefficients ( int)[" << std::setw(5) << std::right << kDefaultNumOrder << "][ 0 <= m <= ]" << 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; // NOLINT *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; *************** *** 136,141 **** 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( --- 137,142 ---- std::vector<double> linear_predictive_coefficients(length); ! for (int frame_index(0); sptk::ReadStream( ! false, 0, 0, length, &parcor_coefficients, &input_stream); ++frame_index) { if (!parcor_coefficients_to_linear_predictive_coefficients.Run( *************** *** 148,152 **** } ! if (!sptk::WriteStream(length, linear_predictive_coefficients, &std::cout)) { std::ostringstream error_message; --- 149,153 ---- } ! if (!sptk::WriteStream(0, length, linear_predictive_coefficients, &std::cout)) { std::ostringstream error_message; Index: nrand.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/nrand.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** nrand.cc 15 Mar 2017 13:38:04 -0000 1.5 --- nrand.cc 22 Jun 2017 06:25:50 -0000 1.6 *************** *** 45,48 **** --- 45,49 ---- #include <getopt.h> #include <cmath> // std::sqrt + #include <iomanip> #include <iostream> #include <sstream> *************** *** 66,77 **** *stream << " nrand [ options ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -l l : output length [" << kDefaultOutputLength << "]" << std::endl; // NOLINT ! *stream << " -s s : seed [" << kDefaultSeed << "]" << std::endl; // NOLINT ! *stream << " -m m : mean [" << kDefaultMean << "]" << std::endl; // NOLINT ! *stream << " -v v : variance [" << kDefaultStandardDeviation * kDefaultStandardDeviation << "]" << std::endl; // NOLINT ! *stream << " -d d : standard deviation [" << kDefaultStandardDeviation << "]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " stdout:" << std::endl; ! *stream << " random values (double)" << std::endl; *stream << " notice:" << std::endl; *stream << " if l < 0, generate infinite sequence" << std::endl; --- 67,78 ---- *stream << " nrand [ options ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -l l : output length ( int)[" << std::setw(5) << std::right << kDefaultOutputLength << "][ <= l <= ]" << std::endl; // NOLINT ! *stream << " -s s : seed ( int)[" << std::setw(5) << std::right << kDefaultSeed << "][ <= s <= ]" << std::endl; // NOLINT ! *stream << " -m m : mean (double)[" << std::setw(5) << std::right << kDefaultMean << "][ <= m <= ]" << std::endl; // NOLINT ! *stream << " -v v : variance (double)[" << std::setw(5) << std::right << kDefaultStandardDeviation * kDefaultStandardDeviation << "][ <= v <= ]" << std::endl; // NOLINT ! *stream << " -d d : standard deviation (double)[" << std::setw(5) << std::right << kDefaultStandardDeviation << "][ <= d <= ]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " stdout:" << std::endl; ! *stream << " random values (double)" << std::endl; *stream << " notice:" << std::endl; *stream << " if l < 0, generate infinite sequence" << std::endl; Index: acorr.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/acorr.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** acorr.cc 15 Mar 2017 13:38:04 -0000 1.5 --- acorr.cc 22 Jun 2017 06:25:50 -0000 1.6 *************** *** 45,48 **** --- 45,49 ---- #include <getopt.h> #include <fstream> + #include <iomanip> #include <iostream> #include <sstream> *************** *** 65,75 **** *stream << " acorr [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -l l : frame length [" << kDefaultFrameLength << "]" << std::endl; // NOLINT ! *stream << " -m m : order of sequence [" << kDefaultNumOrder << "]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " data sequence (double) [stdin]" << std::endl; *stream << " stdout:" << std::endl; ! *stream << " autocorrelation sequence (double)" << std::endl; *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; --- 66,76 ---- *stream << " acorr [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -l l : frame length ( int)[" << std::setw(5) << std::right << kDefaultFrameLength << "][ 0 < l <= ]" << std::endl; // NOLINT ! *stream << " -m m : order of sequence ( int)[" << std::setw(5) << std::right << kDefaultNumOrder << "][ 0 <= m <= ]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " data sequence (double)[stdin]" << std::endl; *stream << " stdout:" << std::endl; ! *stream << " autocorrelation sequence (double)" << std::endl; *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; Index: levdur.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/levdur.cc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** levdur.cc 15 Mar 2017 13:38:04 -0000 1.9 --- levdur.cc 22 Jun 2017 06:25:50 -0000 1.10 *************** *** 45,48 **** --- 45,49 ---- #include <getopt.h> #include <fstream> + #include <iomanip> #include <iostream> #include <sstream> *************** *** 75,82 **** *stream << " levdur [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of autocorrelation [" << kDefaultNumOrder << "]" << std::endl; // NOLINT ! *stream << " -f f : minimum value of the determinant of [" << kDefaultEpsilon << "]" << std::endl; // NOLINT *stream << " normal matrix" << std::endl; ! *stream << " -e e : check whether the derived linear [" << kDefaultBehaviorForUnstableCoefficients << "]" << std::endl; // NOLINT *stream << " predictive coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; --- 76,83 ---- *stream << " levdur [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of autocorrelation ( int)[" << std::setw(5) << std::right << kDefaultNumOrder << "][ 0 <= m <= ]" << std::endl; // NOLINT ! *stream << " -f f : minimum value of the determinant of (double)[" << std::setw(5) << std::right << kDefaultEpsilon << "][ 0.0 <= f <= ]" << std::endl; // NOLINT *stream << " normal matrix" << std::endl; ! *stream << " -e e : check whether the derived linear ( int)[" << std::setw(5) << std::right << kDefaultBehaviorForUnstableCoefficients << "][ 0 <= e <= 2 ]" << std::endl; // NOLINT *stream << " predictive coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; *************** *** 88,94 **** *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " autocorrelation sequence (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; --- 89,95 ---- *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " autocorrelation sequence (double)[stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; ! *stream << " linear predictive coefficients (double)" << std::endl; // NOLINT *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; Index: ndps2c.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/ndps2c.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ndps2c.cc 19 Jun 2017 04:52:58 -0000 1.1 --- ndps2c.cc 22 Jun 2017 06:25:50 -0000 1.2 *************** *** 66,70 **** *stream << " ndps2c [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -l l : FFT size ( int)[" << std::setw(5) << std::right << kDefaultFftSize << "][ 4 <= l <= ]" << std::endl; // NOLINT *stream << " -m m : order of cepstrum ( int)[" << std::setw(5) << std::right << kDefaultNumOrder << "][ 0 <= m <= l/2 ]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; --- 66,70 ---- *stream << " ndps2c [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -l l : FFT size ( int)[" << std::setw(5) << std::right << kDefaultFftSize << "][ 8 <= l <= ]" << std::endl; // NOLINT *stream << " -m m : order of cepstrum ( int)[" << std::setw(5) << std::right << kDefaultNumOrder << "][ 0 <= m <= l/2 ]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; Index: iulaw.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/iulaw.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** iulaw.cc 22 May 2017 03:44:10 -0000 1.1 --- iulaw.cc 22 Jun 2017 06:25:50 -0000 1.2 *************** *** 45,48 **** --- 45,49 ---- #include <getopt.h> #include <fstream> + #include <iomanip> #include <iostream> #include <sstream> *************** *** 65,75 **** *stream << " iulaw [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -v v : absolute maximum of input [" << kDefaultAbsoluteMaxValue << "]" << std::endl; // NOLINT ! *stream << " -u u : compression factor [" << kDefaultCompressionFactor << "]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " input sequence (double) [stdin]" << std::endl; *stream << " stdout:" << std::endl; ! *stream << " decompressed sequence (double)" << std::endl; *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; --- 66,76 ---- *stream << " iulaw [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -v v : absolute maximum of input (double)[" << std::setw(5) << std::right << kDefaultAbsoluteMaxValue << "][ 0.0 < v <= ]" << std::endl; // NOLINT ! *stream << " -u u : compression factor ( int)[" << std::setw(5) << std::right << kDefaultCompressionFactor << "][ 0 < u <= ]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " input sequence (double)[stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; ! *stream << " decompressed sequence (double)" << std::endl; *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; Index: lpc.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/lpc.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** lpc.cc 15 Mar 2017 13:38:04 -0000 1.8 --- lpc.cc 22 Jun 2017 06:25:50 -0000 1.9 *************** *** 45,48 **** --- 45,49 ---- #include <getopt.h> #include <fstream> + #include <iomanip> #include <iostream> #include <sstream> *************** *** 76,84 **** *stream << " lpc [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -l l : frame length [" << kDefaultFrameLength << "]" << std::endl; // NOLINT ! *stream << " -m m : order of linear predictive coefficients [" << kDefaultNumOrder << "]" << std::endl; // NOLINT ! *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 [" << kDefaultBehaviorForUnstableCoefficients << "]" << std::endl; // NOLINT *stream << " predictive coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; --- 77,85 ---- *stream << " lpc [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -l l : frame length ( int)[" << std::setw(5) << std::right << kDefaultFrameLength << "][ 0 < l <= ]" << std::endl; // NOLINT ! *stream << " -m m : order of linear predictive coefficients ( int)[" << std::setw(5) << std::right << kDefaultNumOrder << "][ 0 <= m <= ]" << std::endl; // NOLINT ! *stream << " -f f : minimum value of the determinant of (double)[" << std::setw(5) << std::right << kDefaultEpsilon << "][ 0.0 <= f <= ]" << std::endl; // NOLINT *stream << " the normal matrix" << std::endl; ! *stream << " -e e : check whether the derived linear ( int)[" << std::setw(5) << std::right << kDefaultBehaviorForUnstableCoefficients << "][ 0 <= e <= 2 ]" << std::endl; // NOLINT *stream << " predictive coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; *************** *** 90,96 **** *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " windowed sequence (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; --- 91,97 ---- *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " windowed sequence (double)[stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; ! *stream << " linear predictive coefficients (double)" << std::endl; // NOLINT *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; Index: ifft.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/ifft.cc,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ifft.cc 19 Jun 2017 04:52:58 -0000 1.10 --- ifft.cc 22 Jun 2017 06:25:50 -0000 1.11 *************** *** 45,48 **** --- 45,49 ---- #include <getopt.h> #include <fstream> + #include <iomanip> #include <iostream> #include <sstream> *************** *** 72,77 **** *stream << " ifft [ options ] [ infile ] > stdout" << std::endl; *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; --- 73,78 ---- *stream << " ifft [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -l l : FFT size ( int)[" << std::setw(5) << std::right << kDefaultFftSize << "][ 4 <= l <= ]" << std::endl; // NOLINT ! *stream << " -o o : output format ( int)[" << std::setw(5) << std::right << kDefaultOutputFormat << "][ 0 <= o <= 2 ]" << std::endl; // NOLINT *stream << " 0 (real and imaginary parts)" << std::endl; *stream << " 1 (real part)" << std::endl; *************** *** 79,85 **** *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " data sequence (double) [stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; ! *stream << " inverse FFT sequence (double)" << std::endl; *stream << " notice:" << std::endl; *stream << " value of l must be a power of 2" << std::endl; --- 80,86 ---- *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " data sequence (double)[stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; ! *stream << " inverse FFT sequence (double)" << std::endl; // NOLINT *stream << " notice:" << std::endl; *stream << " value of l must be a power of 2" << std::endl; Index: c2mpir.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/c2mpir.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** c2mpir.cc 2 May 2017 07:25:40 -0000 1.6 --- c2mpir.cc 22 Jun 2017 06:25:50 -0000 1.7 *************** *** 45,48 **** --- 45,49 ---- #include <getopt.h> #include <fstream> + #include <iomanip> #include <iostream> #include <sstream> *************** *** 65,76 **** *stream << " c2mpir [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of cepstrum [" << kDefaultNumInputOrder << "]" << std::endl; // NOLINT ! *stream << " -M M : order of minimum phase impulse response [" << kDefaultNumOutputOrder << "]" << std::endl; // NOLINT ! *stream << " -l l : length of minimum phase impulse response [" << kDefaultNumOutputOrder + 1 << "]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " cepstrum (double) [stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; ! *stream << " minimum phase impulse response (double)" << std::endl; *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; --- 66,77 ---- *stream << " c2mpir [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of cepstrum ( int)[" << std::setw(5) << std::right << kDefaultNumInputOrder << "][ 0 <= m <= ]" << std::endl; // NOLINT ! *stream << " -M M : order of minimum phase impulse response ( int)[" << std::setw(5) << std::right << kDefaultNumOutputOrder << "][ 0 <= M <= ]" << std::endl; // NOLINT ! *stream << " -l l : length of minimum phase impulse response ( int)[" << std::setw(5) << std::right << kDefaultNumOutputOrder + 1 << "][ 0 < l <= ]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " cepstrum (double)[stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; ! *stream << " minimum phase impulse response (double)" << std::endl; // NOLINT *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; *************** *** 117,121 **** std::ostringstream error_message; error_message ! << "The argument for the -M option must be bigger than 0"; sptk::PrintErrorMessage("c2mpir", error_message); return 1; --- 118,122 ---- std::ostringstream error_message; error_message ! << "The argument for the -l option must be a positive integer"; sptk::PrintErrorMessage("c2mpir", error_message); return 1; Index: excite.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/excite.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** excite.cc 10 May 2017 11:36:20 -0000 1.8 --- excite.cc 22 Jun 2017 06:25:50 -0000 1.9 *************** *** 45,48 **** --- 45,49 ---- #include <getopt.h> #include <fstream> + #include <iomanip> #include <iostream> #include <sstream> *************** *** 70,85 **** *stream << " excite [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -p p : frame period [" << kDefaultFramePeriod << "]" << std::endl; // NOLINT ! *stream << " -i i : interpolation period [" << kDefaultInterpolationPeriod << "]" << std::endl; // NOLINT ! *stream << " -n : use gauss noise for unvoiced frame [" << sptk::ConvertBooleanToString(kDefaultFlagToUseNormalDistributedRandomValue) << "]" << std::endl; // NOLINT *stream << " default is M-sequence" << std::endl; ! *stream << " -s : seed for random generation [" << kDefaultSeed << "]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " pitch period (double) [stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; ! *stream << " excitation (double)" << std::endl; *stream << " notice:" << std::endl; ! *stream << " if i < 0, don't interpolate pitch" << std::endl; *stream << " magic number for unvoiced frame is " << kMagicNumberForUnvoicedFrame << std::endl; // NOLINT *stream << std::endl; --- 71,86 ---- *stream << " excite [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -p p : frame period ( int)[" << std::setw(5) << std::right << kDefaultFramePeriod << "][ 0 < p <= ]" << std::endl; // NOLINT ! *stream << " -i i : interpolation period ( int)[" << std::setw(5) << std::right << kDefaultInterpolationPeriod << "][ 0 <= i <= p/2 ]" << std::endl; // NOLINT ! *stream << " -n : use gauss noise for unvoiced frame ( bool)[" << std::setw(5) << std::right << sptk::ConvertBooleanToString(kDefaultFlagToUseNormalDistributedRandomValue) << "]" << std::endl; // NOLINT *stream << " default is M-sequence" << std::endl; ! *stream << " -s s : seed for random generation ( int)[" << std::setw(5) << std::right << kDefaultSeed << "][ <= s <= ]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " pitch period (double)[stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; ! *stream << " excitation (double)" << std::endl; // NOLINT *stream << " notice:" << std::endl; ! *stream << " if i = 0, don't interpolate pitch" << std::endl; *stream << " magic number for unvoiced frame is " << kMagicNumberForUnvoicedFrame << std::endl; // NOLINT *stream << std::endl; Index: merge.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/merge.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** merge.cc 10 May 2017 11:36:20 -0000 1.3 --- merge.cc 22 Jun 2017 06:25:50 -0000 1.4 *************** *** 96,106 **** *stream << " merge [ options ] file1 [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -s s : insert point [" << kDefaultInsertPoint << "]" << std::endl; // NOLINT ! *stream << " -l l : frame length of input data [" << kDefaultFrameLengthOfInputData << "]" << std::endl; // NOLINT ! *stream << " -n n : order of input data [l-1]" << std::endl; ! *stream << " -L L : frame length of insert data [" << kDefaultFrameLengthOfInsertData << "]" << std::endl; // NOLINT ! *stream << " -N N : order of insert data [L-1]" << std::endl; ! *stream << " -w : overwrite mode [" << sptk::ConvertBooleanToString(kDefaultOverwriteMode) << "]" << std::endl; // NOLINT ! *stream << " +type : data type [" << kDefaultDataType << "]" << std::endl; // NOLINT *stream << " "; PrintDataType("c", "char", stream); PrintDataType("C", "unsigned char", stream); *stream << std::endl; // NOLINT *stream << " "; PrintDataType("s", "short", stream); PrintDataType("S", "unsigned short", stream); *stream << std::endl; // NOLINT --- 96,106 ---- *stream << " merge [ options ] file1 [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -s s : insert point ( int)[" << std::setw(5) << std::right << kDefaultInsertPoint << "][ 0 <= s <= l ]" << std::endl; // NOLINT ! *stream << " -l l : frame length of input data ( int)[" << std::setw(5) << std::right << kDefaultFrameLengthOfInputData << "][ 0 < l <= ]" << std::endl; // NOLINT ! *stream << " -n n : order of input data ( int)[" << std::setw(5) << std::right << "l-1" << "][ 0 <= n <= ]" << std::endl; // NOLINT ! *stream << " -L L : frame length of insert data ( int)[" << std::setw(5) << std::right << kDefaultFrameLengthOfInsertData << "][ 0 < L <= ]" << std::endl; // NOLINT ! *stream << " -N N : order of insert data ( int)[" << std::setw(5) << std::right << "L-1" << "][ 0 <= N <= ]" << std::endl; // NOLINT ! *stream << " -w : overwrite mode ( bool)[" << std::setw(5) << std::right << sptk::ConvertBooleanToString(kDefaultOverwriteMode) << "]" << std::endl; // NOLINT ! *stream << " +type : data type [" << std::setw(5) << std::right << kDefaultDataType << "]" << std::endl; // NOLINT *stream << " "; PrintDataType("c", "char", stream); PrintDataType("C", "unsigned char", stream); *stream << std::endl; // NOLINT *stream << " "; PrintDataType("s", "short", stream); PrintDataType("S", "unsigned short", stream); *stream << std::endl; // NOLINT *************** *** 114,118 **** *stream << " insert data sequence" << std::endl; *stream << " infile:" << std::endl; ! *stream << " input data sequence [stdin]" << std::endl; *stream << " stdout:" << std::endl; *stream << " merged data sequence" << std::endl; --- 114,118 ---- *stream << " insert data sequence" << std::endl; *stream << " infile:" << std::endl; ! *stream << " input data sequence [stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; *stream << " merged data sequence" << std::endl; Index: mgc2sp.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mgc2sp.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** mgc2sp.cc 19 Jun 2017 04:52:58 -0000 1.6 --- mgc2sp.cc 22 Jun 2017 06:25:50 -0000 1.7 *************** *** 48,51 **** --- 48,52 ---- #include <fstream> #include <functional> + #include <iomanip> #include <iostream> #include <sstream> *************** *** 84,96 **** *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 [" << kDefaultOutputFormat << "]" << std::endl; // NOLINT *stream << " 0 (20*log|H(z)|)" << std::endl; *stream << " 1 (ln|H(z)|)" << std::endl; --- 85,97 ---- *stream << " mgc2sp [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of mel-generalized cepstrum ( int)[" << std::setw(5) << std::right << kDefaultNumOrder << "][ 0 <= m <= ]" << std::endl; // NOLINT ! *stream << " -a a : alpha of mel-generalized cepstrum (double)[" << std::setw(5) << std::right << kDefaultAlpha << "][ <= a <= ]" << std::endl; // NOLINT ! *stream << " -g g : gamma of mel-generalized cepstrum (double)[" << std::setw(5) << std::right << kDefaultGamma << "][ <= g <= ]" << std::endl; // NOLINT ! *stream << " -c c : gamma of mel-generalized cepstrum = -1 / c ( int)[" << std::setw(5) << std::right << "N/A" << "][ 1 <= c <= ]" << std::endl; // NOLINT ! *stream << " -n : regard input as normalized ( bool)[" << std::setw(5) << std::right << sptk::ConvertBooleanToString(kDefaultNormalizationFlag) << "]" << std::endl; // NOLINT *stream << " mel-generalized cepstrum" << std::endl; ! *stream << " -u : regard input as multiplied by gamma ( bool)[" << std::setw(5) << std::right << sptk::ConvertBooleanToString(kDefaultMultiplicationFlag) << "]" << std::endl; // NOLINT ! *stream << " -l l : FFT size ( int)[" << std::setw(5) << std::right << kDefaultFftSize << "][ <= l <= ]" << std::endl; // NOLINT ! *stream << " -o o : output format ( int)[" << std::setw(5) << std::right << kDefaultOutputFormat << "][ 0 <= o <= 6 ]" << std::endl; // NOLINT *stream << " 0 (20*log|H(z)|)" << std::endl; *stream << " 1 (ln|H(z)|)" << std::endl; *************** *** 102,111 **** *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 l must be a power of 2" << 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; --- 103,111 ---- *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; // NOLINT *stream << " notice:" << std::endl; *stream << " value of l must be a power of 2" << 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; Index: ltcdf.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/ltcdf.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ltcdf.cc 10 May 2017 11:36:20 -0000 1.5 --- ltcdf.cc 22 Jun 2017 06:25:50 -0000 1.6 *************** *** 45,48 **** --- 45,49 ---- #include <getopt.h> #include <fstream> + #include <iomanip> #include <iostream> #include <sstream> *************** *** 70,84 **** *stream << " ltcdf [ options ] kfile [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of filter coefficients [" << kDefaultNumFilterOrder << "]" << std::endl; // NOLINT ! *stream << " -p p : frame period [" << kDefaultFramePeriod << "]" << std::endl; // NOLINT ! *stream << " -i i : interpolation period [" << kDefaultInterpolationPeriod << "]" << std::endl; // NOLINT ! *stream << " -k : filtering without gain [" << sptk::ConvertBooleanToString(!kDefaultGainFlag) << "]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " filter input (double) [stdin]" << std::endl; *stream << " stdout:" << std::endl; ! *stream << " filter output (double)" << std::endl; *stream << " kfile:" << std::endl; ! *stream << " filter (PARCOR) coefficients (double)" << std::endl; *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; --- 71,87 ---- *stream << " ltcdf [ options ] kfile [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of filter coefficients ( int)[" << std::setw(5) << std::right << kDefaultNumFilterOrder << "][ 0 <= m <= ]" << std::endl; // NOLINT ! *stream << " -p p : frame period ( int)[" << std::setw(5) << std::right << kDefaultFramePeriod << "][ 0 < p <= ]" << std::endl; // NOLINT ! *stream << " -i i : interpolation period ( int)[" << std::setw(5) << std::right << kDefaultInterpolationPeriod << "][ 0 <= i <= p/2 ]" << std::endl; // NOLINT ! *stream << " -k : filtering without gain ( bool)[" << std::setw(5) << std::right << sptk::ConvertBooleanToString(!kDefaultGainFlag) << "]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " filter input (double)[stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; ! *stream << " filter output (double)" << std::endl; // NOLINT *stream << " kfile:" << std::endl; ! *stream << " filter (PARCOR) coefficients (double)" << std::endl; // NOLINT ! *stream << " notice:" << std::endl; ! *stream << " if i = 0, don't interpolate filter coefficients" << std::endl; // NOLINT *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; Index: c2ndps.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/c2ndps.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** c2ndps.cc 19 Jun 2017 04:52:58 -0000 1.2 --- c2ndps.cc 22 Jun 2017 06:25:50 -0000 1.3 *************** *** 75,79 **** *stream << " options:" << std::endl; *stream << " -m m : order of cepstrum ( int)[" << std::setw(5) << std::right << kDefaultNumOrder << "][ 0 <= m <= l/2 ]" << std::endl; // NOLINT ! *stream << " -l l : FFT size ( int)[" << std::setw(5) << std::right << kDefaultFftSize << "][ 4 <= l <= ]" << std::endl; // NOLINT *stream << " -o o : output format ( int)[" << std::setw(5) << std::right << kDefaultOutputFormat << "][ 0 <= o <= 2 ]" << std::endl; // NOLINT *stream << " 0 (pole and zero parts)" << std::endl; --- 75,79 ---- *stream << " options:" << std::endl; *stream << " -m m : order of cepstrum ( int)[" << std::setw(5) << std::right << kDefaultNumOrder << "][ 0 <= m <= l/2 ]" << std::endl; // NOLINT ! *stream << " -l l : FFT size ( int)[" << std::setw(5) << std::right << kDefaultFftSize << "][ 8 <= l <= ]" << std::endl; // NOLINT *stream << " -o o : output format ( int)[" << std::setw(5) << std::right << kDefaultOutputFormat << "][ 0 <= o <= 2 ]" << std::endl; // NOLINT *stream << " 0 (pole and zero parts)" << std::endl; Index: mglsp2sp.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mglsp2sp.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mglsp2sp.cc 2 May 2017 07:25:40 -0000 1.3 --- mglsp2sp.cc 22 Jun 2017 06:25:50 -0000 1.4 *************** *** 48,51 **** --- 48,52 ---- #include <fstream> #include <functional> + #include <iomanip> #include <iostream> #include <sstream> *************** *** 97,116 **** *stream << " mglsp2sp [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of mel-generalized line spectral pairs [" << kDefaultNumOrder << "]" << std::endl; // NOLINT ! *stream << " -a a : alpha of mel-generalized line spectral pairs [" << kDefaultAlpha << "]" << std::endl; // NOLINT ! *stream << " -g g : gamma of mel-generalized line spectral pairs [" << kDefaultGamma << "]" << std::endl; // NOLINT ! *stream << " -c c : gamma of mel-generalized line spectral pairs = -1 / (int) c" << std::endl; // NOLINT ! *stream << " -l l : spectrum legnth [" << kDefaultSpectrumLength << "]" << std::endl; // NOLINT ! *stream << " -s s : sampling frequency [" << kDefaultSamplingFrequency << "]" << std::endl; // NOLINT ! *stream << " -k k : input gain type [" << kDefaultInputGainType << "]" << std::endl; // NOLINT *stream << " 0 (linear gain)" << std::endl; *stream << " 1 (log gain)" << std::endl; *stream << " 2 (without gain)" << std::endl; ! *stream << " -q q : input format [" << kDefaultInputFormat << "]" << 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 << " -o o : output format [" << kDefaultOutputFormat << "]" << std::endl; // NOLINT *stream << " 0 (20*log|H(z)|)" << std::endl; *stream << " 1 (ln|H(z)|)" << std::endl; --- 98,117 ---- *stream << " mglsp2sp [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of mel-generalized line spectral pairs ( int)[" << std::setw(5) << std::right << kDefaultNumOrder << "][ 0 <= m <= ]" << std::endl; // NOLINT ! *stream << " -a a : alpha of mel-generalized line spectral pairs (double)[" << std::setw(5) << std::right << kDefaultAlpha << "][ <= a <= ]" << std::endl; // NOLINT ! *stream << " -g g : gamma of mel-generalized line spectral pairs (double)[" << std::setw(5) << std::right << kDefaultGamma << "][ -1.0 <= g <= 0.0 ]" << std::endl; // NOLINT ! *stream << " -c c : gamma of mel-generalized line spectral pairs = -1 / c ( int)[" << std::setw(5) << std::right << "N/A" << "][ 1 <= c <= ]" << std::endl; // NOLINT ! *stream << " -l l : spectrum legnth ( int)[" << std::setw(5) << std::right << kDefaultSpectrumLength << "][ 0 < l <= ]" << std::endl; // NOLINT ! *stream << " -s s : sampling frequency (double)[" << std::setw(5) << std::right << kDefaultSamplingFrequency << "][ 0.0 < s <= ]" << std::endl; // NOLINT ! *stream << " -k k : input gain type ( int)[" << std::setw(5) << std::right << kDefaultInputGainType << "][ 0 <= k <= 2 ]" << std::endl; // NOLINT *stream << " 0 (linear gain)" << std::endl; *stream << " 1 (log gain)" << std::endl; *stream << " 2 (without gain)" << std::endl; ! *stream << " -q q : input format ( int)[" << std::setw(5) << std::right << kDefaultInputFormat << "][ 0 <= q <= 3 ]" << 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 << " -o o : output format ( int)[" << std::setw(5) << std::right << kDefaultOutputFormat << "][ 0 <= o <= 3 ]" << std::endl; // NOLINT *stream << " 0 (20*log|H(z)|)" << std::endl; *stream << " 1 (ln|H(z)|)" << std::endl; *************** *** 119,129 **** *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " mel-generalized line spectral pairs (double) [stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; ! *stream << " spectrum (double)" << std::endl; *stream << " notice:" << std::endl; *stream << " if k is 2, input length in a frame is assumed to be m instead of m+1" << std::endl; // NOLINT - *stream << " value of c must be c >= 1" << std::endl; - *stream << " value of g must be 0 > g >= -1" << std::endl; *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; --- 120,128 ---- *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " mel-generalized line spectral pairs (double)[stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; ! *stream << " spectrum (double)" << std::endl; // NOLINT *stream << " notice:" << std::endl; *stream << " if k is 2, input length in a frame is assumed to be m instead of m+1" << std::endl; // NOLINT *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; Index: decimate.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/decimate.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** decimate.cc 12 May 2017 08:29:28 -0000 1.1 --- decimate.cc 22 Jun 2017 06:25:50 -0000 1.2 *************** *** 45,48 **** --- 45,49 ---- #include <getopt.h> #include <fstream> + #include <iomanip> #include <iostream> #include <sstream> *************** *** 65,76 **** *stream << " decimate [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -s s : start index [" << kDefaultStartIndex << "]" << std::endl; // NOLINT ! *stream << " -l l : length of vector [" << kDefaultVectorLength << "]" << std::endl; // NOLINT ! *stream << " -p p : decimation period [" << kDefaultDecimationPeriod << "]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " data sequence [stdin]" << std::endl; *stream << " stdout:" << std::endl; ! *stream << " decimated data sequence" << std::endl; *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; --- 66,77 ---- *stream << " decimate [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -s s : start index ( int)[" << std::setw(5) << std::right << kDefaultStartIndex << "][ 0 <= s <= ]" << std::endl; // NOLINT ! *stream << " -l l : length of vector ( int)[" << std::setw(5) << std::right << kDefaultVectorLength << "][ 0 < l <= ]" << std::endl; // NOLINT ! *stream << " -p p : decimation period ( int)[" << std::setw(5) << std::right << kDefaultDecimationPeriod << "][ 0 < p <= ]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " data sequence (double)[stdin]" << std::endl; *stream << " stdout:" << std::endl; ! *stream << " decimated data sequence (double)" << std::endl; *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; Index: lsp2lpc.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/lsp2lpc.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** lsp2lpc.cc 2 May 2017 07:10:22 -0000 1.4 --- lsp2lpc.cc 22 Jun 2017 06:25:50 -0000 1.5 *************** *** 48,51 **** --- 48,52 ---- #include <fstream> #include <functional> + #include <iomanip> #include <iostream> #include <sstream> *************** *** 86,96 **** *stream << " lsp2lpc [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of line spectral pairs [" << kDefaultNumOrder << "]" << std::endl; // NOLINT ! *stream << " -s s : sampling frequency [" << kDefaultSamplingFrequency << "]" << std::endl; // NOLINT ! *stream << " -k k : input gain type [" << kDefaultInputGainType << "]" << std::endl; // NOLINT *stream << " 0 (linear gain)" <... [truncated message content] |
From: Takenori Y. <tak...@us...> - 2017-06-19 04:53:01
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv7530 Modified Files: c2ndps.cc fft.cc fftr.cc ifft.cc mgc2sp.cc Added Files: ndps2c.cc Log Message: add ndps2c command Index: fft.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/fft.cc,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** fft.cc 22 May 2017 03:44:10 -0000 1.15 --- fft.cc 19 Jun 2017 04:52:58 -0000 1.16 *************** *** 88,91 **** --- 88,93 ---- *stream << " stdout:" << std::endl; *stream << " FFT sequence (double)" << std::endl; + *stream << " notice:" << std::endl; + *stream << " value of l must be a power of 2" << std::endl; *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; Index: fftr.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/fftr.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** fftr.cc 22 May 2017 03:44:10 -0000 1.6 --- fftr.cc 19 Jun 2017 04:52:58 -0000 1.7 *************** *** 90,93 **** --- 90,95 ---- *stream << " stdout:" << std::endl; *stream << " FFT sequence (double)" << std::endl; + *stream << " notice:" << std::endl; + *stream << " value of l must be a power of 2" << std::endl; *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; Index: ifft.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/ifft.cc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ifft.cc 22 May 2017 03:44:10 -0000 1.9 --- ifft.cc 19 Jun 2017 04:52:58 -0000 1.10 *************** *** 82,85 **** --- 82,87 ---- *stream << " stdout:" << std::endl; *stream << " inverse FFT sequence (double)" << std::endl; + *stream << " notice:" << std::endl; + *stream << " value of l must be a power of 2" << std::endl; *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; Index: c2ndps.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/c2ndps.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** c2ndps.cc 14 Jun 2017 12:28:45 -0000 1.1 --- c2ndps.cc 19 Jun 2017 04:52:58 -0000 1.2 *************** *** 74,80 **** *stream << " c2ndps [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of cepstrum ( int)[" << std::setw(5) << std::right << kDefaultNumOrder << "][ 0 <= m <= l/2 ]" << std::endl; // NOLINT ! *stream << " -l l : FFT size ( int)[" << std::setw(5) << std::right << kDefaultFftSize << "][ 2m <= l <= ]" << std::endl; // NOLINT ! *stream << " -o o : output format ( int)[" << std::setw(5) << std::right << kDefaultOutputFormat << "][ 0 <= o <= 2 ]" << std::endl; // NOLINT *stream << " 0 (pole and zero parts)" << std::endl; *stream << " 1 (pole part)" << std::endl; --- 74,80 ---- *stream << " c2ndps [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of cepstrum ( int)[" << std::setw(5) << std::right << kDefaultNumOrder << "][ 0 <= m <= l/2 ]" << std::endl; // NOLINT ! *stream << " -l l : FFT size ( int)[" << std::setw(5) << std::right << kDefaultFftSize << "][ 4 <= l <= ]" << std::endl; // NOLINT ! *stream << " -o o : output format ( int)[" << std::setw(5) << std::right << kDefaultOutputFormat << "][ 0 <= o <= 2 ]" << std::endl; // NOLINT *stream << " 0 (pole and zero parts)" << std::endl; *stream << " 1 (pole part)" << std::endl; *************** *** 86,89 **** --- 86,90 ---- *stream << " negative derivative of phase spectrum (double)" << std::endl; // NOLINT *stream << " notice:" << std::endl; + *stream << " value of l must be a power of 2" << std::endl; *stream << " the output does not contain the information about c(0)" << std::endl; // NOLINT *stream << std::endl; --- NEW FILE: ndps2c.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 <getopt.h> #include <fstream> #include <iomanip> #include <iostream> #include <sstream> #include <vector> #include "negative_derivative_of_phase_spectrum_to_cepstrum.h" #include "sptk_utils.h" namespace { const int kDefaultFftSize(256); const int kDefaultNumOrder(25); void PrintUsage(std::ostream* stream) { // clang-format off *stream << std::endl; *stream << " ndps2c - transform negative derivative of phase spectrum to cepstrum" << std::endl; // NOLINT *stream << std::endl; *stream << " usage:" << std::endl; *stream << " ndps2c [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; *stream << " -l l : FFT size ( int)[" << std::setw(5) << std::right << kDefaultFftSize << "][ 4 <= l <= ]" << std::endl; // NOLINT *stream << " -m m : order of cepstrum ( int)[" << std::setw(5) << std::right << kDefaultNumOrder << "][ 0 <= m <= l/2 ]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; *stream << " negative derivative of phase spectrum (double)[stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; *stream << " cepstrum (double)" << std::endl; // NOLINT *stream << " notice:" << std::endl; *stream << " value of l must be a power of 2" << 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(kDefaultNumOrder); for (;;) { const int option_char(getopt_long(argc, argv, "l:m:h", NULL, NULL)); 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("ndps2c", 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("ndps2c", error_message); return 1; } break; } case 'h': { PrintUsage(&std::cout); return 0; } default: { PrintUsage(&std::cerr); return 1; } } } // check order const int half_fft_size(fft_size / 2); if (half_fft_size < num_order) { std::ostringstream error_message; error_message << "The order of cepstrum " << num_order << " must be equal or less than the half of FFT size " << half_fft_size; sptk::PrintErrorMessage("ndps2c", error_message); 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("ndps2c", error_message); return 1; } std::istream& input_stream(ifs.fail() ? std::cin : ifs); // prepare for transformation sptk::NegativeDerivativeOfPhaseSpectrumToCepstrum negative_derivative_of_phase_spectrum_to_cepstrum(fft_size, num_order); sptk::NegativeDerivativeOfPhaseSpectrumToCepstrum::Buffer buffer; if (!negative_derivative_of_phase_spectrum_to_cepstrum.IsValid()) { std::ostringstream error_message; error_message << "FFT size must be a power of 2 and greater than 4"; sptk::PrintErrorMessage("ndps2c", error_message); return 1; } const int input_length(half_fft_size + 1); const int output_length(num_order + 1); std::vector<double> negative_derivative_of_phase_spectrum(input_length); std::vector<double> cepstrum(output_length); while (sptk::ReadStream(false, 0, 0, input_length, &negative_derivative_of_phase_spectrum, &input_stream)) { if (!negative_derivative_of_phase_spectrum_to_cepstrum.Run( negative_derivative_of_phase_spectrum, &cepstrum, &buffer)) { std::ostringstream error_message; error_message << "Failed to transform negative derivative of phase " << "spectrum to cepstrum"; sptk::PrintErrorMessage("ndps2c", error_message); return 1; } if (!sptk::WriteStream(0, output_length, cepstrum, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write cepstrum"; sptk::PrintErrorMessage("ndps2c", error_message); return 1; } } return 0; } Index: mgc2sp.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mgc2sp.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** mgc2sp.cc 2 May 2017 07:10:22 -0000 1.5 --- mgc2sp.cc 19 Jun 2017 04:52:58 -0000 1.6 *************** *** 106,109 **** --- 106,110 ---- *stream << " spectrum (double)" << std::endl; *stream << " notice:" << std::endl; + *stream << " value of l must be a power of 2" << 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 |
From: fujishita t. <fjs...@us...> - 2017-06-19 02:06:07
|
Update of /cvsroot/sp-tk/SPTK/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv3732 Modified Files: configure.ac Log Message: add csm2lpc command Index: configure.ac =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/configure.ac,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** configure.ac 22 Dec 2016 10:52:59 -0000 1.56 --- configure.ac 19 Jun 2017 02:06:04 -0000 1.57 *************** *** 174,177 **** --- 174,178 ---- bin/cdist/Makefile bin/clip/Makefile + bin/csm2lpc/Makefile bin/da/Makefile bin/dct/Makefile |
From: fujishita t. <fjs...@us...> - 2017-06-19 02:03:24
|
Update of /cvsroot/sp-tk/SPTK/src/bin/csm2lpc In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv3087 Added Files: csm2lpc.c _csm2lpc.c Makefile.am .cvsignore Log Message: add csm2lpc command --- NEW FILE: .cvsignore --- Makefile csm2lpc Makefile.in .deps --- NEW FILE: _csm2lpc.c --- /* ----------------------------------------------------------------- */ /* 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. */ /* ----------------------------------------------------------------- */ /*************************************************************** $Id: _csm2lpc.c,v 1.1 2017/06/19 02:03:22 fjst15124 Exp $ Transformation CSM to LPC void csm2lpc(csm, a, m, f) double *csm : Composite Sinusoidal Modeling double *a : LP coefficients int m : order of LPC double f : singular check (eps(if -1., 0.0 is assumed)) ****************************************************************/ #include <stdio.h> #include <stdlib.h> #include <math.h> #if defined(WIN32) #include "SPTK.h" #else #include <SPTK.h> #endif void csm2lpc(double *csm, double *a, const int m, const double f) { int i, l, n; double *frequencies, *intensities; static double *v = NULL; static int size; n = (m + 1) / 2; if (v == NULL) { v = dgetmem(m + 1); size = m; } if (m > size) { free(v); v = dgetmem(m + 1); size = m; } frequencies = csm; intensities = csm + n; for (l = 0; l <= m; l++) { v[l] = 0.0; for (i = 0; i < n; i++) { v[l] += intensities[i] * cos(l * frequencies[i]); } } levdur(v, a, m, f); return; } --- NEW FILE: Makefile.am --- AM_CPPFLAGS = -I @top_srcdir@/include bin_PROGRAMS = csm2lpc csm2lpc_SOURCES = csm2lpc.c _csm2lpc.c csm2lpc_LDADD = @top_builddir@/lib/libSPTK.a --- NEW FILE: csm2lpc.c --- /* ----------------------------------------------------------------- */ /* 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. */ /* ----------------------------------------------------------------- */ /************************************************************************ * * * Transform CSM to LPC * * * * 2013.12 T.Aritake * * * * usage: * * csm2lpc [ options ] [ infile ] > stdout * * options: * * -m M : order of LPC [25] * * -f f : mimimum value of the determinant * * of the normal matrix [0.0] * * infile: * * Composite Sinusoidal Modeling * * , w(1), ..., w((M+1)/2), m(1), ..., m((M+1)/2), * * stdout: * * LP Coefficients * * , K, a(1), ..., a(M), * * require: * * csm2lpc(), levdur() * * * ************************************************************************/ static char *rcs_id = "$Id: csm2lpc.c,v 1.1 2017/06/19 02:03:22 fjst15124 Exp $"; /* Standard C Libraries */ #include <stdio.h> #include <stdlib.h> #ifdef HAVE_STRING_H #include <string.h> #else #include <strings.h> #ifndef HAVE_STRRCHR #define strrchr rindex #endif #endif #if defined(WIN32) #include "SPTK.h" #else #include <SPTK.h> #endif /* Default Values */ #define ORDER 25 #define MINDET 0.0 /* Command Name */ char *cmnd; void usage(int status) { fprintf(stderr, "\n"); fprintf(stderr, " %s - transform CSM to LPC\n", cmnd); fprintf(stderr, "\n"); fprintf(stderr, " usage:\n"); fprintf(stderr, " %s [ options ] [ infile ] > stdout\n", cmnd); fprintf(stderr, " options:\n"); fprintf(stderr, " -m m : order of LPC [%d]\n", ORDER); fprintf(stderr, " -f f : mimimum value of the determinant [%g]\n", MINDET); fprintf(stderr, " of the normal matrix\n"); fprintf(stderr, " -h : print this message\n"); fprintf(stderr, " infile:\n"); fprintf(stderr, " CSM (%s) [stdin]\n", FORMAT); fprintf(stderr, " stdout:\n"); fprintf(stderr, " LP coefficients (%s)\n", FORMAT); #ifdef PACKAGE_VERSION fprintf(stderr, "\n"); fprintf(stderr, " SPTK: version %s\n", PACKAGE_VERSION); fprintf(stderr, " CVS Info: %s", rcs_id); #endif fprintf(stderr, "\n"); exit(status); } int main(int argc, char **argv) { int m = ORDER; char *filename; FILE *fp = stdin; double f = MINDET; double *csm, *a; if ((cmnd = strrchr(argv[0], '/')) == NULL) cmnd = argv[0]; else cmnd++; while (--argc) if (**++argv == '-') { switch (*(*argv + 1)) { case 'm': m = atoi(*++argv); --argc; break; case 'f': f = atof(*++argv); --argc; break; case 'h': usage(0); default: fprintf(stderr, "%s : Invalid option '%c'!\n", cmnd, *(*argv + 1)); usage(1); } } else fp = getfp(*argv, "rb"); if (m % 2 == 0) { fprintf(stderr, "%s : Order of LPC must be odd!\n", cmnd); return 1; } csm = dgetmem(m + 1 + m + 1); a = csm + m + 1; while (freadf(csm, sizeof(*csm), m + 1, fp) == m + 1) { csm2lpc(csm, a, m, f); fwritef(a, sizeof(*a), m + 1, stdout); } return 0; } |
From: fujishita t. <fjs...@us...> - 2017-06-19 01:58:48
|
Update of /cvsroot/sp-tk/SPTK/src/bin/csm2lpc In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv1742/csm2lpc Log Message: Directory /cvsroot/sp-tk/SPTK/src/bin/csm2lpc added to the repository |
From: Takenori Y. <tak...@us...> - 2017-06-16 08:04:51
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv1136 Modified Files: Makefile Added Files: negative_derivative_of_phase_spectrum_to_cepstrum.cc negative_derivative_of_phase_spectrum_to_cepstrum.h Log Message: add a class for ndps2c --- NEW FILE: negative_derivative_of_phase_spectrum_to_cepstrum.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_NEGATIVE_DERIVATIVE_OF_PHASE_SPECTRUM_TO_CEPSTRUM_H_ #define SPTK_SRC_NEGATIVE_DERIVATIVE_OF_PHASE_SPECTRUM_TO_CEPSTRUM_H_ #include <vector> // std::vector #include "fast_fourier_transform_for_real_sequence.h" #include "sptk_utils.h" namespace sptk { class NegativeDerivativeOfPhaseSpectrumToCepstrum { public: class Buffer { public: Buffer() { } virtual ~Buffer() { } private: FastFourierTransformForRealSequence::Buffer fast_fourier_transform_buffer_; std::vector<double> fast_fourier_transform_input_; std::vector<double> fast_fourier_transform_real_part_output_; std::vector<double> fast_fourier_transform_imaginary_part_output_; friend class NegativeDerivativeOfPhaseSpectrumToCepstrum; DISALLOW_COPY_AND_ASSIGN(Buffer); }; // NegativeDerivativeOfPhaseSpectrumToCepstrum(int fft_size, int num_order); // virtual ~NegativeDerivativeOfPhaseSpectrumToCepstrum() { } // int GetFftSize() const { return fast_fourier_transform_.GetFftSize(); } // int GetNumOrder() const { return num_order_; } // bool IsValid() const { return is_valid_; } // bool Run(const std::vector<double>& negative_derivative_of_phase_spectrum, std::vector<double>* cepstrum, NegativeDerivativeOfPhaseSpectrumToCepstrum::Buffer* buffer) const; private: // const int num_order_; // const FastFourierTransformForRealSequence fast_fourier_transform_; // bool is_valid_; // DISALLOW_COPY_AND_ASSIGN(NegativeDerivativeOfPhaseSpectrumToCepstrum); }; } // namespace sptk #endif // SPTK_SRC_NEGATIVE_DERIVATIVE_OF_PHASE_SPECTRUM_TO_CEPSTRUM_H_ Index: Makefile =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/Makefile,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** Makefile 2 Jun 2017 10:41:21 -0000 1.35 --- Makefile 16 Jun 2017 08:04:49 -0000 1.36 *************** *** 80,83 **** --- 80,84 ---- mu_law_compression.cc \ mu_law_decompression.cc \ + negative_derivative_of_phase_spectrum_to_cepstrum.cc \ normal_distributed_random_value_generation.cc \ parcor_coefficients_to_linear_predictive_coefficients.cc \ --- NEW FILE: negative_derivative_of_phase_spectrum_to_cepstrum.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 "negative_derivative_of_phase_spectrum_to_cepstrum.h" #include <algorithm> // std::copy, std::reverse_copy #include <cstddef> // std::size_t namespace sptk { NegativeDerivativeOfPhaseSpectrumToCepstrum:: NegativeDerivativeOfPhaseSpectrumToCepstrum(int fft_size, int num_order) : num_order_(num_order), fast_fourier_transform_(fft_size - 1, fft_size), is_valid_(true) { if (num_order < 0 || fft_size < 2 * num_order || !fast_fourier_transform_.IsValid()) { is_valid_ = false; } } bool NegativeDerivativeOfPhaseSpectrumToCepstrum::Run( const std::vector<double>& negative_derivative_of_phase_spectrum, std::vector<double>* cepstrum, NegativeDerivativeOfPhaseSpectrumToCepstrum::Buffer* buffer) const { // check inputs const int fft_size(fast_fourier_transform_.GetFftSize()); const int half_fft_size(fft_size / 2); if (!is_valid_ || negative_derivative_of_phase_spectrum.size() != static_cast<std::size_t>(half_fft_size + 1) || NULL == cepstrum || NULL == buffer) { return false; } // prepare memories if (cepstrum->size() < static_cast<std::size_t>(num_order_ + 1)) { cepstrum->resize(num_order_ + 1); } if (buffer->fast_fourier_transform_input_.size() < static_cast<std::size_t>(fft_size)) { buffer->fast_fourier_transform_input_.resize(fft_size); } // set a real part input of the fast Fourier transform std::copy(negative_derivative_of_phase_spectrum.begin(), negative_derivative_of_phase_spectrum.end(), buffer->fast_fourier_transform_input_.begin()); std::reverse_copy( negative_derivative_of_phase_spectrum.begin() + 1, negative_derivative_of_phase_spectrum.end(), buffer->fast_fourier_transform_input_.begin() + half_fft_size); if (!fast_fourier_transform_.Run( buffer->fast_fourier_transform_input_, &buffer->fast_fourier_transform_real_part_output_, &buffer->fast_fourier_transform_imaginary_part_output_, &buffer->fast_fourier_transform_buffer_)) { return false; } double* output(&((*cepstrum)[0])); double* fast_fourier_transform_real_part_output( &buffer->fast_fourier_transform_real_part_output_[0]); output[0] = fast_fourier_transform_real_part_output[0]; for (int i(1); i <= num_order_; ++i) { output[i] = fast_fourier_transform_real_part_output[i] / (i * half_fft_size); } if (half_fft_size == num_order_) { output[num_order_] *= 0.5; } return true; } } // namespace sptk |
From: Takenori Y. <tak...@us...> - 2017-06-14 12:28:47
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv14687 Added Files: c2ndps.cc Log Message: add c2ndps command --- NEW FILE: c2ndps.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 <getopt.h> #include <fstream> #include <iomanip> #include <iostream> #include <sstream> #include <vector> #include "cepstrum_to_negative_derivative_of_phase_spectrum.h" #include "sptk_utils.h" namespace { enum OutputFormats { kOutputPoleAndZeroParts = 0, kOutputPolePart, kOutputZeroPart, kNumOutputFormats }; const int kDefaultNumOrder(25); const int kDefaultFftSize(256); const OutputFormats kDefaultOutputFormat(kOutputPoleAndZeroParts); void PrintUsage(std::ostream* stream) { // clang-format off *stream << std::endl; *stream << " c2ndps - transform cepstrum to negative derivative of phase spectrum" << std::endl; // NOLINT *stream << std::endl; *stream << " usage:" << std::endl; *stream << " c2ndps [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; *stream << " -m m : order of cepstrum ( int)[" << std::setw(5) << std::right << kDefaultNumOrder << "][ 0 <= m <= l/2 ]" << std::endl; // NOLINT *stream << " -l l : FFT size ( int)[" << std::setw(5) << std::right << kDefaultFftSize << "][ 2m <= l <= ]" << std::endl; // NOLINT *stream << " -o o : output format ( int)[" << std::setw(5) << std::right << kDefaultOutputFormat << "][ 0 <= o <= 2 ]" << std::endl; // NOLINT *stream << " 0 (pole and zero parts)" << std::endl; *stream << " 1 (pole part)" << std::endl; *stream << " 2 (zero part)" << std::endl; *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; *stream << " cepstrum (double)[stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; *stream << " negative derivative of phase spectrum (double)" << std::endl; // NOLINT *stream << " notice:" << std::endl; *stream << " the output does not contain the information about c(0)" << 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); int fft_size(kDefaultFftSize); OutputFormats output_format(kDefaultOutputFormat); for (;;) { const int option_char(getopt_long(argc, argv, "m:l:o:h", NULL, NULL)); 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("c2ndps", error_message); return 1; } 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("c2ndps", error_message); return 1; } 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("c2ndps", error_message); return 1; } output_format = static_cast<OutputFormats>(tmp); break; } case 'h': { PrintUsage(&std::cout); return 0; } default: { PrintUsage(&std::cerr); return 1; } } } // check order const int half_fft_size(fft_size / 2); if (half_fft_size < num_order) { std::ostringstream error_message; error_message << "The order of cepstrum " << num_order << " must be equal to or less than the half of FFT size " << half_fft_size; sptk::PrintErrorMessage("c2ndps", error_message); 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("c2ndps", error_message); return 1; } std::istream& input_stream(ifs.fail() ? std::cin : ifs); // prepare for transformation sptk::CepstrumToNegativeDerivativeOfPhaseSpectrum cepstrum_to_negative_derivative_of_phase_spectrum(num_order, fft_size); sptk::CepstrumToNegativeDerivativeOfPhaseSpectrum::Buffer buffer; if (!cepstrum_to_negative_derivative_of_phase_spectrum.IsValid()) { std::ostringstream error_message; error_message << "FFT size must be a power of 2 and greater than 4"; sptk::PrintErrorMessage("c2ndps", error_message); return 1; } const int input_length(num_order + 1); const int output_length(half_fft_size + 1); std::vector<double> cepstrum(input_length); std::vector<double> negative_derivative_of_phase_spectrum(fft_size); while ( sptk::ReadStream(false, 0, 0, input_length, &cepstrum, &input_stream)) { if (!cepstrum_to_negative_derivative_of_phase_spectrum.Run( cepstrum, &negative_derivative_of_phase_spectrum, &buffer)) { std::ostringstream error_message; error_message << "Failed to transform cepstrum to negative derivative of " << "phase spectrum"; sptk::PrintErrorMessage("c2ndps", error_message); return 1; } if (kOutputPolePart == output_format) { for (int i(0); i < output_length; ++i) { if (negative_derivative_of_phase_spectrum[i] < 0.0) { negative_derivative_of_phase_spectrum[i] = 0.0; } } } else if (kOutputZeroPart == output_format) { for (int i(0); i < output_length; ++i) { if (0.0 < negative_derivative_of_phase_spectrum[i]) { negative_derivative_of_phase_spectrum[i] = 0.0; } } } if (!sptk::WriteStream(0, output_length, negative_derivative_of_phase_spectrum, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write negative derivative of phase spectrum"; sptk::PrintErrorMessage("c2ndps", error_message); return 1; } } return 0; } |
From: fujishita t. <fjs...@us...> - 2017-06-08 09:23:25
|
Update of /cvsroot/sp-tk/SPTK/doc/ref_e In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv13062 Modified Files: c2sp.tex dfs.tex fdrw.tex fftr.tex grpdelay.tex histogram.tex lsp2sp.tex mgc2sp.tex phase.tex sin.tex spec.tex train.tex vopr.tex window.tex xgr.tex Log Message: add figure of example Index: lsp2sp.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/lsp2sp.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** lsp2sp.tex 10 May 2017 07:09:59 -0000 1.7 --- lsp2sp.tex 8 Jun 2017 09:23:23 -0000 1.8 *************** *** 101,109 **** \begin{qsection}{EXAMPLE} The example below takes the 15-th order LSP from the file ! {\em data.cep} in float format, evaluates the spectrum, and presents it in the screen: \begin{quote} ! \verb! lsp2sp -m 15 data.lsp | glogsp | xgr ! \end{quote} \end{qsection} --- 101,112 ---- \begin{qsection}{EXAMPLE} The example below takes the 15-th order LSP from the file ! {\em data.lsp} in float format, evaluates the spectrum, and presents it in the screen: \begin{quote} ! \verb! lsp2sp -m 15 data.lsp | glogsp -x 5 | xgr ! \end{quote} + \begin{center} + \includegraphics[width=6cm]{fig/lsp2sp.pdf} + \end{center} \end{qsection} Index: dfs.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/dfs.tex,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** dfs.tex 22 Dec 2016 10:52:58 -0000 1.21 --- dfs.tex 8 Jun 2017 09:23:23 -0000 1.22 *************** *** 100,103 **** --- 100,106 ---- \verb!impulse | dfs -p data.p -z data.z | spec | fdrw | xgr! \end{quote} + \begin{center} + \includegraphics[width=6cm]{fig/dfs.pdf} + \end{center} The files {\em data.p} and {\em data.z} can be obtained through the {\em x2x} command. Index: sin.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/sin.tex,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** sin.tex 22 Dec 2016 10:52:59 -0000 1.20 --- sin.tex 8 Jun 2017 09:23:23 -0000 1.21 *************** *** 69,77 **** \begin{qsection}{EXAMPLE} ! In the following example, a sin wave sequence is parsed through ! a Blackman window and the results are displayed the results on the screen: \begin{quote} \verb!sin -p 12.3 | window | fdrw | xgr! \end{quote} \end{qsection} --- 69,80 ---- \begin{qsection}{EXAMPLE} ! In the following example, a sin wave sequence is passed through ! a Blackman window and the results are displayed on the screen: \begin{quote} \verb!sin -p 12.3 | window | fdrw | xgr! \end{quote} + \begin{center} + \includegraphics[width=6cm]{fig/sin.pdf} + \end{center} \end{qsection} Index: fftr.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/fftr.tex,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** fftr.tex 22 Dec 2016 10:52:58 -0000 1.21 --- fftr.tex 8 Jun 2017 09:23:23 -0000 1.22 *************** *** 96,99 **** --- 96,102 ---- \verb!sin -p 30 | window | fftr -A | fdrw | xgr! \end{quote} + \begin{center} + \includegraphics[width=6cm]{fig/fftr.pdf} + \end{center} \end{qsection} Index: spec.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/spec.tex,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** spec.tex 22 Dec 2016 10:52:59 -0000 1.25 --- spec.tex 8 Jun 2017 09:23:23 -0000 1.26 *************** *** 151,154 **** --- 151,157 ---- \verb!train -p 50 | dfs -a 1 0.9 | window | spec | fdrw | xgr ! \end{quote} + \begin{center} + \includegraphics[width=4cm]{fig/spec_1.pdf} + \end{center} \par This example evaluates the frequency response of *************** *** 158,161 **** --- 161,168 ---- \verb!spec -p data.p -z data.z | fdrw | xgr ! \end{quote} + \begin{center} + \includegraphics[width=4cm]{fig/spec_2.pdf} + \end{center} + A similar result can be obtained with the following command, for a stable filter: *************** *** 163,171 **** \verb!impulse | dfs -p data.p -z data.z | spec | fdrw | xgr ! \end{quote} ! Also, in the following example, the floor value is set as -30 dB per frame by using the -E option. \begin{quote} \verb! spec -E -30 data.f | fdrw | xgr ! \end{quote} --- 170,183 ---- \verb!impulse | dfs -p data.p -z data.z | spec | fdrw | xgr ! \end{quote} ! \begin{center} ! \includegraphics[width=4cm]{fig/spec_3.pdf} ! \end{center} Also, in the following example, the floor value is set as -30 dB per frame by using the -E option. \begin{quote} \verb! spec -E -30 data.f | fdrw | xgr ! \end{quote} + \begin{center} + \includegraphics[width=4cm]{fig/spec_4.pdf} + \end{center} Index: mgc2sp.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/mgc2sp.tex,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** mgc2sp.tex 22 Dec 2016 10:52:58 -0000 1.26 --- mgc2sp.tex 8 Jun 2017 09:23:23 -0000 1.27 *************** *** 126,131 **** and the log magnitude spectrum is evaluated and plotted: \begin{quote} ! \verb!mgc2sp -m 12 -a 0.35 -c 2 < data.mgcep | glogsp | xgr! \end{quote} \end{qsection} --- 126,134 ---- and the log magnitude spectrum is evaluated and plotted: \begin{quote} ! \verb!mgc2sp -m 12 -a 0.35 -c 2 < data.mgcep | glogsp -x 5 | xgr! \end{quote} + \begin{center} + \includegraphics[width=6cm]{fig/mgc2sp.pdf} + \end{center} \end{qsection} Index: train.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/train.tex,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** train.tex 22 Dec 2016 10:52:59 -0000 1.18 --- train.tex 8 Jun 2017 09:23:23 -0000 1.19 *************** *** 79,82 **** --- 79,85 ---- \verb!train | dfs -b 1 0.9 | window | spec | fdrw | xgr! \end{quote} + \begin{center} + \includegraphics[width=6cm]{fig/train.pdf} + \end{center} \end{qsection} Index: c2sp.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/c2sp.tex,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** c2sp.tex 22 Dec 2016 10:52:57 -0000 1.19 --- c2sp.tex 8 Jun 2017 09:23:23 -0000 1.20 *************** *** 83,88 **** and presents it in the screen: \begin{quote} ! \verb! c2sp -m 15 data.cep | grlogsp | xgr ! \end{quote} \end{qsection} --- 83,91 ---- and presents it in the screen: \begin{quote} ! \verb! c2sp -m 15 data.cep | grlogsp -x 5 | xgr ! \end{quote} + \begin{center} + \includegraphics[width=3cm]{fig/c2sp.pdf} + \end{center} \end{qsection} Index: fdrw.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/fdrw.tex,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** fdrw.tex 7 Feb 2017 06:55:19 -0000 1.26 --- fdrw.tex 8 Jun 2017 09:23:23 -0000 1.27 *************** *** 102,107 **** \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. --- 102,108 ---- \verb!impulse | dfs -a 1 0.8 0.5 | fdrw -W 1.0 -H 0.3 | xgr! \end{quote} ! \begin{center} ! \includegraphics[width=6cm]{fig/fdrw_1.pdf} ! \end{center} The graph width is 10cm and its height is 3cm. *************** *** 112,117 **** \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. --- 113,119 ---- \verb!impulse | dfs -a 1 0.8 0.5 | spec | fdrw -y -60 40 | xgr! \end{quote} ! \begin{center} ! \includegraphics[width=6cm]{fig/fdrw_2.pdf} ! \end{center} The $y$ axis goes from $-60$ dB to $40$ dB. *************** *** 128,133 **** \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 --- 130,136 ---- \verb!xgr ! \end{quote} ! \begin{center} ! \includegraphics[width=3cm]{fig/fdrw_3.pdf} ! \end{center} The command {\em psgr} prints the output to a laser printer in the Index: phase.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/phase.tex,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** phase.tex 10 May 2017 07:09:59 -0000 1.23 --- phase.tex 8 Jun 2017 09:23:23 -0000 1.24 *************** *** 134,137 **** --- 134,140 ---- \verb!phase -p data.p -z data.z | fdrw | xgr ! \end{quote} + \begin{center} + \includegraphics[width=6cm]{fig/phase_1.pdf} + \end{center} If the filter defined by {\em data.p}, {\em data.z} is stable then the following command will give a similar result: *************** *** 139,142 **** --- 142,148 ---- \verb!impulse | dfs -p data.p -z data.z | phase | fdrw | xgr ! \end{quote} + \begin{center} + \includegraphics[width=6cm]{fig/phase_2.pdf} + \end{center} \end{qsection} Index: xgr.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/xgr.tex,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** xgr.tex 22 Dec 2016 10:52:59 -0000 1.21 --- xgr.tex 8 Jun 2017 09:23:23 -0000 1.22 *************** *** 97,100 **** --- 97,103 ---- \verb!fdrw < data.f | xgr! \end{quote} + \begin{center} + \includegraphics[width=6cm]{fig/xgr.pdf} + \end{center} \end{qsection} \begin{qsection}{NOTICE} Index: histogram.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/histogram.tex,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** histogram.tex 22 Dec 2016 10:52:58 -0000 1.20 --- histogram.tex 8 Jun 2017 09:23:23 -0000 1.21 *************** *** 81,84 **** --- 81,87 ---- \verb!histogram -i -16000 -j 16000 -s 100 data.f | fdrw | xgr! \end{quote} + \begin{center} + \includegraphics[width=6cm]{fig/histogram.pdf} + \end{center} \end{qsection} Index: window.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/window.tex,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** window.tex 22 Dec 2016 10:52:59 -0000 1.20 --- window.tex 8 Jun 2017 09:23:23 -0000 1.21 *************** *** 104,107 **** --- 104,110 ---- \verb!sin -p 20 | window | fdrw | xgr ! \end{quote} + \begin{center} + \includegraphics[width=6cm]{fig/window_1.pdf} + \end{center} \par This example passes the excitation generated through a train pulse *************** *** 113,116 **** --- 116,122 ---- \verb!spec -l 512 | fdrw | xgr! \end{quote} + \begin{center} + \includegraphics[width=6cm]{fig/window_2.pdf} + \end{center} \end{qsection} Index: vopr.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/vopr.tex,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** vopr.tex 22 Dec 2016 10:52:59 -0000 1.20 --- vopr.tex 8 Jun 2017 09:23:23 -0000 1.21 *************** *** 174,177 **** --- 174,180 ---- \verb!sin -p 30 -l 1000 | vopr data.w -l 256 -m | fdrw | xgr! \end{quote} + \begin{center} + \includegraphics[width=6cm]{fig/vopr_1.pdf} + \end{center} Similar results as from the above example can be obtained using the following: Here, it is considered that the contents of {\em data.w} correspond to a Blackman window: *************** *** 179,182 **** --- 182,188 ---- \verb!sin -p 30 -l 1000 | window | fdrw | xgr! \end{quote} + \begin{center} + \includegraphics[width=6cm]{fig/vopr_2.pdf} + \end{center} For other examples, suppose {\em data.a} contains \begin{displaymath} Index: grpdelay.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/grpdelay.tex,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** grpdelay.tex 22 Dec 2016 10:52:58 -0000 1.20 --- grpdelay.tex 8 Jun 2017 09:23:23 -0000 1.21 *************** *** 95,98 **** --- 95,101 ---- \verb! impulse | dfs -a 1 0.9 | grpdelay | fdrw | xgr ! \end{quote} + \begin{center} + \includegraphics[width=6cm]{fig/grpdelay.pdf} + \end{center} \end{qsection} |
From: fujishita t. <fjs...@us...> - 2017-06-08 09:21:01
|
Update of /cvsroot/sp-tk/SPTK/doc/ref_e/fig In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv12513 Added Files: c2sp.pdf dfs.pdf fftr.pdf grpdelay.pdf histogram.pdf lsp2sp.pdf mgc2sp.pdf phase_1.pdf phase_2.pdf sin.pdf spec_1.pdf spec_2.pdf spec_3.pdf spec_4.pdf train.pdf vopr_1.pdf vopr_2.pdf window_1.pdf window_2.pdf xgr.pdf Log Message: add figure of example --- NEW FILE: spec_3.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: fftr.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: window_2.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: mgc2sp.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: phase_1.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: lsp2sp.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: train.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: spec_2.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: c2sp.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: window_1.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: dfs.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: sin.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: histogram.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: vopr_1.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: phase_2.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: spec_1.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: vopr_2.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: grpdelay.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: spec_4.pdf --- (This appears to be a binary file; contents omitted.) --- NEW FILE: xgr.pdf --- (This appears to be a binary file; contents omitted.) |
From: Natsumi K. <koi...@us...> - 2017-06-02 10:41:25
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv7029 Modified Files: Makefile b2mc.cc Added Files: mel_cepstrum_to_mlsa_digital_filter_coefficients.h mel_cepstrum_to_mlsa_digital_filter_coefficients.cc mc2b.cc Log Message: add mc2b command --- NEW FILE: mel_cepstrum_to_mlsa_digital_filter_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 "mel_cepstrum_to_mlsa_digital_filter_coefficients.h" namespace sptk { MelCepstrumToMlsaDigitalFilterCoefficients:: MelCepstrumToMlsaDigitalFilterCoefficients(int num_order, double alpha) : num_order_(num_order), alpha_(alpha), is_valid_(true) { if (num_order_ < 0) { is_valid_ = false; } } bool MelCepstrumToMlsaDigitalFilterCoefficients::Run( const std::vector<double>& mel_cepstrum, std::vector<double>* mlsa_digital_filter_coefficients) const { // check inputs if (!is_valid_ || mel_cepstrum.size() != static_cast<std::size_t>(num_order_ + 1) || NULL == mlsa_digital_filter_coefficients) { return false; } // prepare memory if (mlsa_digital_filter_coefficients->size() < static_cast<std::size_t>(num_order_ + 1)) { mlsa_digital_filter_coefficients->resize(num_order_ + 1); } // get values const double* input(&(mel_cepstrum[0])); double* output(&((*mlsa_digital_filter_coefficients)[0])); output[num_order_] = input[num_order_]; for (int i(num_order_ - 1); 0 <= i; --i) { output[i] = input[i] - alpha_ * output[i + 1]; } return true; } } // namespace sptk --- NEW FILE: mel_cepstrum_to_mlsa_digital_filter_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_MEL_CEPSTRUM_TO_MLSA_DIGITAL_FILTER_COEFFICIENTS_H_ #define SPTK_SRC_MEL_CEPSTRUM_TO_MLSA_DIGITAL_FILTER_COEFFICIENTS_H_ #include <vector> // std::vector #include "sptk_utils.h" namespace sptk { class MelCepstrumToMlsaDigitalFilterCoefficients { public: // MelCepstrumToMlsaDigitalFilterCoefficients(int num_order, double alpha); // virtual ~MelCepstrumToMlsaDigitalFilterCoefficients() { } // int GetNumOrder() const { return num_order_; } // double GetAlpha() const { return alpha_; } // bool IsValid() const { return is_valid_; } // bool Run(const std::vector<double>& mel_cepstrum, std::vector<double>* mlsa_digital_filter_coefficients) const; private: // const int num_order_; // const double alpha_; // bool is_valid_; // DISALLOW_COPY_AND_ASSIGN(MelCepstrumToMlsaDigitalFilterCoefficients); }; } // namespace sptk #endif // SPTK_SRC_MEL_CEPSTRUM_TO_MLSA_DIGITAL_FILTER_COEFFICIENTS_H_ --- NEW FILE: mc2b.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 <getopt.h> #include <fstream> #include <iostream> #include <sstream> #include <vector> #include "mel_cepstrum_to_mlsa_digital_filter_coefficients.h" #include "sptk_utils.h" namespace { const int kDefaultNumOrder(25); const double kDefaultAlpha(0.35); void PrintUsage(std::ostream* stream) { // clang-format off *stream << std::endl; *stream << " mc2b - transform mel-cepstrum to MLSA digital filter coefficients" << std::endl; // NOLINT *stream << std::endl; *stream << " usage:" << std::endl; *stream << " mc2b [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; *stream << " -m m : order of mel-cepstrum [" << kDefaultNumOrder << "]" << std::endl; // NOLINT *stream << " -a a : all-pass constant [" << kDefaultAlpha << "]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; *stream << " MLSA filter coefficients (double) [stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; *stream << " mel-cepstrum (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 alpha(kDefaultAlpha); for (;;) { const int option_char(getopt_long(argc, argv, "m:a:h", NULL, NULL)); 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("mc2b", 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("mc2b", 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("mc2b", error_message); return 1; } std::istream& input_stream(ifs.fail() ? std::cin : ifs); // prepare for transformation sptk::MelCepstrumToMlsaDigitalFilterCoefficients mel_cepstrum_to_mlsa_digital_filter_coefficients(num_order, alpha); if (!mel_cepstrum_to_mlsa_digital_filter_coefficients.IsValid()) { std::ostringstream error_message; error_message << "Failed to set the condition"; sptk::PrintErrorMessage("mc2b", error_message); return 1; } const int length(num_order + 1); std::vector<double> mel_cepstrum(length); std::vector<double> mlsa_digital_filter_coefficients(length); while (sptk::ReadStream(false, 0, 0, length, &mel_cepstrum, &input_stream)) { if (!mel_cepstrum_to_mlsa_digital_filter_coefficients.Run( mel_cepstrum, &mlsa_digital_filter_coefficients)) { std::ostringstream error_message; error_message << "Failed to transform mel-cepstrum to MLSA digital " "filter coefficients"; sptk::PrintErrorMessage("mc2b", error_message); return 1; } if (!sptk::WriteStream(0, length, mlsa_digital_filter_coefficients, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write MLSA digital filter coefficients"; sptk::PrintErrorMessage("mc2b", error_message); return 1; } } return 0; } Index: Makefile =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/Makefile,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** Makefile 26 May 2017 06:52:35 -0000 1.34 --- Makefile 2 Jun 2017 10:41:21 -0000 1.35 *************** *** 73,76 **** --- 73,77 ---- linear_predictive_coefficients_to_parcor_coefficients.cc \ m_sequence_generation.cc \ + mel_cepstrum_to_mlsa_digital_filter_coefficients.cc \ mel_generalized_cepstrum_to_spectrum.cc \ mel_generalized_cepstrum_transform.cc \ Index: b2mc.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/b2mc.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** b2mc.cc 26 May 2017 06:37:47 -0000 1.1 --- b2mc.cc 2 Jun 2017 10:41:23 -0000 1.2 *************** *** 65,69 **** *stream << " b2mc [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of mel cepstrum [" << kDefaultNumOrder << "]" << std::endl; // NOLINT *stream << " -a a : all-pass constant [" << kDefaultAlpha << "]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; --- 65,69 ---- *stream << " b2mc [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of mel-cepstrum [" << kDefaultNumOrder << "]" << std::endl; // NOLINT *stream << " -a a : all-pass constant [" << kDefaultAlpha << "]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; |
From: Takenori Y. <tak...@us...> - 2017-06-02 02:52:48
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv30476 Modified Files: cepstrum_to_negative_derivative_of_phase_spectrum.cc freqt.cc Log Message: update usage Index: freqt.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/freqt.cc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** freqt.cc 2 May 2017 07:25:40 -0000 1.9 --- freqt.cc 2 Jun 2017 02:52:46 -0000 1.10 *************** *** 45,48 **** --- 45,49 ---- #include <getopt.h> #include <fstream> + #include <iomanip> #include <iostream> #include <sstream> *************** *** 67,79 **** *stream << " freqt [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of minimum phase sequence [" << kDefaultNumInputOrder << "]" << std::endl; // NOLINT ! *stream << " -M M : order of warped sequence [" << kDefaultNumOutputOrder << "]" << std::endl; // NOLINT ! *stream << " -a a : all-pass constant of input sequence [" << kDefaultInputAlpha << "]" << std::endl; // NOLINT ! *stream << " -A A : all-pass constant of output sequence [" << kDefaultOutputAlpha << "]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " minimum phase sequence (double) [stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; ! *stream << " warped sequence (double)" << std::endl; *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; --- 68,80 ---- *stream << " freqt [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of minimum phase sequence ( int)[" << std::setw(5) << std::right << kDefaultNumInputOrder << "][ 0 <= m <= ]" << std::endl; // NOLINT ! *stream << " -M M : order of warped sequence ( int)[" << std::setw(5) << std::right << kDefaultNumOutputOrder << "][ 0 <= M <= ]" << std::endl; // NOLINT ! *stream << " -a a : all-pass constant of input sequence (double)[" << std::setw(5) << std::right << kDefaultInputAlpha << "][ <= a <= ]" << std::endl; // NOLINT ! *stream << " -A A : all-pass constant of output sequence (double)[" << std::setw(5) << std::right << kDefaultOutputAlpha << "][ <= A <= ]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; ! *stream << " minimum phase sequence (double)[stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; ! *stream << " warped sequence (double)" << std::endl; // NOLINT *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; Index: cepstrum_to_negative_derivative_of_phase_spectrum.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/cepstrum_to_negative_derivative_of_phase_spectrum.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** cepstrum_to_negative_derivative_of_phase_spectrum.cc 25 May 2017 02:43:32 -0000 1.2 --- cepstrum_to_negative_derivative_of_phase_spectrum.cc 2 Jun 2017 02:52:46 -0000 1.3 *************** *** 100,104 **** buffer->fast_fourier_transform_input_.begin() + half_fft_size); ! if (fft_size == 2 * num_order_) { // double the center value of the input because the cepstrum values on // both sides are overlapped at the center --- 100,104 ---- buffer->fast_fourier_transform_input_.begin() + half_fft_size); ! if (half_fft_size == num_order_) { // double the center value of the input because the cepstrum values on // both sides are overlapped at the center |
From: Natsumi K. <koi...@us...> - 2017-05-26 06:52:38
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv12177 Modified Files: Makefile Log Message: change Makefile for a class of b2mc Index: Makefile =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/Makefile,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** Makefile 24 May 2017 07:31:46 -0000 1.33 --- Makefile 26 May 2017 06:52:35 -0000 1.34 *************** *** 76,79 **** --- 76,80 ---- mel_generalized_cepstrum_transform.cc \ mel_generalized_line_spectral_pairs_to_spectrum.cc \ + mlsa_digital_filter_coefficients_to_mel_cepstrum.cc \ mu_law_compression.cc \ mu_law_decompression.cc \ |
From: Natsumi K. <koi...@us...> - 2017-05-26 06:37:49
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv11545 Added Files: mlsa_digital_filter_coefficients_to_mel_cepstrum.h mlsa_digital_filter_coefficients_to_mel_cepstrum.cc b2mc.cc Log Message: add b2mc command --- NEW FILE: mlsa_digital_filter_coefficients_to_mel_cepstrum.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 "mlsa_digital_filter_coefficients_to_mel_cepstrum.h" namespace sptk { MlsaDigitalFilterCoefficientsToMelCepstrum:: MlsaDigitalFilterCoefficientsToMelCepstrum(int num_order, double alpha) : num_order_(num_order), alpha_(alpha), is_valid_(true) { if (num_order_ < 0) { is_valid_ = false; } } bool MlsaDigitalFilterCoefficientsToMelCepstrum::Run( const std::vector<double>& mlsa_digital_filter_coefficients, std::vector<double>* mel_cepstrum) const { // check inputs if (!is_valid_ || mlsa_digital_filter_coefficients.size() != static_cast<std::size_t>(num_order_ + 1) || NULL == mel_cepstrum) { return false; } // prepare memory if (mel_cepstrum->size() < static_cast<std::size_t>(num_order_ + 1)) { mel_cepstrum->resize(num_order_ + 1); } // get values const double* input(&(mlsa_digital_filter_coefficients[0])); double* output(&((*mel_cepstrum)[0])); output[num_order_] = input[num_order_]; for (int i(num_order_ - 1); 0 <= i; --i) { output[i] = input[i] + alpha_ * input[i + 1]; } return true; } } // namespace sptk --- NEW FILE: mlsa_digital_filter_coefficients_to_mel_cepstrum.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_MLSA_DIGITAL_FILTER_COEFFICIENTS_TO_MEL_CEPSTRUM_H_ #define SPTK_SRC_MLSA_DIGITAL_FILTER_COEFFICIENTS_TO_MEL_CEPSTRUM_H_ #include <vector> // std::vector #include "sptk_utils.h" namespace sptk { class MlsaDigitalFilterCoefficientsToMelCepstrum { public: // MlsaDigitalFilterCoefficientsToMelCepstrum(int num_order, double alpha); // virtual ~MlsaDigitalFilterCoefficientsToMelCepstrum() { } // int GetNumOrder() const { return num_order_; } // double GetAlpha() const { return alpha_; } // bool IsValid() const { return is_valid_; } // bool Run(const std::vector<double>& mlsa_digital_filter_coefficients, std::vector<double>* mel_cepstrum) const; private: // const int num_order_; // const double alpha_; // bool is_valid_; // DISALLOW_COPY_AND_ASSIGN(MlsaDigitalFilterCoefficientsToMelCepstrum); }; } // namespace sptk #endif // SPTK_SRC_MLSA_DIGITAL_FILTER_COEFFICIENTS_TO_MEL_CEPSTRUM_H_ --- NEW FILE: b2mc.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 <getopt.h> #include <fstream> #include <iostream> #include <sstream> #include <vector> #include "mlsa_digital_filter_coefficients_to_mel_cepstrum.h" #include "sptk_utils.h" namespace { const int kDefaultNumOrder(25); const double kDefaultAlpha(0.35); void PrintUsage(std::ostream* stream) { // clang-format off *stream << std::endl; *stream << " b2mc - transform MLSA digital filter coefficients to mel-cepstrum" << std::endl; // NOLINT *stream << std::endl; *stream << " usage:" << std::endl; *stream << " b2mc [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; *stream << " -m m : order of mel cepstrum [" << kDefaultNumOrder << "]" << std::endl; // NOLINT *stream << " -a a : all-pass constant [" << kDefaultAlpha << "]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; *stream << " MLSA filter coefficients (double) [stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; *stream << " mel-cepstrum (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 alpha(kDefaultAlpha); for (;;) { const int option_char(getopt_long(argc, argv, "m:a:h", NULL, NULL)); 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("b2mc", 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("b2mc", 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("b2mc", error_message); return 1; } std::istream& input_stream(ifs.fail() ? std::cin : ifs); // prepare for transformation sptk::MlsaDigitalFilterCoefficientsToMelCepstrum mlsa_digital_filter_coefficients_to_mel_cepstrum(num_order, alpha); if (!mlsa_digital_filter_coefficients_to_mel_cepstrum.IsValid()) { std::ostringstream error_message; error_message << "Failed to set the condition"; sptk::PrintErrorMessage("b2mc", error_message); return 1; } const int length(num_order + 1); std::vector<double> mlsa_digital_filter_coefficients(length); std::vector<double> mel_cepstrum(length); while (sptk::ReadStream(false, 0, 0, length, &mlsa_digital_filter_coefficients, &input_stream)) { if (!mlsa_digital_filter_coefficients_to_mel_cepstrum.Run( mlsa_digital_filter_coefficients, &mel_cepstrum)) { std::ostringstream error_message; error_message << "Failed to transform MLSA digital filter coefficients " "to mel-cepstrum"; sptk::PrintErrorMessage("b2mc", error_message); return 1; } if (!sptk::WriteStream(0, length, mel_cepstrum, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write mel-cepstrum"; sptk::PrintErrorMessage("b2mc", error_message); return 1; } } return 0; } |
From: Takenori Y. <tak...@us...> - 2017-05-25 02:43:35
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv9015 Modified Files: cepstrum_to_negative_derivative_of_phase_spectrum.cc Log Message: improve readability Index: cepstrum_to_negative_derivative_of_phase_spectrum.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/cepstrum_to_negative_derivative_of_phase_spectrum.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** cepstrum_to_negative_derivative_of_phase_spectrum.cc 24 May 2017 07:31:46 -0000 1.1 --- cepstrum_to_negative_derivative_of_phase_spectrum.cc 25 May 2017 02:43:32 -0000 1.2 *************** *** 45,49 **** #include "cepstrum_to_negative_derivative_of_phase_spectrum.h" ! #include <algorithm> // std::fill #include <cstddef> // std::size_t --- 45,49 ---- #include "cepstrum_to_negative_derivative_of_phase_spectrum.h" ! #include <algorithm> // std::fill, std::reverse_copy #include <cstddef> // std::size_t *************** *** 83,99 **** &buffer->fast_fourier_transform_input_[0]); ! fast_fourier_transform_input[0] = 0.0; ! for (int i(1); i <= num_order_; ++i) { ! fast_fourier_transform_input[i] = 0.5 * input[i] * i; ! } ! if (fft_size == 2 * num_order_) { ! fast_fourier_transform_input[num_order_] *= 2.0; ! } else { std::fill(buffer->fast_fourier_transform_input_.begin() + num_order_ + 1, ! buffer->fast_fourier_transform_input_.end() - num_order_, 0.0); ! } ! for (int i(1); i <= num_order_; ++i) { ! fast_fourier_transform_input[fft_size - i] = ! fast_fourier_transform_input[i]; } --- 83,108 ---- &buffer->fast_fourier_transform_input_[0]); ! // set a real part input of the fast Fourier transform ! { ! const int half_fft_size(fft_size / 2); ! // fill the left side of the input with cepstrum ! fast_fourier_transform_input[0] = 0.0; ! for (int i(1); i <= num_order_; ++i) { ! fast_fourier_transform_input[i] = 0.5 * input[i] * i; ! } std::fill(buffer->fast_fourier_transform_input_.begin() + num_order_ + 1, ! buffer->fast_fourier_transform_input_.begin() + half_fft_size + 1, ! 0.0); ! // fill the right side of the input by mirroring the left one ! std::reverse_copy( ! buffer->fast_fourier_transform_input_.begin() + 1, ! buffer->fast_fourier_transform_input_.begin() + half_fft_size + 1, ! buffer->fast_fourier_transform_input_.begin() + half_fft_size); ! ! if (fft_size == 2 * num_order_) { ! // double the center value of the input because the cepstrum values on ! // both sides are overlapped at the center ! fast_fourier_transform_input[num_order_] *= 2.0; ! } } |
From: Takenori Y. <tak...@us...> - 2017-05-24 07:31:48
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv16589 Modified Files: Makefile Added Files: cepstrum_to_negative_derivative_of_phase_spectrum.cc cepstrum_to_negative_derivative_of_phase_spectrum.h Log Message: add a class for c2ndps command --- NEW FILE: cepstrum_to_negative_derivative_of_phase_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-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_CEPSTRUM_TO_NEGATIVE_DERIVATIVE_OF_PHASE_SPECTRUM_H_ #define SPTK_SRC_CEPSTRUM_TO_NEGATIVE_DERIVATIVE_OF_PHASE_SPECTRUM_H_ #include <vector> // std::vector #include "fast_fourier_transform_for_real_sequence.h" #include "sptk_utils.h" namespace sptk { class CepstrumToNegativeDerivativeOfPhaseSpectrum { public: class Buffer { public: Buffer() { } virtual ~Buffer() { } private: FastFourierTransformForRealSequence::Buffer fast_fourier_transform_buffer_; std::vector<double> fast_fourier_transform_input_; std::vector<double> fast_fourier_transform_imaginary_part_output_; friend class CepstrumToNegativeDerivativeOfPhaseSpectrum; DISALLOW_COPY_AND_ASSIGN(Buffer); }; // CepstrumToNegativeDerivativeOfPhaseSpectrum(int num_order, int fft_size); // virtual ~CepstrumToNegativeDerivativeOfPhaseSpectrum() { } // int GetNumOrder() const { return num_order_; } // int GetFftSize() const { return fast_fourier_transform_.GetFftSize(); } // bool IsValid() const { return is_valid_; } // bool Run(const std::vector<double>& cepstrum, std::vector<double>* negative_derivative_of_phase_spectrum, CepstrumToNegativeDerivativeOfPhaseSpectrum::Buffer* buffer) const; private: // const int num_order_; // const FastFourierTransformForRealSequence fast_fourier_transform_; // bool is_valid_; // DISALLOW_COPY_AND_ASSIGN(CepstrumToNegativeDerivativeOfPhaseSpectrum); }; } // namespace sptk #endif // SPTK_SRC_CEPSTRUM_TO_NEGATIVE_DERIVATIVE_OF_PHASE_SPECTRUM_H_ Index: Makefile =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/Makefile,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** Makefile 22 May 2017 03:44:10 -0000 1.32 --- Makefile 24 May 2017 07:31:46 -0000 1.33 *************** *** 50,53 **** --- 50,54 ---- autocorrelation.cc \ cepstrum_to_minimum_phase_impulse_response.cc \ + cepstrum_to_negative_derivative_of_phase_spectrum.cc \ data_windowing.cc \ excitation_generation.cc \ --- NEW FILE: cepstrum_to_negative_derivative_of_phase_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-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 "cepstrum_to_negative_derivative_of_phase_spectrum.h" #include <algorithm> // std::fill #include <cstddef> // std::size_t namespace sptk { CepstrumToNegativeDerivativeOfPhaseSpectrum:: CepstrumToNegativeDerivativeOfPhaseSpectrum(int num_order, int fft_size) : num_order_(num_order), fast_fourier_transform_(fft_size - 1, fft_size), is_valid_(true) { if (num_order < 0 || fft_size < 2 * num_order || !fast_fourier_transform_.IsValid()) { is_valid_ = false; } } bool CepstrumToNegativeDerivativeOfPhaseSpectrum::Run( const std::vector<double>& cepstrum, std::vector<double>* negative_derivative_of_phase_spectrum, CepstrumToNegativeDerivativeOfPhaseSpectrum::Buffer* buffer) const { // check inputs if (!is_valid_ || cepstrum.size() != static_cast<std::size_t>(num_order_ + 1) || NULL == negative_derivative_of_phase_spectrum || NULL == buffer) { return false; } // prepare memories const int fft_size(fast_fourier_transform_.GetFftSize()); if (buffer->fast_fourier_transform_input_.size() < static_cast<std::size_t>(fft_size)) { buffer->fast_fourier_transform_input_.resize(fft_size); } const double* input(&(cepstrum[0])); double* fast_fourier_transform_input( &buffer->fast_fourier_transform_input_[0]); fast_fourier_transform_input[0] = 0.0; for (int i(1); i <= num_order_; ++i) { fast_fourier_transform_input[i] = 0.5 * input[i] * i; } if (fft_size == 2 * num_order_) { fast_fourier_transform_input[num_order_] *= 2.0; } else { std::fill(buffer->fast_fourier_transform_input_.begin() + num_order_ + 1, buffer->fast_fourier_transform_input_.end() - num_order_, 0.0); } for (int i(1); i <= num_order_; ++i) { fast_fourier_transform_input[fft_size - i] = fast_fourier_transform_input[i]; } if (!fast_fourier_transform_.Run( buffer->fast_fourier_transform_input_, negative_derivative_of_phase_spectrum, &buffer->fast_fourier_transform_imaginary_part_output_, &buffer->fast_fourier_transform_buffer_)) { return false; } return true; } } // namespace sptk |
From: Natsumi K. <koi...@us...> - 2017-05-24 02:43:41
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv2696 Modified Files: lpc2c.cc Log Message: change the comment of lpc2c Index: lpc2c.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/lpc2c.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** lpc2c.cc 2 May 2017 07:25:40 -0000 1.3 --- lpc2c.cc 24 May 2017 02:43:39 -0000 1.4 *************** *** 137,141 **** std::istream& input_stream(ifs.fail() ? std::cin : ifs); ! // prepare for frequency transform sptk::LinearPredictiveCoefficientsToCepstrum linear_predictive_coefficients_to_cepstrum(num_input_order, --- 137,141 ---- std::istream& input_stream(ifs.fail() ? std::cin : ifs); ! // prepare for transformation sptk::LinearPredictiveCoefficientsToCepstrum linear_predictive_coefficients_to_cepstrum(num_input_order, |
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv19214 Modified Files: Makefile fast_fourier_transform.cc fast_fourier_transform.h fast_fourier_transform_for_real_sequence.cc fast_fourier_transform_for_real_sequence.h fft.cc fftr.cc ifft.cc mel_generalized_cepstrum_to_spectrum.cc mu_law_compression.cc mu_law_compression.h Added Files: inverse_fast_fourier_transform.cc inverse_fast_fourier_transform.h inverse_fast_fourier_transform_for_real_sequence.cc inverse_fast_fourier_transform_for_real_sequence.h iulaw.cc mu_law_decompression.cc mu_law_decompression.h ulaw.cc Log Message: add ulaw command Index: fast_fourier_transform.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/fast_fourier_transform.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** fast_fourier_transform.h 10 May 2017 10:10:13 -0000 1.9 --- fast_fourier_transform.h 22 May 2017 03:44:10 -0000 1.10 *************** *** 55,59 **** public: // ! FastFourierTransform(int num_order, int fft_size, bool inverse); // --- 55,59 ---- public: // ! FastFourierTransform(int num_order, int fft_size); // *************** *** 72,80 **** // - bool GetInverseFlag() const { - return inverse_; - } - - // bool IsValid() const { return is_valid_; --- 72,75 ---- *************** *** 98,104 **** // - const bool inverse_; - - // bool is_valid_; --- 93,96 ---- Index: mu_law_compression.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mu_law_compression.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mu_law_compression.cc 17 May 2017 07:12:59 -0000 1.1 --- mu_law_compression.cc 22 May 2017 03:44:11 -0000 1.2 *************** *** 45,59 **** #include "mu_law_compression.h" ! #include <cmath> // std::fabs, std::log, std::pow namespace sptk { ! MuLawCompression::MuLawCompression(double maximum_value, int compression_factor, ! bool inverse) ! : maximum_value_(maximum_value), compression_factor_(compression_factor), - inverse_(inverse), is_valid_(true) { ! if (maximum_value <= 0.0 || compression_factor <= 0) { is_valid_ = false; } --- 45,58 ---- #include "mu_law_compression.h" ! #include <cmath> // std::fabs, std::log namespace sptk { ! MuLawCompression::MuLawCompression(double absolute_max_value, ! int compression_factor) ! : absolute_max_value_(absolute_max_value), compression_factor_(compression_factor), is_valid_(true) { ! if (absolute_max_value <= 0.0 || compression_factor <= 0) { is_valid_ = false; } *************** *** 65,78 **** } ! const double ratio(std::fabs(input) / maximum_value_); ! if (inverse_) { ! *output = sptk::ExtractSign(input) * maximum_value_ * ! (std::pow(1.0 + compression_factor_, ratio) - 1.0) / ! compression_factor_; ! } else { ! *output = sptk::ExtractSign(input) * maximum_value_ * ! std::log(1.0 + compression_factor_ * ratio) / ! std::log(1.0 + compression_factor_); ! } return true; --- 64,71 ---- } ! const double ratio(std::fabs(input) / absolute_max_value_); ! *output = sptk::ExtractSign(input) * absolute_max_value_ * ! std::log(1.0 + compression_factor_ * ratio) / ! std::log(1.0 + compression_factor_); return true; Index: mu_law_compression.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mu_law_compression.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mu_law_compression.h 17 May 2017 07:12:59 -0000 1.1 --- mu_law_compression.h 22 May 2017 03:44:11 -0000 1.2 *************** *** 53,57 **** public: // ! MuLawCompression(double maximum_value, int compression_factor, bool inverse); // --- 53,57 ---- public: // ! MuLawCompression(double absolute_max_value, int compression_factor); // *************** *** 60,65 **** // ! double GetMaximumValue() const { ! return maximum_value_; } --- 60,65 ---- // ! double GetAbsoluteMaxValue() const { ! return absolute_max_value_; } *************** *** 70,78 **** // - bool GetInverseFlag() const { - return inverse_; - } - - // bool IsValid() const { return is_valid_; --- 70,73 ---- *************** *** 84,88 **** private: // ! const double maximum_value_; // --- 79,83 ---- private: // ! const double absolute_max_value_; // *************** *** 90,96 **** // - const bool inverse_; - - // bool is_valid_; --- 85,88 ---- Index: fast_fourier_transform.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/fast_fourier_transform.cc,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** fast_fourier_transform.cc 10 May 2017 10:10:13 -0000 1.12 --- fast_fourier_transform.cc 22 May 2017 03:44:10 -0000 1.13 *************** *** 51,60 **** 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 || --- 51,58 ---- namespace sptk { ! FastFourierTransform::FastFourierTransform(int num_order, int fft_size) : num_order_(num_order), fft_size_(fft_size), half_fft_size_(fft_size / 2), is_valid_(true) { if (fft_size < 4 || !IsPowerOfTwo(fft_size) || fft_size <= num_order || *************** *** 104,111 **** 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_); --- 102,107 ---- imaginary_part_output->end(), 0.0); ! double* x(&((*real_part_output)[0])); ! double* y(&((*imaginary_part_output)[0])); int lix(fft_size_); *************** *** 172,186 **** } - // normalize - 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; } --- 168,171 ---- Index: fft.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/fft.cc,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** fft.cc 11 May 2017 01:30:43 -0000 1.14 --- fft.cc 22 May 2017 03:44:10 -0000 1.15 *************** *** 180,184 **** // prepare for fast Fourier transform ! sptk::FastFourierTransform fft(num_order, fft_size, false); if (!fft.IsValid()) { std::ostringstream error_message; --- 180,184 ---- // prepare for fast Fourier transform ! sptk::FastFourierTransform fft(num_order, fft_size); if (!fft.IsValid()) { std::ostringstream error_message; --- NEW FILE: iulaw.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 <getopt.h> #include <fstream> #include <iostream> #include <sstream> #include <vector> #include "mu_law_decompression.h" #include "sptk_utils.h" namespace { const double kDefaultAbsoluteMaxValue(32768); const int kDefaultCompressionFactor(255); void PrintUsage(std::ostream* stream) { // clang-format off *stream << std::endl; *stream << " iulaw - inverse u-Law pulse code modulation" << std::endl; *stream << std::endl; *stream << " usage:" << std::endl; *stream << " iulaw [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; *stream << " -v v : absolute maximum of input [" << kDefaultAbsoluteMaxValue << "]" << std::endl; // NOLINT *stream << " -u u : compression factor [" << kDefaultCompressionFactor << "]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; *stream << " input sequence (double) [stdin]" << std::endl; *stream << " stdout:" << std::endl; *stream << " decompressed 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[]) { double absolute_max_value(kDefaultAbsoluteMaxValue); int compression_factor(kDefaultCompressionFactor); for (;;) { const int option_char(getopt_long(argc, argv, "v:u:h", NULL, NULL)); if (-1 == option_char) break; switch (option_char) { case 'v': { if (!sptk::ConvertStringToDouble(optarg, &absolute_max_value) || absolute_max_value <= 0.0) { std::ostringstream error_message; error_message << "The argument for the -v option must be a positive number"; sptk::PrintErrorMessage("iulaw", error_message); return 1; } break; } case 'u': { if (!sptk::ConvertStringToInteger(optarg, &compression_factor) || compression_factor <= 0) { std::ostringstream error_message; error_message << "The argument for the -u option must be a positive integer"; sptk::PrintErrorMessage("iulaw", 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("iulaw", error_message); return 1; } std::istream& input_stream(ifs.fail() ? std::cin : ifs); // prepare for u-law decompression sptk::MuLawDecompression mu_law_decompression(absolute_max_value, compression_factor); if (!mu_law_decompression.IsValid()) { std::ostringstream error_message; error_message << "Failed to set condition for u-Law decompression"; sptk::PrintErrorMessage("iulaw", error_message); return 1; } double input; double output; while (sptk::ReadStream(&input, &input_stream)) { if (!mu_law_decompression.Run(input, &output)) { std::ostringstream error_message; error_message << "Failed to decompress"; sptk::PrintErrorMessage("iulaw", error_message); return 1; } if (!sptk::WriteStream(output, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write a decompressed sequence"; sptk::PrintErrorMessage("iulaw", error_message); return 1; } } return 0; } Index: mel_generalized_cepstrum_to_spectrum.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mel_generalized_cepstrum_to_spectrum.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mel_generalized_cepstrum_to_spectrum.cc 10 May 2017 10:10:13 -0000 1.2 --- mel_generalized_cepstrum_to_spectrum.cc 22 May 2017 03:44:11 -0000 1.3 *************** *** 53,57 **** 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 (!mel_generalized_cepstrum_transform_.IsValid() || --- 53,57 ---- is_normalized, is_multiplied, fft_size / 2, 0.0, 0.0, false, false), ! fast_fourier_transform_(fft_size / 2, fft_size), is_valid_(true) { if (!mel_generalized_cepstrum_transform_.IsValid() || --- NEW FILE: ulaw.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 <getopt.h> #include <fstream> #include <iostream> #include <sstream> #include <vector> #include "mu_law_compression.h" #include "sptk_utils.h" namespace { const double kDefaultAbsoluteMaxValue(32768); const int kDefaultCompressionFactor(255); void PrintUsage(std::ostream* stream) { // clang-format off *stream << std::endl; *stream << " ulaw - u-Law pulse code modulation" << std::endl; *stream << std::endl; *stream << " usage:" << std::endl; *stream << " ulaw [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; *stream << " -v v : absolute maximum of input [" << kDefaultAbsoluteMaxValue << "]" << std::endl; // NOLINT *stream << " -u u : compression factor [" << kDefaultCompressionFactor << "]" << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; *stream << " input sequence (double) [stdin]" << std::endl; *stream << " stdout:" << std::endl; *stream << " compressed 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[]) { double absolute_max_value(kDefaultAbsoluteMaxValue); int compression_factor(kDefaultCompressionFactor); for (;;) { const int option_char(getopt_long(argc, argv, "v:u:h", NULL, NULL)); if (-1 == option_char) break; switch (option_char) { case 'v': { if (!sptk::ConvertStringToDouble(optarg, &absolute_max_value) || absolute_max_value <= 0.0) { std::ostringstream error_message; error_message << "The argument for the -v option must be a positive number"; sptk::PrintErrorMessage("ulaw", error_message); return 1; } break; } case 'u': { if (!sptk::ConvertStringToInteger(optarg, &compression_factor) || compression_factor <= 0) { std::ostringstream error_message; error_message << "The argument for the -u option must be a positive integer"; sptk::PrintErrorMessage("ulaw", 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("ulaw", error_message); return 1; } std::istream& input_stream(ifs.fail() ? std::cin : ifs); // prepare for u-law compression sptk::MuLawCompression mu_law_compression(absolute_max_value, compression_factor); if (!mu_law_compression.IsValid()) { std::ostringstream error_message; error_message << "Failed to set condition for u-Law compression"; sptk::PrintErrorMessage("ulaw", error_message); return 1; } double input; double output; while (sptk::ReadStream(&input, &input_stream)) { if (!mu_law_compression.Run(input, &output)) { std::ostringstream error_message; error_message << "Failed to compress"; sptk::PrintErrorMessage("ulaw", error_message); return 1; } if (!sptk::WriteStream(output, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write a compressed sequence"; sptk::PrintErrorMessage("ulaw", error_message); return 1; } } return 0; } Index: Makefile =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/Makefile,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** Makefile 17 May 2017 10:07:14 -0000 1.31 --- Makefile 22 May 2017 03:44:10 -0000 1.32 *************** *** 64,67 **** --- 64,69 ---- input_source_interpolation_with_magic_number.cc \ input_source_preprocessing_for_filter_gain.cc \ + inverse_fast_fourier_transform.cc \ + inverse_fast_fourier_transform_for_real_sequence.cc \ levinson_durbin_recursion.cc \ line_spectral_pairs_to_linear_predictive_coefficients.cc \ *************** *** 74,77 **** --- 76,80 ---- mel_generalized_line_spectral_pairs_to_spectrum.cc \ mu_law_compression.cc \ + mu_law_decompression.cc \ normal_distributed_random_value_generation.cc \ parcor_coefficients_to_linear_predictive_coefficients.cc \ Index: fftr.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/fftr.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** fftr.cc 11 May 2017 01:30:43 -0000 1.5 --- fftr.cc 22 May 2017 03:44:10 -0000 1.6 *************** *** 187,191 **** // prepare for fast Fourier transform ! sptk::FastFourierTransformForRealSequence fft(num_order, fft_size, false); sptk::FastFourierTransformForRealSequence::Buffer buffer; if (!fft.IsValid()) { --- 187,191 ---- // prepare for fast Fourier transform ! sptk::FastFourierTransformForRealSequence fft(num_order, fft_size); sptk::FastFourierTransformForRealSequence::Buffer buffer; if (!fft.IsValid()) { Index: ifft.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/ifft.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ifft.cc 15 Mar 2017 13:38:04 -0000 1.8 --- ifft.cc 22 May 2017 03:44:10 -0000 1.9 *************** *** 49,53 **** #include <vector> ! #include "fast_fourier_transform.h" #include "sptk_utils.h" --- 49,53 ---- #include <vector> ! #include "inverse_fast_fourier_transform.h" #include "sptk_utils.h" *************** *** 148,154 **** 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"; --- 148,154 ---- std::istream& input_stream(ifs.fail() ? std::cin : ifs); ! // prepare for inverse fast Fourier transform ! sptk::InverseFastFourierTransform inverse_fft(fft_size - 1, fft_size); ! if (!inverse_fft.IsValid()) { std::ostringstream error_message; error_message << "FFT size must be a power of 2 and greater than 2"; *************** *** 164,168 **** while (sptk::ReadStream(false, 0, 0, fft_size, &input_x, &input_stream) && sptk::ReadStream(false, 0, 0, fft_size, &input_y, &input_stream)) { ! if (!fft.Run(input_x, input_y, &output_x, &output_y)) { std::ostringstream error_message; error_message << "Failed to run inverse fast Fourier transform"; --- 164,168 ---- while (sptk::ReadStream(false, 0, 0, fft_size, &input_x, &input_stream) && sptk::ReadStream(false, 0, 0, fft_size, &input_y, &input_stream)) { ! if (!inverse_fft.Run(input_x, input_y, &output_x, &output_y)) { std::ostringstream error_message; error_message << "Failed to run inverse fast Fourier transform"; --- NEW FILE: inverse_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-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 "inverse_fast_fourier_transform_for_real_sequence.h" #include <algorithm> // std::transform #include <cstddef> // std::size_t #include <functional> // std::bind1st, std::multiplies namespace sptk { InverseFastFourierTransformForRealSequence:: InverseFastFourierTransformForRealSequence(int num_order, int fft_size) : fast_fourier_transform_(num_order, fft_size) { } bool InverseFastFourierTransformForRealSequence::Run( const std::vector<double>& real_part_input, std::vector<double>* real_part_output, std::vector<double>* imaginary_part_output, InverseFastFourierTransformForRealSequence::Buffer* buffer) const { // check inputs if (!fast_fourier_transform_.IsValid() || real_part_input.size() != static_cast<std::size_t>(fast_fourier_transform_.GetNumOrder() + 1) || NULL == real_part_output || NULL == imaginary_part_output || NULL == buffer) { return false; } if (fast_fourier_transform_.Run(real_part_input, real_part_output, imaginary_part_output, &buffer->fast_fourier_transform_buffer_)) { return false; } const int fft_size(fast_fourier_transform_.GetFftSize()); const double inverse_fft_size(1.0 / fft_size); std::transform(real_part_output->begin(), real_part_output->begin() + fft_size, real_part_output->begin(), std::bind1st(std::multiplies<double>(), inverse_fft_size)); std::transform(imaginary_part_output->begin(), imaginary_part_output->begin() + fft_size, imaginary_part_output->begin(), std::bind1st(std::multiplies<double>(), inverse_fft_size)); 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.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** fast_fourier_transform_for_real_sequence.cc 10 May 2017 10:10:13 -0000 1.3 --- fast_fourier_transform_for_real_sequence.cc 22 May 2017 03:44:10 -0000 1.4 *************** *** 52,61 **** 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() || !IsPowerOfTwo(fft_size) || --- 52,60 ---- FastFourierTransformForRealSequence::FastFourierTransformForRealSequence( ! int num_order, int fft_size) : num_order_(num_order), fft_size_(fft_size), half_fft_size_(fft_size / 2), ! fast_fourier_transform_(half_fft_size_ - 1, half_fft_size_), is_valid_(true) { if (!fast_fourier_transform_.IsValid() || !IsPowerOfTwo(fft_size) || *************** *** 155,168 **** } - 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; } --- 154,157 ---- --- NEW FILE: mu_law_decompression.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_MU_LAW_DECOMPRESSION_H_ #define SPTK_SRC_MU_LAW_DECOMPRESSION_H_ #include "sptk_utils.h" namespace sptk { class MuLawDecompression { public: // MuLawDecompression(double absolute_max_value, int compression_factor); // virtual ~MuLawDecompression() { } // double GetAbsoluteMaxValue() const { return absolute_max_value_; } // int GetCompressionFactor() const { return compression_factor_; } // bool IsValid() const { return is_valid_; } // bool Run(double input, double* output) const; private: // const double absolute_max_value_; // const int compression_factor_; // bool is_valid_; // DISALLOW_COPY_AND_ASSIGN(MuLawDecompression); }; } // namespace sptk #endif // SPTK_SRC_MU_LAW_DECOMPRESSION_H_ --- NEW FILE: inverse_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-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_INVERSE_FAST_FOURIER_TRANSFORM_FOR_REAL_SEQUENCE_H_ #define SPTK_SRC_INVERSE_FAST_FOURIER_TRANSFORM_FOR_REAL_SEQUENCE_H_ #include <vector> // std::vector #include "fast_fourier_transform_for_real_sequence.h" #include "sptk_utils.h" namespace sptk { class InverseFastFourierTransformForRealSequence { public: class Buffer { public: Buffer() { } virtual ~Buffer() { } private: FastFourierTransformForRealSequence::Buffer fast_fourier_transform_buffer_; friend class InverseFastFourierTransformForRealSequence; DISALLOW_COPY_AND_ASSIGN(Buffer); }; // InverseFastFourierTransformForRealSequence(int num_order, int fft_size); // virtual ~InverseFastFourierTransformForRealSequence() { } // int GetNumOrder() const { return fast_fourier_transform_.GetNumOrder(); } // int GetFftSize() const { return fast_fourier_transform_.GetFftSize(); } // bool IsValid() const { return fast_fourier_transform_.IsValid(); } // bool Run(const std::vector<double>& real_part_input, std::vector<double>* real_part_output, std::vector<double>* imaginary_part_output, InverseFastFourierTransformForRealSequence::Buffer* buffer) const; private: // const FastFourierTransformForRealSequence fast_fourier_transform_; // DISALLOW_COPY_AND_ASSIGN(InverseFastFourierTransformForRealSequence); }; } // namespace sptk #endif // SPTK_SRC_INVERSE_FAST_FOURIER_TRANSFORM_FOR_REAL_SEQUENCE_H_ 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.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** fast_fourier_transform_for_real_sequence.h 10 May 2017 10:10:13 -0000 1.3 --- fast_fourier_transform_for_real_sequence.h 22 May 2017 03:44:10 -0000 1.4 *************** *** 70,75 **** // ! FastFourierTransformForRealSequence(int num_order, int fft_size, ! bool inverse); // --- 70,74 ---- // ! FastFourierTransformForRealSequence(int num_order, int fft_size); // *************** *** 88,96 **** // - bool GetInverseFlag() const { - return inverse_; - } - - // bool IsValid() const { return is_valid_; --- 87,90 ---- *************** *** 114,120 **** // - const bool inverse_; - - // const FastFourierTransform fast_fourier_transform_; --- 108,111 ---- --- NEW FILE: mu_law_decompression.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 "mu_law_decompression.h" #include <cmath> // std::fabs, std::pow namespace sptk { MuLawDecompression::MuLawDecompression(double absolute_max_value, int compression_factor) : absolute_max_value_(absolute_max_value), compression_factor_(compression_factor), is_valid_(true) { if (absolute_max_value <= 0.0 || compression_factor <= 0) { is_valid_ = false; } } bool MuLawDecompression::Run(double input, double* output) const { if (!is_valid_ || NULL == output) { return false; } const double ratio(std::fabs(input) / absolute_max_value_); *output = sptk::ExtractSign(input) * absolute_max_value_ * (std::pow(1.0 + compression_factor_, ratio) - 1.0) / compression_factor_; return true; } } // namespace sptk --- NEW FILE: inverse_fast_fourier_transform.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 "inverse_fast_fourier_transform.h" #include <algorithm> // std::transform #include <cstddef> // std::size_t #include <functional> // std::bind1st, std::multiplies namespace sptk { InverseFastFourierTransform::InverseFastFourierTransform(int num_order, int fft_size) : fast_fourier_transform_(num_order, fft_size) { } bool InverseFastFourierTransform::Run( const std::vector<double>& real_part_input, const std::vector<double>& imaginary_part_input, std::vector<double>* real_part_output, std::vector<double>* imaginary_part_output) const { // check inputs if (!fast_fourier_transform_.IsValid() || real_part_input.size() != static_cast<std::size_t>(fast_fourier_transform_.GetNumOrder() + 1) || imaginary_part_input.size() != static_cast<std::size_t>(fast_fourier_transform_.GetNumOrder() + 1) || NULL == real_part_output || NULL == imaginary_part_output) { return false; } if (!fast_fourier_transform_.Run(imaginary_part_input, real_part_input, imaginary_part_output, real_part_output)) { return false; } const int fft_size(fast_fourier_transform_.GetFftSize()); const double inverse_fft_size(1.0 / fft_size); std::transform(real_part_output->begin(), real_part_output->begin() + fft_size, real_part_output->begin(), std::bind1st(std::multiplies<double>(), inverse_fft_size)); std::transform(imaginary_part_output->begin(), imaginary_part_output->begin() + fft_size, imaginary_part_output->begin(), std::bind1st(std::multiplies<double>(), inverse_fft_size)); return true; } } // namespace sptk --- NEW FILE: inverse_fast_fourier_transform.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_INVERSE_FAST_FOURIER_TRANSFORM_H_ #define SPTK_SRC_INVERSE_FAST_FOURIER_TRANSFORM_H_ #include <vector> // std::vector #include "fast_fourier_transform.h" #include "sptk_utils.h" namespace sptk { class InverseFastFourierTransform { public: // InverseFastFourierTransform(int num_order, int fft_size); // virtual ~InverseFastFourierTransform() { } int GetNumOrder() const { return fast_fourier_transform_.GetNumOrder(); } // int GetFftSize() const { return fast_fourier_transform_.GetFftSize(); } // bool IsValid() const { return fast_fourier_transform_.IsValid(); } // bool Run(const std::vector<double>& real_part_input, const std::vector<double>& imaginary_part_input, std::vector<double>* real_part_output, std::vector<double>* imaginary_part_output) const; private: // const FastFourierTransform fast_fourier_transform_; // DISALLOW_COPY_AND_ASSIGN(InverseFastFourierTransform); }; } // namespace sptk #endif // SPTK_SRC_INVERSE_FAST_FOURIER_TRANSFORM_H_ |
From: Takenori Y. <tak...@us...> - 2017-05-17 15:16:07
|
Update of /cvsroot/sp-tk/SPTK/src/bin/ndps2c In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv1756/ndps2c Modified Files: _ndps2c.c Log Message: fix bugs Index: _ndps2c.c =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/ndps2c/_ndps2c.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** _ndps2c.c 22 Dec 2016 10:53:09 -0000 1.4 --- _ndps2c.c 17 May 2017 15:16:04 -0000 1.5 *************** *** 90,94 **** c[i] = nx[i] / (i * l / 2.0); if (m == l / 2) ! c[m] = nx[m] / 2.0; free(nx); --- 90,94 ---- c[i] = nx[i] / (i * l / 2.0); if (m == l / 2) ! c[m] = c[m] / 2.0; free(nx); |
From: Takenori Y. <tak...@us...> - 2017-05-17 10:07:17
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv18633 Modified Files: Makefile Log Message: add MuLawCompression class Index: Makefile =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/Makefile,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Makefile 9 May 2017 07:17:18 -0000 1.30 --- Makefile 17 May 2017 10:07:14 -0000 1.31 *************** *** 73,76 **** --- 73,77 ---- mel_generalized_cepstrum_transform.cc \ mel_generalized_line_spectral_pairs_to_spectrum.cc \ + mu_law_compression.cc \ normal_distributed_random_value_generation.cc \ parcor_coefficients_to_linear_predictive_coefficients.cc \ |
From: Takenori Y. <tak...@us...> - 2017-05-17 07:13:01
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv11549 Modified Files: sptk_utils.cc sptk_utils.h Added Files: mu_law_compression.cc mu_law_compression.h Log Message: add MuLawCompression class --- NEW FILE: mu_law_compression.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 "mu_law_compression.h" #include <cmath> // std::fabs, std::log, std::pow namespace sptk { MuLawCompression::MuLawCompression(double maximum_value, int compression_factor, bool inverse) : maximum_value_(maximum_value), compression_factor_(compression_factor), inverse_(inverse), is_valid_(true) { if (maximum_value <= 0.0 || compression_factor <= 0) { is_valid_ = false; } } bool MuLawCompression::Run(double input, double* output) const { if (!is_valid_ || NULL == output) { return false; } const double ratio(std::fabs(input) / maximum_value_); if (inverse_) { *output = sptk::ExtractSign(input) * maximum_value_ * (std::pow(1.0 + compression_factor_, ratio) - 1.0) / compression_factor_; } else { *output = sptk::ExtractSign(input) * maximum_value_ * std::log(1.0 + compression_factor_ * ratio) / std::log(1.0 + compression_factor_); } return true; } } // namespace sptk --- NEW FILE: mu_law_compression.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_MU_LAW_COMPRESSION_H_ #define SPTK_SRC_MU_LAW_COMPRESSION_H_ #include "sptk_utils.h" namespace sptk { class MuLawCompression { public: // MuLawCompression(double maximum_value, int compression_factor, bool inverse); // virtual ~MuLawCompression() { } // double GetMaximumValue() const { return maximum_value_; } // int GetCompressionFactor() const { return compression_factor_; } // bool GetInverseFlag() const { return inverse_; } // bool IsValid() const { return is_valid_; } // bool Run(double input, double* output) const; private: // const double maximum_value_; // const int compression_factor_; // const bool inverse_; // bool is_valid_; // DISALLOW_COPY_AND_ASSIGN(MuLawCompression); }; } // namespace sptk #endif // SPTK_SRC_MU_LAW_COMPRESSION_H_ Index: sptk_utils.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/sptk_utils.cc,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** sptk_utils.cc 3 Apr 2017 02:03:06 -0000 1.15 --- sptk_utils.cc 17 May 2017 07:12:59 -0000 1.16 *************** *** 199,202 **** --- 199,208 ---- } + int ExtractSign(double x) { + if (0.0 < x) return 1; + if (x < 0.0) return -1; + return 0; + } + double FloorLog(double x) { return (x <= 0.0) ? sptk::kLogZero : std::log(x); Index: sptk_utils.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/sptk_utils.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** sptk_utils.h 3 Apr 2017 02:03:06 -0000 1.11 --- sptk_utils.h 17 May 2017 07:12:59 -0000 1.12 *************** *** 83,86 **** --- 83,87 ---- bool IsInRange(int num, int min, int max); bool IsPowerOfTwo(int num); + int ExtractSign(double x); double FloorLog(double x); double AddInLogSpace(double log_x, double log_y); |
From: fujishita t. <fjs...@us...> - 2017-05-16 11:00:19
|
Update of /cvsroot/sp-tk/SPTK/src/bin/levdur In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv28682 Modified Files: levdur.c _levdur.c Log Message: modify the default value of -f option Index: _levdur.c =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/levdur/_levdur.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** _levdur.c 22 Dec 2016 10:53:06 -0000 1.23 --- _levdur.c 16 May 2017 11:00:17 -0000 1.24 *************** *** 55,59 **** double *a : LP coefficients int m : order of LPC ! double eps : singular check (eps(if -1., 1.0e-6 is assumed)) return value : 0 -> normally completed --- 55,59 ---- double *a : LP coefficients int m : order of LPC ! double eps : singular check (eps(if -1., 0.0 is assumed)) return value : 0 -> normally completed *************** *** 92,96 **** if (eps < 0.0) ! eps = 1.0e-6; rmd = r[0]; #ifdef WIN32 --- 92,96 ---- if (eps < 0.0) ! eps = 0.0; rmd = r[0]; #ifdef WIN32 Index: levdur.c =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/levdur/levdur.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** levdur.c 25 Dec 2016 05:00:19 -0000 1.29 --- levdur.c 16 May 2017 11:00:17 -0000 1.30 *************** *** 56,60 **** * -m m : order of correlation [25] * * -f f : mimimum value of the determinant * ! * of the normal matrix [0.000001] * * infile: * * autocorrelation * --- 56,60 ---- * -m m : order of correlation [25] * * -f f : mimimum value of the determinant * ! * of the normal matrix [0.0] * * infile: * * autocorrelation * *************** *** 94,98 **** /* Default Values */ #define ORDER 25 ! #define MINDET 0.000001 /* Command Name */ --- 94,98 ---- /* Default Values */ #define ORDER 25 ! #define MINDET 0.0 /* Command Name */ |
From: fujishita t. <fjs...@us...> - 2017-05-16 10:58:50
|
Update of /cvsroot/sp-tk/SPTK/doc/ref_e In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv28571 Modified Files: levdur.tex Log Message: modify the default value of -f option Index: levdur.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/levdur.tex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** levdur.tex 22 Dec 2016 10:52:58 -0000 1.24 --- levdur.tex 16 May 2017 10:58:48 -0000 1.25 *************** *** 117,121 **** \begin{options} \argm{m}{M}{order of correlation}{25} ! \argm{f}{F}{mimimum value of the determinant of the normal matrix}{0.000001} \end{options} --- 117,121 ---- \begin{options} \argm{m}{M}{order of correlation}{25} ! \argm{f}{F}{mimimum value of the determinant of the normal matrix}{0.0} \end{options} *************** *** 129,132 **** --- 129,137 ---- \end{qsection} + \begin{qsection}{NOTICE} + The default value for -f option is zero as a trial. In the previous version, the + default value is 1.0E-6. + \end{qsection} + \begin{qsection}{SEE ALSO} \hyperlink{acorr}{acorr}, |