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: Takenori Y. <tak...@us...> - 2017-05-12 08:29:31
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv14231 Added Files: decimate.cc Log Message: add decimate command --- NEW FILE: decimate.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 "sptk_utils.h" namespace { const int kDefaultStartIndex(0); const int kDefaultVectorLength(1); const int kDefaultDecimationPeriod(10); void PrintUsage(std::ostream* stream) { // clang-format off *stream << std::endl; *stream << " decimate - data decimation" << std::endl; *stream << std::endl; *stream << " usage:" << std::endl; *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; *stream << std::endl; // clang-format on } } // namespace int main(int argc, char* argv[]) { int start_index(kDefaultStartIndex); int vector_length(kDefaultVectorLength); int decimation_period(kDefaultDecimationPeriod); for (;;) { const int option_char(getopt_long(argc, argv, "s:l:p:h", NULL, NULL)); if (-1 == option_char) break; switch (option_char) { case 's': { if (!sptk::ConvertStringToInteger(optarg, &start_index) || start_index < 0) { std::ostringstream error_message; error_message << "The argument for the -s option must be a " << "non-negative integer"; sptk::PrintErrorMessage("decimate", error_message); return 1; } break; } case 'l': { if (!sptk::ConvertStringToInteger(optarg, &vector_length) || vector_length <= 0) { std::ostringstream error_message; error_message << "The argument for the -l option must be a positive integer"; sptk::PrintErrorMessage("decimate", error_message); return 1; } break; } case 'p': { if (!sptk::ConvertStringToInteger(optarg, &decimation_period) || decimation_period <= 0) { std::ostringstream error_message; error_message << "The argument for the -p option must be a positive integer"; sptk::PrintErrorMessage("decimate", 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("decimate", error_message); return 1; } std::istream& input_stream(ifs.fail() ? std::cin : ifs); std::vector<double> input_data(vector_length); // skip data for (int frame_index(0); frame_index < start_index; ++frame_index) { if (!sptk::ReadStream(false, 0, 0, vector_length, &input_data, &input_stream)) { std::ostringstream error_message; error_message << "Start index exceeds data length"; sptk::PrintErrorMessage("decimate", error_message); return 1; } } for (int frame_index(0); sptk::ReadStream(false, 0, 0, vector_length, &input_data, &input_stream); ++frame_index) { if (0 == frame_index % decimation_period) { if (!sptk::WriteStream(0, vector_length, input_data, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write decimated data sequence"; sptk::PrintErrorMessage("decimate", error_message); return 1; } frame_index = 0; } } return 0; } |
From: fujishita t. <fjs...@us...> - 2017-05-11 10:45:54
|
Update of /cvsroot/sp-tk/SPTK/src/bin/echo2 In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv14375 Modified Files: echo2.c Log Message: modify -n option Index: echo2.c =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/echo2/echo2.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** echo2.c 22 Dec 2016 10:53:02 -0000 1.25 --- echo2.c 11 May 2017 10:45:52 -0000 1.26 *************** *** 52,56 **** * echo2 [ options ] * * options: * ! * -n : no output newline [TRUE] * * * ************************************************************************/ --- 52,56 ---- * echo2 [ options ] * * options: * ! * -n : no output newline [FALSE] * * * ************************************************************************/ *************** *** 80,84 **** /* Default Values */ ! #define NEWLINE TR char *BOOL[] = { "FALSE", "TRUE" }; --- 80,84 ---- /* Default Values */ ! #define NONEWLINE FA char *BOOL[] = { "FALSE", "TRUE" }; *************** *** 95,99 **** fprintf(stderr, " %s [ options ]\n", cmnd); fprintf(stderr, " options:\n"); ! fprintf(stderr, " -n : no output newline [%s]\n", BOOL[NEWLINE]); fprintf(stderr, " -h : print this message\n"); #ifdef PACKAGE_VERSION --- 95,99 ---- fprintf(stderr, " %s [ options ]\n", cmnd); fprintf(stderr, " options:\n"); ! fprintf(stderr, " -n : no output newline [%s]\n", BOOL[NONEWLINE]); fprintf(stderr, " -h : print this message\n"); #ifdef PACKAGE_VERSION *************** *** 108,112 **** int main(int argc, char **argv) { ! int newline = NEWLINE; if ((cmnd = strrchr(argv[0], '/')) == NULL) --- 108,112 ---- int main(int argc, char **argv) { ! int nonewline = NONEWLINE; if ((cmnd = strrchr(argv[0], '/')) == NULL) *************** *** 118,122 **** switch (*(*argv + 1)) { case 'n': ! newline = 1 - newline; break; case 'h': --- 118,122 ---- switch (*(*argv + 1)) { case 'n': ! nonewline = 1 - nonewline; break; case 'h': *************** *** 133,137 **** } ! if (newline) putc('\n', stderr); --- 133,137 ---- } ! if (!nonewline) putc('\n', stderr); |
From: Takenori Y. <tak...@us...> - 2017-05-11 01:30:45
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv18881 Modified Files: data_windowing.cc fft.cc fftr.cc Added Files: window.cc Log Message: add window command Index: data_windowing.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/data_windowing.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** data_windowing.cc 9 May 2017 07:18:07 -0000 1.1 --- data_windowing.cc 11 May 2017 01:30:43 -0000 1.2 *************** *** 59,63 **** num_output_order_(num_output_order), is_valid_(true) { ! if (num_input_order_ < 0 || num_output_order_ < 0) { is_valid_ = false; return; --- 59,63 ---- num_output_order_(num_output_order), is_valid_(true) { ! if (num_input_order_ < 0 || num_output_order_ < num_input_order_) { is_valid_ = false; return; *************** *** 145,158 **** } - const int valid_length(input_length <= output_length ? input_length - : output_length); - // apply window ! std::transform(data_sequence.begin(), data_sequence.begin() + valid_length, window_.begin(), windowed_data_sequence->begin(), std::multiplies<double>()); // fill zero ! std::fill(windowed_data_sequence->begin() + valid_length, windowed_data_sequence->end(), 0.0); --- 145,155 ---- } // apply window ! std::transform(data_sequence.begin(), data_sequence.begin() + input_length, window_.begin(), windowed_data_sequence->begin(), std::multiplies<double>()); // fill zero ! std::fill(windowed_data_sequence->begin() + input_length, windowed_data_sequence->end(), 0.0); --- NEW FILE: window.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 "data_windowing.h" #include "sptk_utils.h" namespace { const int kDefaultFrameLength(256); const sptk::DataWindowing::NormalizationType kDefaultNormalizationType( sptk::DataWindowing::NormalizationType::kPower); const sptk::DataWindowing::WindowType kDefaultWindowType( sptk::DataWindowing::WindowType::kBlackman); void PrintUsage(std::ostream* stream) { // clang-format off *stream << std::endl; *stream << " window - data windowing" << std::endl; *stream << std::endl; *stream << " usage:" << std::endl; *stream << " window [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; *stream << " -l l : frame length of data sequence [" << kDefaultFrameLength << "]" << std::endl; // NOLINT *stream << " -L L : frame length of windowed data sequence [l]" << std::endl; // NOLINT *stream << " -n n : normalization type [" << kDefaultNormalizationType << "]" << std::endl; // NOLINT *stream << " 0 (none)" << std::endl; *stream << " 1 (power)" << std::endl; *stream << " 2 (magnitude)" << std::endl; *stream << " -w w : window type [" << kDefaultWindowType << "]" << std::endl; // NOLINT *stream << " 0 (Blackman)" << std::endl; *stream << " 1 (Hamming)" << std::endl; *stream << " 2 (Hanning)" << std::endl; *stream << " 3 (Bartlett)" << std::endl; *stream << " 4 (trapezoidal)" << std::endl; *stream << " 5 (rectangular)" << std::endl; *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; *stream << " data sequence (double) [stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; *stream << " windowed data sequence (double)" << std::endl; *stream << " notice:" << std::endl; *stream << " if -L is specified, the given frame length must satisfy L >= l" << 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 input_length(kDefaultFrameLength); int output_length(kDefaultFrameLength); bool is_output_length_specified(false); sptk::DataWindowing::NormalizationType normalization_type( kDefaultNormalizationType); sptk::DataWindowing::WindowType window_type(kDefaultWindowType); for (;;) { const int option_char(getopt_long(argc, argv, "l:L:n:w:h", NULL, NULL)); if (-1 == option_char) break; switch (option_char) { case 'l': { if (!sptk::ConvertStringToInteger(optarg, &input_length) || input_length <= 0) { std::ostringstream error_message; error_message << "The argument for the -l option must be a positive integer"; sptk::PrintErrorMessage("window", error_message); return 1; } break; } case 'L': { if (!sptk::ConvertStringToInteger(optarg, &output_length) || output_length <= 0) { std::ostringstream error_message; error_message << "The argument for the -L option must be a positive integer"; sptk::PrintErrorMessage("window", error_message); return 1; } is_output_length_specified = true; break; } case 'n': { const int min(0); const int max(static_cast<int>(sptk::DataWindowing::NormalizationType:: kNumNormalizationTypes) - 1); int tmp; if (!sptk::ConvertStringToInteger(optarg, &tmp) || !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; error_message << "The argument for the -n option must be an integer " << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("window", error_message); return 1; } normalization_type = static_cast<sptk::DataWindowing::NormalizationType>(tmp); break; } case 'w': { const int min(0); const int max( static_cast<int>(sptk::DataWindowing::WindowType::kNumWindowTypes) - 1); int tmp; if (!sptk::ConvertStringToInteger(optarg, &tmp) || !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; error_message << "The argument for the -w option must be an integer " << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("window", error_message); return 1; } window_type = static_cast<sptk::DataWindowing::WindowType>(tmp); break; } case 'h': { PrintUsage(&std::cout); return 0; } default: { PrintUsage(&std::cerr); return 1; } } } // check length if (!is_output_length_specified) { output_length = input_length; } else if (output_length < input_length) { std::ostringstream error_message; error_message << "The length of data sequence " << input_length << " must be equal to or less than that of windowed one " << output_length; sptk::PrintErrorMessage("window", 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("window", error_message); return 1; } std::istream& input_stream(ifs.fail() ? std::cin : ifs); sptk::DataWindowing data_windowing(input_length - 1, output_length - 1, normalization_type, window_type); if (!data_windowing.IsValid()) { std::ostringstream error_message; error_message << "Failed to set condition for data windowing"; sptk::PrintErrorMessage("window", error_message); return 1; } std::vector<double> data_sequence(input_length); std::vector<double> windowed_data_sequence(output_length); while (sptk::ReadStream(false, 0, 0, input_length, &data_sequence, &input_stream)) { if (!data_windowing.Run(data_sequence, &windowed_data_sequence)) { std::ostringstream error_message; error_message << "Failed to apply a window function"; sptk::PrintErrorMessage("window", error_message); return 1; } if (!sptk::WriteStream(0, output_length, windowed_data_sequence, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write windowed data sequence"; sptk::PrintErrorMessage("window", error_message); return 1; } } return 0; } Index: fft.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/fft.cc,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** fft.cc 2 May 2017 07:10:22 -0000 1.13 --- fft.cc 11 May 2017 01:30:43 -0000 1.14 *************** *** 155,168 **** // check order ! if (is_num_order_specified) { ! if (fft_size <= num_order) { ! std::ostringstream error_message; ! error_message << "The order of data sequence " << num_order ! << " must be less than FFT size " << fft_size; ! sptk::PrintErrorMessage("fft", error_message); ! return 1; ! } ! } else { num_order = fft_size - 1; } --- 155,166 ---- // check order ! if (!is_num_order_specified) { num_order = fft_size - 1; + } else if (fft_size <= num_order) { + std::ostringstream error_message; + error_message << "The order of data sequence " << num_order + << " must be less than FFT size " << fft_size; + sptk::PrintErrorMessage("fft", error_message); + return 1; } Index: fftr.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/fftr.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** fftr.cc 2 May 2017 07:10:22 -0000 1.4 --- fftr.cc 11 May 2017 01:30:43 -0000 1.5 *************** *** 162,175 **** // check order ! if (is_num_order_specified) { ! if (fft_size <= num_order) { ! std::ostringstream error_message; ! error_message << "The order of data sequence " << num_order ! << " must be less than FFT size " << fft_size; ! sptk::PrintErrorMessage("fftr", error_message); ! return 1; ! } ! } else { num_order = fft_size - 1; } --- 162,173 ---- // check order ! if (!is_num_order_specified) { num_order = fft_size - 1; + } else if (fft_size <= num_order) { + std::ostringstream error_message; + error_message << "The order of data sequence " << num_order + << " must be less than FFT size " << fft_size; + sptk::PrintErrorMessage("fftr", error_message); + return 1; } |
From: Takenori Y. <tak...@us...> - 2017-05-10 11:36:22
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv22045 Modified Files: excite.cc ltcdf.cc merge.cc poledf.cc zerodf.cc Log Message: fix typo Index: excite.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/excite.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** excite.cc 2 May 2017 07:10:22 -0000 1.7 --- excite.cc 10 May 2017 11:36:20 -0000 1.8 *************** *** 151,156 **** if (frame_period / 2 < interpolation_period) { std::ostringstream error_message; ! error_message ! << "Interpolation period must be equal or less than half frame period"; sptk::PrintErrorMessage("excite", error_message); return 1; --- 151,156 ---- if (frame_period / 2 < interpolation_period) { std::ostringstream error_message; ! error_message << "Interpolation period must be equal to or less than half " ! << "frame period"; sptk::PrintErrorMessage("excite", error_message); return 1; Index: ltcdf.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/ltcdf.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ltcdf.cc 2 May 2017 07:10:22 -0000 1.4 --- ltcdf.cc 10 May 2017 11:36:20 -0000 1.5 *************** *** 150,155 **** if (frame_period / 2 < interpolation_period) { std::ostringstream error_message; ! error_message ! << "Interpolation period must be equal or less than half frame period"; sptk::PrintErrorMessage("ltcdf", error_message); return 1; --- 150,155 ---- if (frame_period / 2 < interpolation_period) { std::ostringstream error_message; ! error_message << "Interpolation period must be equal to or less than half " ! << "frame period"; sptk::PrintErrorMessage("ltcdf", error_message); return 1; Index: merge.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/merge.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** merge.cc 2 May 2017 07:10:22 -0000 1.2 --- merge.cc 10 May 2017 11:36:20 -0000 1.3 *************** *** 375,379 **** if (input_length < insert_point) { std::ostringstream error_message; ! error_message << "Insert point must be equal or less than input length"; sptk::PrintErrorMessage("merge", error_message); return 1; --- 375,379 ---- if (input_length < insert_point) { std::ostringstream error_message; ! error_message << "Insert point must be equal to or less than input length"; sptk::PrintErrorMessage("merge", error_message); return 1; Index: zerodf.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/zerodf.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** zerodf.cc 2 May 2017 07:10:22 -0000 1.5 --- zerodf.cc 10 May 2017 11:36:20 -0000 1.6 *************** *** 157,162 **** if (frame_period / 2 < interpolation_period) { std::ostringstream error_message; ! error_message ! << "Interpolation period must be equal or less than half frame period"; sptk::PrintErrorMessage("zerodf", error_message); return 1; --- 157,162 ---- if (frame_period / 2 < interpolation_period) { std::ostringstream error_message; ! error_message << "Interpolation period must be equal to or less than half " ! << "frame period"; sptk::PrintErrorMessage("zerodf", error_message); return 1; Index: poledf.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/poledf.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** poledf.cc 2 May 2017 07:10:22 -0000 1.7 --- poledf.cc 10 May 2017 11:36:20 -0000 1.8 *************** *** 157,162 **** if (frame_period / 2 < interpolation_period) { std::ostringstream error_message; ! error_message ! << "Interpolation period must be equal or less than half frame period"; sptk::PrintErrorMessage("poledf", error_message); return 1; --- 157,162 ---- if (frame_period / 2 < interpolation_period) { std::ostringstream error_message; ! error_message << "Interpolation period must be equal to or less than half " ! << "frame period"; sptk::PrintErrorMessage("poledf", error_message); return 1; |
Update of /cvsroot/sp-tk/SPTK/doc/ref_e In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv9231 Modified Files: c2ir.tex c2ndps.tex da.tex decimate.tex delta.tex frame.tex gcep.tex glsadf.tex gmm.tex gmmp.tex grlogsp.tex interpolate.tex lbg.tex lmadf.tex lpc2lsp.tex lsp2sp.tex lspcheck.tex lspdf.tex mfcc.tex mgc2mgclsp.tex mgclsp2mgc.tex mgclsp2sp.tex mglsadf.tex mlpg.tex mlsacheck.tex mlsadf.tex ndps2c.tex pca.tex phase.tex psgr.tex smcep.tex sopr.tex vstat.tex wav2raw.tex x2x.tex Log Message: modify SYNOPSIS and OPTIONS of manual Index: delta.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/delta.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** delta.tex 22 Dec 2016 10:52:58 -0000 1.15 --- delta.tex 10 May 2017 07:09:59 -0000 1.16 *************** *** 77,80 **** --- 77,81 ---- \argm{m}{M}{order of vector}{25} \argm{l}{L}{length of vector }{$M+1$} + \argm{t}{T}{number of input vectors}{$EOF$} \argm{d}{(fn~|~d_0~[d_1~\dots])}{$fn$ is the file name of the parameters $w^{(n)}(\tau)$ Index: mglsadf.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/mglsadf.tex,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** mglsadf.tex 22 Dec 2016 10:52:58 -0000 1.26 --- mglsadf.tex 10 May 2017 07:09:59 -0000 1.27 *************** *** 48,52 **** \begin{synopsis} \item [mglsadf] [ --m $M$ ] [ --a $A$ ] [ --c $C$ ] [ --p $P$ ] ! [ --i $I$ ] [ --v ] [ --t ] [ --k ] [ --P $Pa$ ] \item [\ ~~~~~~~~] {\em mgcfile} [ {\em infile} ] \end{synopsis} --- 48,52 ---- \begin{synopsis} \item [mglsadf] [ --m $M$ ] [ --a $A$ ] [ --c $C$ ] [ --p $P$ ] ! [ --i $I$ ] [ --t ] [ --v ] [ --k ] [ --P $Pa$ ] \item [\ ~~~~~~~~] {\em mgcfile} [ {\em infile} ] \end{synopsis} *************** *** 306,311 **** \argm{p}{P}{frame period}{100} \argm{i}{I}{interpolation period}{1} - \argm{v}{}{inverse filter}{FALSE} \argm{t}{}{transpose filter}{FALSE} \argm{k}{}{filtering without gain}{FALSE} \desc[1ex]{The option below only works if $C==0$.} --- 306,311 ---- \argm{p}{P}{frame period}{100} \argm{i}{I}{interpolation period}{1} \argm{t}{}{transpose filter}{FALSE} + \argm{v}{}{inverse filter}{FALSE} \argm{k}{}{filtering without gain}{FALSE} \desc[1ex]{The option below only works if $C==0$.} Index: da.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/da.tex,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** da.tex 22 Dec 2016 10:52:58 -0000 1.27 --- da.tex 10 May 2017 07:09:59 -0000 1.28 *************** *** 45,51 **** \name{da}{play 16-bit linear PCM data}{DA transformation} \begin{synopsis} ! \item [da] [ --s $S$ ] [ --c $C$ ] [ --g $G$ ] [ --a $A$ ] [ --o $O$ ] ! [ --w ] [ --H $H$ ] ! \item [\ ~~~] [ --v ] [ +$type$ ] [ {\em infile1} ] [ {\em infile2} ] ... \end{synopsis} --- 45,51 ---- \name{da}{play 16-bit linear PCM data}{DA transformation} \begin{synopsis} ! \item [da] [ --s $S$ ] [ --g $G$ ] [ --a $A$ ] [ --o $O$ ] ! [ --H $H$ ] [ --v ] ! \item [\ ~~~] [ --w ] [ +$type$ ] [ {\em infile1} ] [ {\em infile2} ] ... \end{synopsis} *************** *** 77,83 **** \argm{a}{A}{amplitude gain(0..100)}{N/A} \argm{o}{O}{output port(s : speaker, h : headphone)}{s} - \argm{w}{}{execute byte swap}{FALSE} \argm{H}{H}{header size in byte}{0} \argm{v}{}{display filename}{FALSE} \argp{type}{input data format\\ \begin{tabular}{llcll} \\[-1ex] --- 77,83 ---- \argm{a}{A}{amplitude gain(0..100)}{N/A} \argm{o}{O}{output port(s : speaker, h : headphone)}{s} \argm{H}{H}{header size in byte}{0} \argm{v}{}{display filename}{FALSE} + \argm{w}{}{execute byte swap}{FALSE} \argp{type}{input data format\\ \begin{tabular}{llcll} \\[-1ex] *************** *** 96,100 **** f & float (4 bytes) & \quad & d & double (8 bytes) ! \end{tabular}}{f} \end{options} --- 96,100 ---- f & float (4 bytes) & \quad & d & double (8 bytes) ! \end{tabular}}{s} \end{options} Index: frame.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/frame.tex,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** frame.tex 22 Dec 2016 10:52:58 -0000 1.21 --- frame.tex 10 May 2017 07:09:59 -0000 1.22 *************** *** 46,50 **** \begin{synopsis} ! \item [frame] [ --l $L$ ] [ --n ] [ --p $P$ ] [ {\em infile} ] \end{synopsis} --- 46,50 ---- \begin{synopsis} ! \item [frame] [ --l $L$ ] [ --p $P$ ] [ --n ] [ {\em infile} ] \end{synopsis} Index: sopr.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/sopr.tex,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** sopr.tex 22 Dec 2016 10:52:59 -0000 1.26 --- sopr.tex 10 May 2017 07:09:59 -0000 1.27 *************** *** 46,51 **** \begin{synopsis} ! \item[sopr] [ --a $A$ ] [ --s $S$ ] [ --m $M$ ] [ --d $D$ ] [--f $F$] ! [--c C] [ --magic $magic$ ] \item[\ ~~~~~] [ --MAGIC $MAGIC$ ] [ --ABS ] [ --INV ] [ --P ] [ --R ] [ --SQRT ] [ --LN ] \item[\ ~~~~~] [ --LOG2 ] [ --LOG10 ] [ --LOGX $X$ ] [ --EXP ] [ --POW2 ] [ --POW10 ] --- 46,51 ---- \begin{synopsis} ! \item[sopr] [ --a $A$ ] [ --s $S$ ] [ --m $M$ ] [ --d $D$ ] [ --p $P$ ] [ --f $F$ ] ! [ --c $C$ ] [ --magic $magic$ ] \item[\ ~~~~~] [ --MAGIC $MAGIC$ ] [ --ABS ] [ --INV ] [ --P ] [ --R ] [ --SQRT ] [ --LN ] \item[\ ~~~~~] [ --LOG2 ] [ --LOG10 ] [ --LOGX $X$ ] [ --EXP ] [ --POW2 ] [ --POW10 ] *************** *** 68,71 **** --- 68,72 ---- \argm{m}{M}{multiplication $y=x\ast M$}{FALSE} \argm{d}{D}{division $y=x/D$}{FALSE} + \argm{p}{P}{power $y=x^P$}{FALSE} \argm{f}{F}{flooring $y=F$ if $x < F$}{FALSE} \argm{c}{C}{ceiling $y=C$ if $x > C$}{FALSE} Index: gcep.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/gcep.tex,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** gcep.tex 22 Dec 2016 10:52:58 -0000 1.34 --- gcep.tex 10 May 2017 07:09:59 -0000 1.35 *************** *** 95,99 **** $C$ must be $C \geq 1$}{} \argm{l}{L}{frame length}{256} - \argm{n}{}{output normalized cepstrum}{FALSE} \argm{q}{Q}{input data style\\ \begin{tabular}{ll} \\[-1ex] --- 95,98 ---- *************** *** 104,107 **** --- 103,107 ---- $Q=4$ & $|f(w)|^2$ \\[1ex] \end{tabular}\\\hspace*{\fill}}{0} + \argm{n}{}{output normalized cepstrum}{FALSE} \desc[1ex]{Usually, the options below do not need to be assigned.} \argm{i}{I}{minimum iteration}{2} Index: wav2raw.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/wav2raw.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** wav2raw.tex 22 Dec 2016 10:52:59 -0000 1.13 --- wav2raw.tex 10 May 2017 07:09:59 -0000 1.14 *************** *** 79,83 **** d & double (8 bytes) \\ a & ascii & \quad & & \\ ! \end{tabular}}{f} \end{options} --- 79,83 ---- d & double (8 bytes) \\ a & ascii & \quad & & \\ ! \end{tabular}}{s} \end{options} Index: psgr.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/psgr.tex,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** psgr.tex 22 Dec 2016 10:52:59 -0000 1.22 --- psgr.tex 10 May 2017 07:09:59 -0000 1.23 *************** *** 47,51 **** \begin{synopsis} \item[psgr] [ --t {\em title} ] [ --s $S$ ] [ --c $C$ ] [ --x $X$ ] ! [ --y $Y$ ] [ --p P ] [ --r $R$ ] [ --b ] \item[\ ~~~~~][ --T $T$ ] [ --B $B$ ] [ --L $L$ ] [ --R $R$ ] [ --P ] [ {\em infile} ] --- 47,51 ---- \begin{synopsis} \item[psgr] [ --t {\em title} ] [ --s $S$ ] [ --c $C$ ] [ --x $X$ ] ! [ --y $Y$ ] [ --p P ] [ --l ] [ --r $R$ ] [ --b ] \item[\ ~~~~~][ --T $T$ ] [ --B $B$ ] [ --L $L$ ] [ --R $R$ ] [ --P ] [ {\em infile} ] Index: interpolate.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/interpolate.tex,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** interpolate.tex 22 Dec 2016 10:52:58 -0000 1.19 --- interpolate.tex 10 May 2017 07:09:59 -0000 1.20 *************** *** 46,50 **** \begin{synopsis} ! \item[interpolate] [ --p $P$ ] [ --s $S$ ] [ --l $L$ ] [ --d ] [ {\em infile} ] \end{synopsis} --- 46,50 ---- \begin{synopsis} ! \item[interpolate] [ --l $L$ ] [ --p $P$ ] [ --s $S$ ] [ --d ] [ {\em infile} ] \end{synopsis} Index: mgc2mgclsp.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/mgc2mgclsp.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** mgc2mgclsp.tex 22 Dec 2016 10:52:58 -0000 1.13 --- mgc2mgclsp.tex 10 May 2017 07:09:59 -0000 1.14 *************** *** 46,50 **** \begin{synopsis} ! \item [mgc2mgclsp] [ --a $A$] [ --g $G$ ] [ --m $M$ ] [ --o $O$ ] [ --s $S$ ] [ --k ] [ --L ] [ {\em infile} ] \end{synopsis} --- 46,50 ---- \begin{synopsis} ! \item [mgc2mgclsp] [ --m $M$ ] [ --a $A$] [ --g $G$ ] [ --c $C$ ] [ --o $O$ ] [ --s $S$ ] [ --k ] [ --L ] [ {\em infile} ] \end{synopsis} *************** *** 68,71 **** --- 68,72 ---- \begin{options} + \argm{m}{M}{order of mel-generalized cepstrum}{25} \argm{a}{A}{alpha of mel-generalized cepstrum}{0.35} \argm{g}{G_1}{gamma of mel-generalized cepstrum \\ *************** *** 74,78 **** $\gamma =-1 / $(int)$ C$\\ $C$ must be $C \geq 1$}{} - \argm{m}{M}{order of mel-generalized cepstrum}{25} \argm{o}{O}{output format \\ \begin{tabular}{ll} \\[-1ex] --- 75,78 ---- *************** *** 83,87 **** \end{tabular}\\\hspace*{\fill}}{0} \argm{s}{S}{sampling frequency (kHz)}{10} ! \argm{k}{}{do not output gain}{FALSE} \argm{L}{}{output log gain instead of linear gain}{FALSE} \desc[0.6ex]{Usually, the options below do not need to be assigned.} --- 83,87 ---- \end{tabular}\\\hspace*{\fill}}{0} \argm{s}{S}{sampling frequency (kHz)}{10} ! \argm{k}{}{output gain}{TRUE} \argm{L}{}{output log gain instead of linear gain}{FALSE} \desc[0.6ex]{Usually, the options below do not need to be assigned.} Index: lsp2sp.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/lsp2sp.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** lsp2sp.tex 22 Dec 2016 10:52:58 -0000 1.6 --- lsp2sp.tex 10 May 2017 07:09:59 -0000 1.7 *************** *** 82,85 **** --- 82,86 ---- \argm{l}{L}{frame length}{256} \argm{L}{}{regard input log gain as linear one}{FALSE} + \argm{k}{}{input gain}{TRUE} \argm{q}{Q}{input format\\ \begin{tabular}{ll} \\[-1ex] Index: mlsacheck.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/mlsacheck.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** mlsacheck.tex 22 Dec 2016 10:52:58 -0000 1.15 --- mlsacheck.tex 10 May 2017 07:09:59 -0000 1.16 *************** *** 47,52 **** \begin{synopsis} ! \item [mlsacheck] [ --m $M$ ] [ --a $A$ ] [ --c $C$ ] [ --r ] [ --l $L$] ! [ --R ] [--P $Pa$ ] [ {\em infile} ] \end{synopsis} --- 47,52 ---- \begin{synopsis} ! \item [mlsacheck] [ --m $M$ ] [ --a $A$ ] [ --l $L$] [ --c $C$ ] [ --r ] ! [--P $Pa$ ] [ --R ] [ {\em infile} ] \end{synopsis} Index: lbg.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/lbg.tex,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** lbg.tex 2 Feb 2017 07:19:15 -0000 1.28 --- lbg.tex 10 May 2017 07:09:59 -0000 1.29 *************** *** 46,50 **** \begin{synopsis} ! \item [lbg] [ --l $L$ ] [ --n $N$ ] [ --t $T$ ] [ --s $S$ ] [ --e $E$ ] [ --F $F$ ] [ --i $I$ ] [ --m $M$ ] [ --S $s$ ] \item [\ ~~~~~] [ --c $C$ ] [ --d $D$ ] [ --r $R$ ] [ {\em indexfile} ] $<$ {\em infile} --- 46,50 ---- \begin{synopsis} ! \item [lbg] [ --l $L$ ] [ --n $N$ ] [ --s $S$ ] [ --e $E$ ] [ --F $F$ ] [ --i $I$ ] [ --m $M$ ] [ --S $s$ ] \item [\ ~~~~~] [ --c $C$ ] [ --d $D$ ] [ --r $R$ ] [ {\em indexfile} ] $<$ {\em infile} *************** *** 238,242 **** \argm{l}{L}{length of vector}{26} \argm{n}{N}{order of vector}{L$-$1} - \argm{t}{T}{number of training vector}{N/A} \argm{s}{S}{initial codebook size}{1} \argm{e}{E}{final codebook size}{256} --- 238,241 ---- Index: c2ndps.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/c2ndps.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** c2ndps.tex 22 Dec 2016 10:52:57 -0000 1.5 --- c2ndps.tex 10 May 2017 07:09:59 -0000 1.6 *************** *** 48,52 **** \begin{synopsis} ! \item[c2ndps] [ --l $L$ ] [ --m $M$ ] [ --p ] [ --z ] [ {\em infile} ] \end{synopsis} --- 48,52 ---- \begin{synopsis} ! \item[c2ndps] [ --m $M$ ] [ --l $L$ ] [ --p ] [ --z ] [ {\em infile} ] \end{synopsis} Index: smcep.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/smcep.tex,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** smcep.tex 22 Dec 2016 10:52:59 -0000 1.32 --- smcep.tex 10 May 2017 07:09:59 -0000 1.33 *************** *** 47,51 **** \begin{synopsis} ! \item [smcep] [ --a $A$ ] [ --t $t$ ] [ --T $T$ ] [ --s $s$ ] [ --m $M$ ] [ --l $L$ ] [ --q $Q$ ] \item [\ ~~~~~~~~~~] [ --i $I$ ] [ --j $J$ ] [ --d $D$ ] [ --e $e$ ] [ --E $E$ ] [ --f $F$ ] [ {\em infile} ] \end{synopsis} --- 47,51 ---- \begin{synopsis} ! \item [smcep] [ --a $A$ ] [ --t $t$ ] [ --T $T$ ] [ --m $M$ ] [ --l $L$ ] [ --s $s$ ] [ --L $L$ ] [ --q $Q$ ] \item [\ ~~~~~~~~~~] [ --i $I$ ] [ --j $J$ ] [ --d $D$ ] [ --e $e$ ] [ --E $E$ ] [ --f $F$ ] [ {\em infile} ] \end{synopsis} *************** *** 90,96 **** \argm{t}{t}{emphasized frequency $\theta*\pi$ (rad)}{0} \argm{T}{T}{emphasized frequency (Hz)}{0} - \argm{s}{s}{sampling frequency (kHz)}{10} \argm{m}{M}{order of mel cepstrum}{25} \argm{l}{L_1}{frame length}{256} \argm{L}{L_2}{ifft size for making matrices}{1024} \argm{q}{Q}{input data style\\ --- 90,96 ---- \argm{t}{t}{emphasized frequency $\theta*\pi$ (rad)}{0} \argm{T}{T}{emphasized frequency (Hz)}{0} \argm{m}{M}{order of mel cepstrum}{25} \argm{l}{L_1}{frame length}{256} + \argm{s}{s}{sampling frequency (kHz)}{10} \argm{L}{L_2}{ifft size for making matrices}{1024} \argm{q}{Q}{input data style\\ Index: mlpg.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/mlpg.tex,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** mlpg.tex 22 Dec 2016 10:52:58 -0000 1.26 --- mlpg.tex 10 May 2017 07:09:59 -0000 1.27 *************** *** 47,51 **** \begin{synopsis} ! \item [mlpg] [ --l $L$ ] [ --m $M$ ] [--d ($fn$ $|$ $d_0$ [$d_1$ $\dots$]) ] [--r $N_R$ $W_1$ [$W_2$] ] --- 47,51 ---- \begin{synopsis} ! \item [mlpg] [ --m $M$ ] [ --l $L$ ] [--d ($fn$ $|$ $d_0$ [$d_1$ $\dots$]) ] [--r $N_R$ $W_1$ [$W_2$] ] Index: pca.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/pca.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** pca.tex 22 Dec 2016 10:52:59 -0000 1.14 --- pca.tex 10 May 2017 07:09:59 -0000 1.15 *************** *** 68,72 **** \begin{options} ! \argm{l}{L}{dimension of vector}{3} \argm{n}{N}{number of output principal components}{2} \argm{i}{I}{limit of iterations of the Jacobi method}{10000} --- 68,72 ---- \begin{options} ! \argm{l}{L}{dimension of vector}{24} \argm{n}{N}{number of output principal components}{2} \argm{i}{I}{limit of iterations of the Jacobi method}{10000} Index: c2ir.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/c2ir.tex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** c2ir.tex 22 Dec 2016 10:52:57 -0000 1.24 --- c2ir.tex 10 May 2017 07:09:59 -0000 1.25 *************** *** 47,51 **** \begin{synopsis} ! \item[c2ir] [ --l $L$ ] [ --m $M_1$ ] [ --M $M_2$ ] [ --i ] [ {\em infile} ] \end{synopsis} --- 47,51 ---- \begin{synopsis} ! \item[c2ir] [ --m $M_1$ ] [ --M $M_2$ ] [ --l $L$ ] [ --i ] [ {\em infile} ] \end{synopsis} Index: lspdf.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/lspdf.tex,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** lspdf.tex 22 Dec 2016 10:52:58 -0000 1.20 --- lspdf.tex 10 May 2017 07:09:59 -0000 1.21 *************** *** 46,50 **** \begin{synopsis} ! \item [lspdf] [ --m $M$ ] [ --p $P$ ] [ --i $I$ ] [ --s $S$ ] [ --o $O$ ] [ --k ] [ --L ] {\em lspfile} [ {\em infile} ] \end{synopsis} --- 46,50 ---- \begin{synopsis} ! \item [lspdf] [ --m $M$ ] [ --p $P$ ] [ --i $I$ ] [ --k ] [ --L ] {\em lspfile} [ {\em infile} ] \end{synopsis} Index: x2x.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/x2x.tex,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** x2x.tex 22 Dec 2016 10:52:59 -0000 1.25 --- x2x.tex 10 May 2017 07:09:59 -0000 1.26 *************** *** 46,50 **** \begin{synopsis} ! \item[x2x] [ +$type1$ ] [ +$type2$ ] [ $\%format$ ] [ +a{\em $N$} ] [ --r ] \end{synopsis} --- 46,50 ---- \begin{synopsis} ! \item[x2x] [ +$type1$ ] [ +$type2$ ] [ --r ] [ --o ] [ $\%format$ ] \end{synopsis} *************** *** 92,97 **** type. if the -o option is not given, when the data type lengths are different, the process will be aborted.}{FALSE} ! \argp{{\bf a}\%format}{specify output format similar to 'printf()', ! only if $type2$ is ASCII.}{$\%g$} \end{options} --- 92,97 ---- type. if the -o option is not given, when the data type lengths are different, the process will be aborted.}{FALSE} ! \argh{format}{}{specify output format similar to 'printf()', ! only if $type2$ is ASCII.}{$\%Lg$} \end{options} Index: glsadf.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/glsadf.tex,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** glsadf.tex 22 Dec 2016 10:52:58 -0000 1.25 --- glsadf.tex 10 May 2017 07:09:59 -0000 1.26 *************** *** 47,51 **** \begin{synopsis} ! \item [glsadf] [ --m $M$ ] [ --c $C$ ] [ --p $P$ ] [ --i $I$ ] [ --v ] [ --t ] [ --n ] [ --k ] [ --P $Pa$ ] {\em gcfile} \item [\ ~~~~~~~~~] [ {\em infile} ] --- 47,51 ---- \begin{synopsis} ! \item [glsadf] [ --m $M$ ] [ --c $C$ ] [ --p $P$ ] [ --i $I$ ] [ --n ] [ --v ] [ --t ] [ --k ] [ --P $Pa$ ] {\em gcfile} \item [\ ~~~~~~~~~] [ {\em infile} ] Index: lpc2lsp.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/lpc2lsp.tex,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** lpc2lsp.tex 22 Dec 2016 10:52:58 -0000 1.26 --- lpc2lsp.tex 10 May 2017 07:09:59 -0000 1.27 *************** *** 47,51 **** \begin{synopsis} \item [lpc2lsp] [ --m $M$ ] [ --s $S$ ] [ --k ] [ --L ] [ --o $O$ ] [ --n $N$ ] ! [ --p $P$ ] [ --q $Q$ ] [ --d $D$ ] \item [\ ~~~~~~~~] [ {\em infile} ] \end{synopsis} --- 47,51 ---- \begin{synopsis} \item [lpc2lsp] [ --m $M$ ] [ --s $S$ ] [ --k ] [ --L ] [ --o $O$ ] [ --n $N$ ] ! [ --p $P$ ] [ --d $D$ ] \item [\ ~~~~~~~~] [ {\em infile} ] \end{synopsis} Index: lmadf.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/lmadf.tex,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** lmadf.tex 2 Feb 2017 07:19:15 -0000 1.28 --- lmadf.tex 10 May 2017 07:09:59 -0000 1.29 *************** *** 48,53 **** \begin{synopsis} ! \item [lmadf] [ --m $M$ ] [ --p $P$ ] [ --i $I$ ] [ --P $Pa$ ] [ --k ] ! [ --v ] [ --t ] [ --B $B1,B2,...$ ] \item [\ ~~~~]{\em cfile} [ {\em infile} ] \end{synopsis} --- 48,53 ---- \begin{synopsis} ! \item [lmadf] [ --m $M$ ] [ --p $P$ ] [ --i $I$ ] [ --P $Pa$ ] [ --v ] ! [ --t ] [ --k ] [ --B $B1,B2,...$ ] \item [\ ~~~~]{\em cfile} [ {\em infile} ] \end{synopsis} *************** *** 246,252 **** \argm{P}{Pa}{order of the Pad\'e approximation\\ $Pa$ should be $4$ or $5$}{4} - \argm{k}{}{filtering without gain}{FALSE} \argm{v}{}{inverse filter}{FALSE} \argm{t}{}{transpose filter}{FALSE} \desc[1ex]{(level 2)} \argm{B}{B1~B2~$\ldots$~Bn}{block size of cascaded filter,\\ --- 246,252 ---- \argm{P}{Pa}{order of the Pad\'e approximation\\ $Pa$ should be $4$ or $5$}{4} \argm{v}{}{inverse filter}{FALSE} \argm{t}{}{transpose filter}{FALSE} + \argm{k}{}{filtering without gain}{FALSE} \desc[1ex]{(level 2)} \argm{B}{B1~B2~$\ldots$~Bn}{block size of cascaded filter,\\ Index: lspcheck.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/lspcheck.tex,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** lspcheck.tex 22 Dec 2016 10:52:58 -0000 1.25 --- lspcheck.tex 10 May 2017 07:09:59 -0000 1.26 *************** *** 46,51 **** \begin{synopsis} ! \item [lspcheck] [ --m $M$ ] [ --s $S$ ] [ --k ] [ --L ] [ --q $Q$ ] [ --o $O$ ] ! [ --r $R$] [ --G $G$ ] [ --g ] [ {\em infile} ] \end{synopsis} --- 46,51 ---- \begin{synopsis} ! \item [lspcheck] [ --m $M$ ] [ --s $S$ ] [ --k ] [ --q $Q$ ] [ --o $O$ ] ! [ --c ] [ --r $R$] [ --g ] [ --L ] [ --G $G$ ] [ {\em infile} ] \end{synopsis} *************** *** 68,72 **** \argm{s}{S}{sampling frequency (kHz)}{10.0} \argm{k}{}{input \& output gain}{TRUE} - \argm{L}{}{regard input as log gain}{FALSE} \argm{q}{Q}{input format}{0} \argm{o}{O}{output format \\ --- 68,71 ---- *************** *** 82,88 **** \argm{r}{R}{threshold of rearrangement of LSP\\ $s.t.\hspace{0.5cm} 0 \leq R \leq 1$}{0.0} \argm{G}{G}{minimum value of gain\\ $G$ must be greater than $0$.}{1e-10} - \argm{g}{}{modify gain value if gain is less than $G$.}{FALSE} \end{options} --- 81,88 ---- \argm{r}{R}{threshold of rearrangement of LSP\\ $s.t.\hspace{0.5cm} 0 \leq R \leq 1$}{0.0} + \argm{g}{}{modify gain value if gain is less than $G$.}{FALSE} + \argm{L}{}{regard input as log gain}{FALSE} \argm{G}{G}{minimum value of gain\\ $G$ must be greater than $0$.}{1e-10} \end{options} Index: gmmp.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/gmmp.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** gmmp.tex 22 Dec 2016 10:52:58 -0000 1.14 --- gmmp.tex 10 May 2017 07:09:59 -0000 1.15 *************** *** 46,50 **** \begin{synopsis} ! \item [gmmp] [ --l $L$ ] [ --m $M$ ] [ --a ] [ --f ] [ --B $B1,B2,...$ ] [ --c1 ] [ --c2 ] [ --D ] {\em gmmfile} [ {\em infile} ] \end{synopsis} --- 46,50 ---- \begin{synopsis} ! \item [gmmp] [ --l $L$ ] [ --m $M$ ] [ --f ] [ --a ] [ --B $B1,B2,...$ ] [ --c1 ] [ --c2 ] [ --D ] {\em gmmfile} [ {\em infile} ] \end{synopsis} Index: phase.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/phase.tex,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** phase.tex 22 Dec 2016 10:52:59 -0000 1.22 --- phase.tex 10 May 2017 07:09:59 -0000 1.23 *************** *** 47,51 **** \begin{synopsis} \item[phase] [ --l $L$ ] [ --p {\em pfile} ] [ --z {\em zfile} ] ! [ --m $M$ ] [ --n $N$ ] [ {\em infile} ] \end{synopsis} --- 47,51 ---- \begin{synopsis} \item[phase] [ --l $L$ ] [ --p {\em pfile} ] [ --z {\em zfile} ] ! [ --m $M$ ] [ --n $N$ ] [ --u ] [ {\em infile} ] \end{synopsis} Index: decimate.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/decimate.tex,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** decimate.tex 22 Dec 2016 10:52:58 -0000 1.18 --- decimate.tex 10 May 2017 07:09:59 -0000 1.19 *************** *** 46,50 **** \begin{synopsis} ! \item[decimate] [ --p $P$ ] [ --s $S$ ] [ --l $L$ ] [ {\em infile} ] \end{synopsis} --- 46,50 ---- \begin{synopsis} ! \item[decimate] [ --l $L$ ] [ --p $P$ ] [ --s $S$ ] [ {\em infile} ] \end{synopsis} Index: mfcc.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/mfcc.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** mfcc.tex 22 Dec 2016 10:52:58 -0000 1.11 --- mfcc.tex 10 May 2017 07:09:59 -0000 1.12 *************** *** 46,52 **** \begin{synopsis} ! \item[mfcc] [ --a $A$ ] [ --e $E$ ] [ --l $L_1$ ] [ --L $L_2$ ] ! [ --s or --f $F$ ] [ --m $M$ ] ! \item[\ ~~~][ --n $N$ ] [ --s $S$ ] [ --w $W$] [ --d ] [ -- E ] [ --0 ][ {\em infile} ] \end{synopsis} --- 46,52 ---- \begin{synopsis} ! \item[mfcc] [ --a $A$ ] [ --c $C$ ] [ --e $E$ ] [ --s $S$ ] [ --l $L_1$ ] [ --L $L_2$ ] ! [ --m $M$ ] ! \item[\ ~~~][ --n $N$ ] [ --w $W$] [ --d ] [ --E ] [ --0 ][ {\em infile} ] \end{synopsis} *************** *** 72,75 **** --- 72,76 ---- analysis \\ if $x < E$ then return $x = E$}{1.0} + \argm{s}{S}{sampling frequency (kHz)}{16.0} \argm{l}{L_1}{frame length of input}{256} \argm{L}{L_2}{frame length for fft. default value $2^n$ *************** *** 77,81 **** \argm{m}{M}{order of mfcc}{12} \argm{n}{N}{order of channel for mel-filter bank}{20} - \argm{s}{S}{sampling frequency (kHz)}{16.0} \argm{w}{W}{type of window\\ \begin{tabular}{ll}\\ [-1ex] --- 78,81 ---- Index: ndps2c.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/ndps2c.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ndps2c.tex 22 Dec 2016 10:52:58 -0000 1.5 --- ndps2c.tex 10 May 2017 07:09:59 -0000 1.6 *************** *** 48,52 **** \begin{synopsis} ! \item[ndps2c] [ --l $L$ ] [ --m $M$ ] [ {\em infile} ] \end{synopsis} --- 48,52 ---- \begin{synopsis} ! \item[ndps2c] [ --m $M$ ] [ --l $L$ ] [ {\em infile} ] \end{synopsis} Index: vstat.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/vstat.tex,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** vstat.tex 22 Dec 2016 10:52:59 -0000 1.27 --- vstat.tex 10 May 2017 07:09:59 -0000 1.28 *************** *** 46,50 **** \begin{synopsis} ! \item[vstat] [ --l $L$ ] [ --n $N$ ] [ --t $T$ ] [ --c $C$ ] [ --d ] [ --o $O$ ] [ {\em infile} ] \end{synopsis} --- 46,51 ---- \begin{synopsis} ! \item[vstat] [ --l $L$ ] [ --n $N$ ] [ --t $T$ ] [ --o $O$ ] [ --c $C$ ] ! [ --d ] [ --i ] [ --r ] [ {\em infile} ] \end{synopsis} Index: mlsadf.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/mlsadf.tex,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** mlsadf.tex 22 Dec 2016 10:52:58 -0000 1.27 --- mlsadf.tex 10 May 2017 07:09:59 -0000 1.28 *************** *** 48,52 **** \begin{synopsis} \item [mlsadf] [ --m $M$ ] [ --a $A$ ] [ --p $P$ ] [ --i $I$ ] [ --b ] ! [--P $Pa$ ] [ --v ] [--t] [ --k ] \item [\ ~~~~~~~] {\em mcfile} [ {\em infile} ] \end{synopsis} --- 48,52 ---- \begin{synopsis} \item [mlsadf] [ --m $M$ ] [ --a $A$ ] [ --p $P$ ] [ --i $I$ ] [ --b ] ! [ --P $Pa$ ] [ --k ] [ --t ] [ --v ] \item [\ ~~~~~~~] {\em mcfile} [ {\em infile} ] \end{synopsis} *************** *** 355,360 **** $Pa$ should be $4$ or $5$}{4} \argm{k}{}{filtering without gain}{FALSE} - \argm{v}{}{inverse filter}{FALSE} \argm{t}{}{transpose filter}{FALSE} \end{options} --- 355,360 ---- $Pa$ should be $4$ or $5$}{4} \argm{k}{}{filtering without gain}{FALSE} \argm{t}{}{transpose filter}{FALSE} + \argm{v}{}{inverse filter}{FALSE} \end{options} Index: mgclsp2mgc.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/mgclsp2mgc.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** mgclsp2mgc.tex 22 Dec 2016 10:52:58 -0000 1.11 --- mgclsp2mgc.tex 10 May 2017 07:09:59 -0000 1.12 *************** *** 46,50 **** \begin{synopsis} ! \item [mgclsp2mgc] [ --a $A$ ] [ --g $G$ ] [ --m $M$ ] [ --q $Q$ ] [ --s $S$ ] [ --L ] [ {\em infile} ] \end{synopsis} --- 46,50 ---- \begin{synopsis} ! \item [mgclsp2mgc] [ --m $M$ ] [ --a $A$ ] [ --g $G$ ] [ --c $C$ ] [ --q $Q$ ] [ --s $S$ ] [ --L ] [ {\em infile} ] \end{synopsis} *************** *** 74,77 **** --- 74,78 ---- \begin{options} + \argm{m}{M}{order of mel-generalized cepstrum}{25} \argm{a}{A}{alpha of mel-generalized cepstrum}{0.35} \argm{g}{G_1}{gamma of mel-generalized cepstrum \\ *************** *** 80,84 **** $\gamma =-1 / $(int)$ C$\\ $C$ must be $C \geq 1$}{} - \argm{m}{M}{order of mel-generalized cepstrum}{25} \argm{q}{Q}{input format\\ \begin{tabular}{ll} \\[-1ex] --- 81,84 ---- Index: gmm.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/gmm.tex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** gmm.tex 2 Feb 2017 07:19:15 -0000 1.24 --- gmm.tex 10 May 2017 07:09:59 -0000 1.25 *************** *** 46,50 **** \begin{synopsis} ! \item [gmm] [ --l $L$ ] [ --m $M$ ] [ --t $T$ ] [ --s $S$ ] [ --a $A$ ] [ --b $B$ ] [ --e $E$ ] [ --v $V$ ] [ --w $W$ ] [ --f ] \item [\ ~~~~] [ --M $W_{MAP}$ ][ --F $gmmfile$ ] [ --B $B1,B2,...$ ] [ --c1 ] [ --c2 ] [ {\em infile} ] --- 46,50 ---- \begin{synopsis} ! \item [gmm] [ --l $L$ ] [ --m $M$ ] [ --s $S$ ] [ --a $A$ ] [ --b $B$ ] [ --e $E$ ] [ --v $V$ ] [ --w $W$ ] [ --f ] \item [\ ~~~~] [ --M $W_{MAP}$ ][ --F $gmmfile$ ] [ --B $B1,B2,...$ ] [ --c1 ] [ --c2 ] [ {\em infile} ] *************** *** 181,185 **** \argm{l}{L}{length of vector}{26} \argm{m}{M}{number of Gaussian components}{16} - \argm{t}{T}{number of training vectors}{N/A} \argm{s}{S}{seed of random variable for LBG algorithm}{1} \argm{a}{A}{minimum number of EM iterations}{0} --- 181,184 ---- Index: grlogsp.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/grlogsp.tex,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** grlogsp.tex 13 Feb 2017 08:04:32 -0000 1.28 --- grlogsp.tex 10 May 2017 07:09:59 -0000 1.29 *************** *** 46,50 **** \begin{synopsis} ! \item[grlogsp] [ --t ] [ --F $F$] [ --O $O$ ] [ --x $X$ ] [ --y $ymin$ ] [ --yy $YY$ ] [ --yo $YO$ ] [ --p $P$ ] \item[\ ~~~~~~~~] [ --ln $LN$ ] [ --s $S$ ] [ --e $E$ ] [ --n $N$ ] [ --l $L$ ] --- 46,50 ---- \begin{synopsis} ! \item[grlogsp] [ --F $F$] [ --t ] [ --O $O$ ] [ --x $X$ ] [ --y $ymin$ ] [ --yy $YY$ ] [ --yo $YO$ ] [ --p $P$ ] \item[\ ~~~~~~~~] [ --ln $LN$ ] [ --s $S$ ] [ --e $E$ ] [ --n $N$ ] [ --l $L$ ] *************** *** 65,70 **** \begin{options} - \argm{t}{}{transpose x and y axes}{FALSE} \argm{F}{F}{factor}{1} \argm{O}{O}{origin of graph\\ if $O$ is more than 6, drawing area is over A4 range\\ --- 65,70 ---- \begin{options} \argm{F}{F}{factor}{1} + \argm{t}{}{transpose x and y axes}{FALSE} \argm{O}{O}{origin of graph\\ if $O$ is more than 6, drawing area is over A4 range\\ *************** *** 86,90 **** \includegraphics{fig/grlogsp-on.pdf} \end{minipage}\\\hspace*{\fill}\\ ! $(YO + 100 , X)$ [mm] if -t is specified.}{1} \argm{x}{X}{ $x$ scale\\ \begin{tabular}{cl} --- 86,90 ---- \includegraphics{fig/grlogsp-on.pdf} \end{minipage}\\\hspace*{\fill}\\ ! $(YO + 100 , X)$ [mm] if -t is specified.}{6} \argm{x}{X}{ $x$ scale\\ \begin{tabular}{cl} *************** *** 123,128 **** If Z is not given, Z is as same as F}{} \argm{o}{xo \; yo}{origin of the graph. ! if -o option exists, -O is not effective.}{95 30} ! \argm{g}{G}{type of frame of the graph ($0 \sim 2$) (see also \hyperlink{fig}{fig})}{2} \argm{cy}{cy}{first comment position}{-8} \argm{cy2}{cy2}{second comment position}{-14} --- 123,128 ---- If Z is not given, Z is as same as F}{} \argm{o}{xo \; yo}{origin of the graph. ! if -o option exists, -O is not effective.}{30 65} ! \argm{g}{G}{type of frame of the graph ($0 \sim 2$) (see also \hyperlink{fig}{fig})}{0} \argm{cy}{cy}{first comment position}{-8} \argm{cy2}{cy2}{second comment position}{-14} Index: mgclsp2sp.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/mgclsp2sp.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mgclsp2sp.tex 22 Dec 2016 10:52:58 -0000 1.4 --- mgclsp2sp.tex 10 May 2017 07:09:59 -0000 1.5 *************** *** 46,51 **** \begin{synopsis} ! \item [mgclsp2sp] [ --a $A$ ] [ --g $G$ ] [ --m $M$ ] [ --l $L$] [ --q $Q$ ] ! [ --s $S$ ] [ --o $O$] \newline [ --k ] [ --L ] [ {\em infile} ] \end{synopsis} --- 46,51 ---- \begin{synopsis} ! \item [mgclsp2sp] [ --a $A$ ] [ --g $G$ ] [ --c $C$ ] [ --m $M$ ] [ --s $S$] [ --l $L$ ] ! [ --L ] [ --k ] \newline [ --q $Q$ ] [ --o $O$ ] [ {\em infile} ] \end{synopsis} *************** *** 101,106 **** \argm{s}{S}{sampling frequency}{10.0} \argm{l}{L}{frame length}{256} - \argm{k}{}{input gain}{FALSE} \argm{L}{}{regard input log gain as linear gain}{FALSE} \argm{q}{Q}{input format\\ \begin{tabular}{ll} \\[-1ex] --- 101,106 ---- \argm{s}{S}{sampling frequency}{10.0} \argm{l}{L}{frame length}{256} \argm{L}{}{regard input log gain as linear gain}{FALSE} + \argm{k}{}{input gain}{FALSE} \argm{q}{Q}{input format\\ \begin{tabular}{ll} \\[-1ex] |
From: Takenori Y. <tak...@us...> - 2017-05-09 07:18:10
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv18060 Added Files: data_windowing.cc data_windowing.h Log Message: add class for data windowing --- NEW FILE: data_windowing.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 "data_windowing.h" #include <algorithm> // std::fill, std::transform #include <cmath> // std::cos, std::round, std::sqrt #include <cstddef> // std::size_t #include <functional> // std::bind1st, std::multiplies #include <numeric> // std::accumulate, std::inner_product namespace sptk { DataWindowing::DataWindowing(int num_input_order, int num_output_order, NormalizationType normalization_type, WindowType window_type) : num_input_order_(num_input_order), num_output_order_(num_output_order), is_valid_(true) { if (num_input_order_ < 0 || num_output_order_ < 0) { is_valid_ = false; return; } window_.resize(num_input_order_ + 1); switch (window_type) { case kBlackman: { CreateBlackmanWindow(); break; } case kHamming: { CreateHammingWindow(); break; } case kHanning: { CreateHanningWindow(); break; } case kBartlett: { CreateBartlettWindow(); break; } case kTrapezoidal: { CreateTrapezoidalWindow(); break; } case kRectangular: { CreateRectangularWindow(); break; } default: { is_valid_ = false; return; } } double normalization_constant(1.0); switch (normalization_type) { case kNone: { // nothing to do break; } case kPower: { const double power(std::inner_product(window_.begin(), window_.end(), window_.begin(), 0.0)); normalization_constant = 1.0 / std::sqrt(power); break; } case kMagnitude: { const double magnitude( std::accumulate(window_.begin(), window_.end(), 0.0)); normalization_constant = 1.0 / magnitude; break; } default: { is_valid_ = false; return; } } // normalize if (1.0 != normalization_constant) { std::transform( window_.begin(), window_.end(), window_.begin(), std::bind1st(std::multiplies<double>(), normalization_constant)); } } bool DataWindowing::Run(const std::vector<double>& data_sequence, std::vector<double>* windowed_data_sequence) const { // check inputs const int input_length(num_input_order_ + 1); if (!is_valid_ || data_sequence.size() != static_cast<std::size_t>(input_length) || NULL == windowed_data_sequence) { return false; } // prepare memory const int output_length(num_output_order_ + 1); if (windowed_data_sequence->size() < static_cast<std::size_t>(output_length)) { windowed_data_sequence->resize(output_length); } const int valid_length(input_length <= output_length ? input_length : output_length); // apply window std::transform(data_sequence.begin(), data_sequence.begin() + valid_length, window_.begin(), windowed_data_sequence->begin(), std::multiplies<double>()); // fill zero std::fill(windowed_data_sequence->begin() + valid_length, windowed_data_sequence->end(), 0.0); return true; } void DataWindowing::CreateBlackmanWindow() { const int window_size(window_.size()); const double argument(sptk::kTwoPi / (window_size - 1)); for (int i(0); i < window_size; ++i) { const double x(argument * i); window_[i] = 0.42 - 0.50 * std::cos(x) + 0.08 * std::cos(2.0 * x); } } void DataWindowing::CreateHammingWindow() { const int window_size(window_.size()); const double argument(sptk::kTwoPi / (window_size - 1)); for (int i(0); i < window_size; ++i) { window_[i] = 0.54 - 0.46 * std::cos(argument * i); } } void DataWindowing::CreateHanningWindow() { const int window_size(window_.size()); const double argument(sptk::kTwoPi / (window_size - 1)); for (int i(0); i < window_size; ++i) { window_[i] = 0.50 - 0.50 * std::cos(argument * i); } } void DataWindowing::CreateBartlettWindow() { const int window_size(window_.size()); const int half_window_size(static_cast<int>(std::round(0.5 * window_size))); const double slope(2.0 / (window_size - 1)); for (int i(0); i < half_window_size; ++i) { window_[i] = slope * i; } for (int i(half_window_size); i < window_size; ++i) { window_[i] = 2.0 - slope * i; } } void DataWindowing::CreateTrapezoidalWindow() { const int window_size(window_.size()); const int quarter_window_size( static_cast<int>(std::round(0.25 * window_size))); const double slope(4.0 / (window_size - 1)); for (int i(0); i < quarter_window_size; ++i) { window_[i] = slope * i; } std::fill(window_.begin() + quarter_window_size, window_.end() - quarter_window_size, 1.0); for (int i(window_size - quarter_window_size); i < window_size; ++i) { window_[i] = 4.0 - slope * i; } } void DataWindowing::CreateRectangularWindow() { std::fill(window_.begin(), window_.end(), 1.0); } } // namespace sptk --- NEW FILE: data_windowing.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_DATA_WINDOWING_H_ #define SPTK_SRC_DATA_WINDOWING_H_ #include <vector> // std::vector #include "sptk_utils.h" namespace sptk { class DataWindowing { public: // enum NormalizationType { kNone = 0, kPower, kMagnitude, kNumNormalizationTypes, }; // enum WindowType { kBlackman = 0, kHamming, kHanning, kBartlett, kTrapezoidal, kRectangular, kNumWindowTypes, }; // DataWindowing(int num_input_order, int num_output_order, NormalizationType normalization_type, WindowType window_type); // virtual ~DataWindowing() { } // int GetNumInputOrder() const { return num_input_order_; } // int GetNumOutputOrder() const { return num_output_order_; } // bool IsValid() const { return is_valid_; } // bool Run(const std::vector<double>& data_sequence, std::vector<double>* windowed_data_sequence) const; private: // void CreateBlackmanWindow(); void CreateHammingWindow(); void CreateHanningWindow(); void CreateBartlettWindow(); void CreateTrapezoidalWindow(); void CreateRectangularWindow(); const int num_input_order_; // const int num_output_order_; // bool is_valid_; // std::vector<double> window_; // DISALLOW_COPY_AND_ASSIGN(DataWindowing); }; } // namespace sptk #endif // SPTK_SRC_DATA_WINDOWING_H_ |
From: Takenori Y. <tak...@us...> - 2017-05-09 07:17:20
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv18008 Modified Files: Makefile Log Message: add class for data windowing Index: Makefile =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/Makefile,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Makefile 6 Apr 2017 09:46:50 -0000 1.29 --- Makefile 9 May 2017 07:17:18 -0000 1.30 *************** *** 50,53 **** --- 50,54 ---- autocorrelation.cc \ cepstrum_to_minimum_phase_impulse_response.cc \ + data_windowing.cc \ excitation_generation.cc \ fast_fourier_transform.cc \ |
From: Takenori Y. <tak...@us...> - 2017-05-02 07:25:42
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv28326 Modified Files: c2mpir.cc freqt.cc lpc2c.cc mgc2mgc.cc mglsp2sp.cc Log Message: format codes Index: mgc2mgc.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mgc2mgc.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** mgc2mgc.cc 2 May 2017 07:10:22 -0000 1.7 --- mgc2mgc.cc 2 May 2017 07:25:40 -0000 1.8 *************** *** 79,85 **** *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 --- 79,85 ---- *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 Index: c2mpir.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/c2mpir.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** c2mpir.cc 15 Mar 2017 13:38:04 -0000 1.5 --- c2mpir.cc 2 May 2017 07:25:40 -0000 1.6 *************** *** 65,69 **** *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 --- 65,69 ---- *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 Index: freqt.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/freqt.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** freqt.cc 15 Mar 2017 13:38:04 -0000 1.8 --- freqt.cc 2 May 2017 07:25:40 -0000 1.9 *************** *** 67,73 **** *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; --- 67,73 ---- *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; Index: lpc2c.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/lpc2c.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lpc2c.cc 15 Mar 2017 13:38:04 -0000 1.2 --- lpc2c.cc 2 May 2017 07:25:40 -0000 1.3 *************** *** 65,69 **** *stream << " lpc2c [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of linear predictive [" << kDefaultNumInputOrder << "]" << std::endl; // NOLINT *stream << " coefficients" << std::endl; *stream << " -M M : order of cepstrum [" << kDefaultNumOutputOrder << "]" << std::endl; // NOLINT --- 65,69 ---- *stream << " lpc2c [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; ! *stream << " -m m : order of linear predictive [" << kDefaultNumInputOrder << "]" << std::endl; // NOLINT *stream << " coefficients" << std::endl; *stream << " -M M : order of cepstrum [" << kDefaultNumOutputOrder << "]" << std::endl; // NOLINT Index: mglsp2sp.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mglsp2sp.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mglsp2sp.cc 2 May 2017 07:10:22 -0000 1.2 --- mglsp2sp.cc 2 May 2017 07:25:40 -0000 1.3 *************** *** 171,176 **** } case 'g': { ! const int min(-1.0); ! const int max(0.0); if (!sptk::ConvertStringToDouble(optarg, &gamma) || gamma < min || max <= gamma) { --- 171,176 ---- } case 'g': { ! const double min(-1.0); ! const double max(0.0); if (!sptk::ConvertStringToDouble(optarg, &gamma) || gamma < min || max <= gamma) { |
From: Takenori Y. <tak...@us...> - 2017-05-02 07:10:25
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv27574 Modified Files: excite.cc fft.cc fftr.cc gnorm.cc ignorm.cc input_source_preprocessing_for_filter_gain.h lpc2lsp.cc lpc2par.cc lsp2lpc.cc ltcdf.cc merge.cc mgc2mgc.cc mgc2sp.cc mglsp2sp.cc poledf.cc zerodf.cc Log Message: format codes Index: mgc2mgc.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mgc2mgc.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** mgc2mgc.cc 6 Apr 2017 09:46:50 -0000 1.6 --- mgc2mgc.cc 2 May 2017 07:10:22 -0000 1.7 *************** *** 154,159 **** if (!sptk::ConvertStringToInteger(optarg, &tmp) || tmp < 1) { std::ostringstream error_message; ! error_message << "The argument for the -c option must be a " ! << "positive integer"; sptk::PrintErrorMessage("mgc2mgc", error_message); return 1; --- 154,159 ---- if (!sptk::ConvertStringToInteger(optarg, &tmp) || tmp < 1) { std::ostringstream error_message; ! error_message ! << "The argument for the -c option must be a positive integer"; sptk::PrintErrorMessage("mgc2mgc", error_message); return 1; *************** *** 203,208 **** if (!sptk::ConvertStringToInteger(optarg, &tmp) || tmp < 1) { std::ostringstream error_message; ! error_message << "The argument for the -C option must be a " ! << "positive integer"; sptk::PrintErrorMessage("mgc2mgc", error_message); return 1; --- 203,208 ---- if (!sptk::ConvertStringToInteger(optarg, &tmp) || tmp < 1) { std::ostringstream error_message; ! error_message ! << "The argument for the -C option must be a positive integer"; sptk::PrintErrorMessage("mgc2mgc", error_message); return 1; Index: lsp2lpc.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/lsp2lpc.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** lsp2lpc.cc 6 Apr 2017 09:51:57 -0000 1.3 --- lsp2lpc.cc 2 May 2017 07:10:22 -0000 1.4 *************** *** 57,61 **** namespace { ! enum InputGainTypes { kLinearGain = 0, kLogGain, --- 57,61 ---- namespace { ! enum InputGainType { kLinearGain = 0, kLogGain, *************** *** 74,78 **** const int kDefaultNumOrder(25); const double kDefaultSamplingFrequency(10.0); ! const InputGainTypes kDefaultInputGainType(kLinearGain); const InputFormats kDefaultInputFormat(kNormalizedFrequencyInRadians); --- 74,78 ---- const int kDefaultNumOrder(25); const double kDefaultSamplingFrequency(10.0); ! const InputGainType kDefaultInputGainType(kLinearGain); const InputFormats kDefaultInputFormat(kNormalizedFrequencyInRadians); *************** *** 115,119 **** int num_order(kDefaultNumOrder); double sampling_frequency(kDefaultSamplingFrequency); ! InputGainTypes input_gain_type(kDefaultInputGainType); InputFormats input_format(kDefaultInputFormat); --- 115,119 ---- int num_order(kDefaultNumOrder); double sampling_frequency(kDefaultSamplingFrequency); ! InputGainType input_gain_type(kDefaultInputGainType); InputFormats input_format(kDefaultInputFormat); *************** *** 157,161 **** return 1; } ! input_gain_type = static_cast<InputGainTypes>(tmp); break; } --- 157,161 ---- return 1; } ! input_gain_type = static_cast<InputGainType>(tmp); break; } Index: gnorm.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/gnorm.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** gnorm.cc 15 Mar 2017 13:38:04 -0000 1.4 --- gnorm.cc 2 May 2017 07:10:22 -0000 1.5 *************** *** 116,121 **** if (!sptk::ConvertStringToInteger(optarg, &tmp) || tmp < 1) { std::ostringstream error_message; ! error_message << "The argument for the -c option must be a " ! << "positive integer"; sptk::PrintErrorMessage("gnorm", error_message); return 1; --- 116,121 ---- if (!sptk::ConvertStringToInteger(optarg, &tmp) || tmp < 1) { std::ostringstream error_message; ! error_message ! << "The argument for the -c option must be a positive integer"; sptk::PrintErrorMessage("gnorm", error_message); return 1; Index: fft.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/fft.cc,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** fft.cc 15 Mar 2017 13:38:04 -0000 1.12 --- fft.cc 2 May 2017 07:10:22 -0000 1.13 *************** *** 159,163 **** std::ostringstream error_message; error_message << "The order of data sequence " << num_order ! << " should be less than the FFT size " << fft_size; sptk::PrintErrorMessage("fft", error_message); return 1; --- 159,163 ---- std::ostringstream error_message; error_message << "The order of data sequence " << num_order ! << " must be less than FFT size " << fft_size; sptk::PrintErrorMessage("fft", error_message); return 1; Index: ignorm.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/ignorm.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ignorm.cc 15 Mar 2017 13:38:04 -0000 1.4 --- ignorm.cc 2 May 2017 07:10:22 -0000 1.5 *************** *** 116,121 **** if (!sptk::ConvertStringToInteger(optarg, &tmp) || tmp < 1) { std::ostringstream error_message; ! error_message << "The argument for the -c option must be a " ! << "positive integer"; sptk::PrintErrorMessage("ignorm", error_message); return 1; --- 116,121 ---- if (!sptk::ConvertStringToInteger(optarg, &tmp) || tmp < 1) { std::ostringstream error_message; ! error_message ! << "The argument for the -c option must be a positive integer"; sptk::PrintErrorMessage("ignorm", error_message); return 1; Index: lpc2par.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/lpc2par.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** lpc2par.cc 15 Mar 2017 13:38:04 -0000 1.3 --- lpc2par.cc 2 May 2017 07:10:22 -0000 1.4 *************** *** 135,140 **** if (!sptk::ConvertStringToInteger(optarg, &tmp) || tmp < 1) { std::ostringstream error_message; ! error_message << "The argument for the -c option must be a " ! << "positive integer"; sptk::PrintErrorMessage("lpc2par", error_message); return 1; --- 135,140 ---- if (!sptk::ConvertStringToInteger(optarg, &tmp) || tmp < 1) { std::ostringstream error_message; ! error_message ! << "The argument for the -c option must be a positive integer"; sptk::PrintErrorMessage("lpc2par", error_message); return 1; Index: input_source_preprocessing_for_filter_gain.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/input_source_preprocessing_for_filter_gain.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** input_source_preprocessing_for_filter_gain.h 24 Oct 2016 08:20:30 -0000 1.6 --- input_source_preprocessing_for_filter_gain.h 2 May 2017 07:10:22 -0000 1.7 *************** *** 56,60 **** public: // ! enum class FilterGainType { kLinear = 0, kLog, --- 56,60 ---- public: // ! enum FilterGainType { kLinear = 0, kLog, Index: lpc2lsp.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/lpc2lsp.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** lpc2lsp.cc 6 Apr 2017 09:51:57 -0000 1.3 --- lpc2lsp.cc 2 May 2017 07:10:22 -0000 1.4 *************** *** 57,61 **** namespace { ! enum OutputGainTypes { kLinearGain = 0, kLogGain, --- 57,61 ---- namespace { ! enum OutputGainType { kLinearGain = 0, kLogGain, *************** *** 74,78 **** const int kDefaultNumOrder(25); const double kDefaultSamplingFrequency(10.0); ! const OutputGainTypes kDefaultOutputGainType(kLinearGain); const OutputFormats kDefaultOutputFormat(kNormalizedFrequencyInRadians); const int kDefaultNumSplit(256); --- 74,78 ---- const int kDefaultNumOrder(25); const double kDefaultSamplingFrequency(10.0); ! const OutputGainType kDefaultOutputGainType(kLinearGain); const OutputFormats kDefaultOutputFormat(kNormalizedFrequencyInRadians); const int kDefaultNumSplit(256); *************** *** 120,124 **** int num_order(kDefaultNumOrder); double sampling_frequency(kDefaultSamplingFrequency); ! OutputGainTypes output_gain_type(kDefaultOutputGainType); OutputFormats output_format(kDefaultOutputFormat); int num_split(kDefaultNumSplit); --- 120,124 ---- int num_order(kDefaultNumOrder); double sampling_frequency(kDefaultSamplingFrequency); ! OutputGainType output_gain_type(kDefaultOutputGainType); OutputFormats output_format(kDefaultOutputFormat); int num_split(kDefaultNumSplit); *************** *** 166,170 **** return 1; } ! output_gain_type = static_cast<OutputGainTypes>(tmp); break; } --- 166,170 ---- return 1; } ! output_gain_type = static_cast<OutputGainType>(tmp); break; } Index: excite.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/excite.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** excite.cc 15 Mar 2017 13:38:04 -0000 1.6 --- excite.cc 2 May 2017 07:10:22 -0000 1.7 *************** *** 152,156 **** std::ostringstream error_message; error_message ! << "Interpolation period should not be greater than half frame period"; sptk::PrintErrorMessage("excite", error_message); return 1; --- 152,156 ---- std::ostringstream error_message; error_message ! << "Interpolation period must be equal or less than half frame period"; sptk::PrintErrorMessage("excite", error_message); return 1; Index: merge.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/merge.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** merge.cc 17 Mar 2017 11:39:17 -0000 1.1 --- merge.cc 2 May 2017 07:10:22 -0000 1.2 *************** *** 375,379 **** if (input_length < insert_point) { std::ostringstream error_message; ! error_message << "Insert point must not be greater than input length"; sptk::PrintErrorMessage("merge", error_message); return 1; --- 375,379 ---- if (input_length < insert_point) { std::ostringstream error_message; ! error_message << "Insert point must be equal or less than input length"; sptk::PrintErrorMessage("merge", error_message); return 1; Index: zerodf.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/zerodf.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** zerodf.cc 15 Mar 2017 13:38:04 -0000 1.4 --- zerodf.cc 2 May 2017 07:10:22 -0000 1.5 *************** *** 158,162 **** std::ostringstream error_message; error_message ! << "Interpolation period must not be greater than half frame period"; sptk::PrintErrorMessage("zerodf", error_message); return 1; --- 158,162 ---- std::ostringstream error_message; error_message ! << "Interpolation period must be equal or less than half frame period"; sptk::PrintErrorMessage("zerodf", error_message); return 1; Index: ltcdf.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/ltcdf.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ltcdf.cc 6 Apr 2017 09:51:57 -0000 1.3 --- ltcdf.cc 2 May 2017 07:10:22 -0000 1.4 *************** *** 151,155 **** std::ostringstream error_message; error_message ! << "Interpolation period must not be greater than half frame period"; sptk::PrintErrorMessage("ltcdf", error_message); return 1; --- 151,155 ---- std::ostringstream error_message; error_message ! << "Interpolation period must be equal or less than half frame period"; sptk::PrintErrorMessage("ltcdf", error_message); return 1; Index: poledf.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/poledf.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** poledf.cc 15 Mar 2017 13:38:04 -0000 1.6 --- poledf.cc 2 May 2017 07:10:22 -0000 1.7 *************** *** 158,162 **** std::ostringstream error_message; error_message ! << "Interpolation period must not be greater than half frame period"; sptk::PrintErrorMessage("poledf", error_message); return 1; --- 158,162 ---- std::ostringstream error_message; error_message ! << "Interpolation period must be equal or less than half frame period"; sptk::PrintErrorMessage("poledf", error_message); return 1; Index: mgc2sp.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mgc2sp.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mgc2sp.cc 6 Apr 2017 09:46:50 -0000 1.4 --- mgc2sp.cc 2 May 2017 07:10:22 -0000 1.5 *************** *** 164,169 **** if (!sptk::ConvertStringToInteger(optarg, &tmp) || tmp < 1) { std::ostringstream error_message; ! error_message << "The argument for the -c option must be a " ! << "positive integer"; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; --- 164,169 ---- if (!sptk::ConvertStringToInteger(optarg, &tmp) || tmp < 1) { std::ostringstream error_message; ! error_message ! << "The argument for the -c option must be a positive integer"; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; *************** *** 184,188 **** std::ostringstream error_message; error_message << "The argument for the -l option must be an integer"; ! sptk::PrintErrorMessage("fft", error_message); return 1; } --- 184,188 ---- std::ostringstream error_message; error_message << "The argument for the -l option must be an integer"; ! sptk::PrintErrorMessage("mgc2sp", error_message); return 1; } Index: fftr.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/fftr.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** fftr.cc 15 Mar 2017 13:38:04 -0000 1.3 --- fftr.cc 2 May 2017 07:10:22 -0000 1.4 *************** *** 125,129 **** error_message << "The argument for the -m option must be a " << "non-negative integer"; ! sptk::PrintErrorMessage("fft", error_message); return 1; } --- 125,129 ---- error_message << "The argument for the -m option must be a " << "non-negative integer"; ! sptk::PrintErrorMessage("fftr", error_message); return 1; } *************** *** 166,170 **** std::ostringstream error_message; error_message << "The order of data sequence " << num_order ! << " should be less than the FFT size " << fft_size; sptk::PrintErrorMessage("fftr", error_message); return 1; --- 166,170 ---- std::ostringstream error_message; error_message << "The order of data sequence " << num_order ! << " must be less than FFT size " << fft_size; sptk::PrintErrorMessage("fftr", error_message); return 1; Index: mglsp2sp.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mglsp2sp.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mglsp2sp.cc 6 Apr 2017 09:42:23 -0000 1.1 --- mglsp2sp.cc 2 May 2017 07:10:22 -0000 1.2 *************** *** 57,61 **** namespace { ! enum InputGainTypes { kLinearGain = 0, kLogGain, --- 57,61 ---- namespace { ! enum InputGainType { kLinearGain = 0, kLogGain, *************** *** 85,89 **** const int kDefaultSpectrumLength(128); const double kDefaultSamplingFrequency(10.0); ! const InputGainTypes kDefaultInputGainType(kLinearGain); const InputFormats kDefaultInputFormat(kNormalizedFrequencyInRadians); const OutputFormats kDefaultOutputFormat(kLogAmplitudeSpectrumInDecibels); --- 85,89 ---- const int kDefaultSpectrumLength(128); const double kDefaultSamplingFrequency(10.0); ! const InputGainType kDefaultInputGainType(kLinearGain); const InputFormats kDefaultInputFormat(kNormalizedFrequencyInRadians); const OutputFormats kDefaultOutputFormat(kLogAmplitudeSpectrumInDecibels); *************** *** 92,96 **** // clang-format off *stream << std::endl; ! *stream << " mglsp2sp - transform mel-generalized line spectral pairs to spectrum" << std::endl; *stream << std::endl; *stream << " usage:" << std::endl; --- 92,96 ---- // clang-format off *stream << std::endl; ! *stream << " mglsp2sp - transform mel-generalized line spectral pairs to spectrum" << std::endl; // NOLINT *stream << std::endl; *stream << " usage:" << std::endl; *************** *** 140,144 **** int spectrum_length(kDefaultSpectrumLength); double sampling_frequency(kDefaultSamplingFrequency); ! InputGainTypes input_gain_type(kDefaultInputGainType); InputFormats input_format(kDefaultInputFormat); OutputFormats output_format(kDefaultOutputFormat); --- 140,144 ---- int spectrum_length(kDefaultSpectrumLength); double sampling_frequency(kDefaultSamplingFrequency); ! InputGainType input_gain_type(kDefaultInputGainType); InputFormats input_format(kDefaultInputFormat); OutputFormats output_format(kDefaultOutputFormat); *************** *** 187,192 **** if (!sptk::ConvertStringToInteger(optarg, &tmp) || tmp < 1) { std::ostringstream error_message; ! error_message << "The argument for the -c option must be a " ! << "positive integer"; sptk::PrintErrorMessage("mglsp2sp", error_message); return 1; --- 187,192 ---- if (!sptk::ConvertStringToInteger(optarg, &tmp) || tmp < 1) { std::ostringstream error_message; ! error_message ! << "The argument for the -c option must be a positive integer"; sptk::PrintErrorMessage("mglsp2sp", error_message); return 1; *************** *** 229,233 **** return 1; } ! input_gain_type = static_cast<InputGainTypes>(tmp); break; } --- 229,233 ---- return 1; } ! input_gain_type = static_cast<InputGainType>(tmp); break; } |
From: Takenori Y. <tak...@us...> - 2017-04-26 03:59:09
|
Update of /cvsroot/sp-tk/SPTK/src/bin/mfcc In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv24096 Modified Files: _mfcc.c Log Message: fix bugs suggested by Ryuichi Yamamoto Index: _mfcc.c =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/mfcc/_mfcc.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** _mfcc.c 22 Dec 2016 10:53:07 -0000 1.16 --- _mfcc.c 26 Apr 2017 03:59:06 -0000 1.17 *************** *** 211,228 **** if (x == NULL) { ! x = dgetmem(wlng + wlng + flng + flng + n + 1 + m + 1); px = x + wlng; wx = px + wlng; sp = wx + flng; fb = sp + flng; ! dc = fb + n + 1; } else { free(x); ! x = dgetmem(wlng + wlng + flng + flng + n + 1 + m + 1); px = x + wlng; wx = px + wlng; sp = wx + flng; fb = sp + flng; ! dc = fb + n + 1; } --- 211,228 ---- if (x == NULL) { ! x = dgetmem(wlng + wlng + flng + flng + 2 * n + 1 + m); px = x + wlng; wx = px + wlng; sp = wx + flng; fb = sp + flng; ! dc = fb + 2 * n + 1; } else { free(x); ! x = dgetmem(wlng + wlng + flng + flng + 2 * n + 1 + m); px = x + wlng; wx = px + wlng; sp = wx + flng; fb = sp + flng; ! dc = fb + 2 * n + 1; } *************** *** 237,240 **** --- 237,241 ---- wx[k] = px[k]; spec(wx, sp, flng); + fillz(fb + 1, 2 * n, sizeof(*fb)); fbank(sp, fb, eps, sampleFreq, flng, n); /* calculate 0'th coefficient */ |
From: Takenori Y. <tak...@us...> - 2017-04-24 03:47:31
|
Update of /cvsroot/sp-tk/SPTK/src/bin/fftcep In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv28419/fftcep Modified Files: _fftcep.c Log Message: fix bugs Index: _fftcep.c =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/fftcep/_fftcep.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** _fftcep.c 22 Dec 2016 10:53:03 -0000 1.20 --- _fftcep.c 24 Apr 2017 03:47:28 -0000 1.21 *************** *** 80,83 **** --- 80,84 ---- x = dgetmem(flng + flng); y = x + flng; + size = flng; } if (flng > size) { |
From: Takenori Y. <tak...@us...> - 2017-04-06 09:51:59
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv8249 Modified Files: lpc2lsp.cc lsp2lpc.cc ltcdf.cc Log Message: fix bugs Index: lsp2lpc.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/lsp2lpc.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lsp2lpc.cc 3 Apr 2017 02:03:06 -0000 1.2 --- lsp2lpc.cc 6 Apr 2017 09:51:57 -0000 1.3 *************** *** 67,72 **** kNormalizedFrequencyInRadians = 0, kNormalizedFrequencyInCycles, ! kFrequecnyInkHz, ! kFrequecnyInHz, kNumInputFormats }; --- 67,72 ---- kNormalizedFrequencyInRadians = 0, kNormalizedFrequencyInCycles, ! kFrequencyInkHz, ! kFrequencyInHz, kNumInputFormats }; *************** *** 247,251 **** break; } ! case kFrequecnyInkHz: { std::transform(line_spectral_pairs.begin() + 1, line_spectral_pairs.end(), --- 247,251 ---- break; } ! case kFrequencyInkHz: { std::transform(line_spectral_pairs.begin() + 1, line_spectral_pairs.end(), *************** *** 255,259 **** break; } ! case kFrequecnyInHz: { std::transform(line_spectral_pairs.begin() + 1, line_spectral_pairs.end(), --- 255,259 ---- break; } ! case kFrequencyInHz: { std::transform(line_spectral_pairs.begin() + 1, line_spectral_pairs.end(), Index: lpc2lsp.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/lpc2lsp.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lpc2lsp.cc 15 Mar 2017 13:38:04 -0000 1.2 --- lpc2lsp.cc 6 Apr 2017 09:51:57 -0000 1.3 *************** *** 76,80 **** const OutputGainTypes kDefaultOutputGainType(kLinearGain); const OutputFormats kDefaultOutputFormat(kNormalizedFrequencyInRadians); ! const int kDefaultNumSplit(128); const int kDefaultNumIteration(4); const double kDefaultEpsilon(1e-6); --- 76,80 ---- const OutputGainTypes kDefaultOutputGainType(kLinearGain); const OutputFormats kDefaultOutputFormat(kNormalizedFrequencyInRadians); ! const int kDefaultNumSplit(256); const int kDefaultNumIteration(4); const double kDefaultEpsilon(1e-6); Index: ltcdf.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/ltcdf.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ltcdf.cc 15 Mar 2017 13:38:04 -0000 1.2 --- ltcdf.cc 6 Apr 2017 09:51:57 -0000 1.3 *************** *** 96,100 **** for (;;) { ! const int option_char(getopt_long(argc, argv, "m:p:i:tkh", NULL, NULL)); if (-1 == option_char) break; --- 96,100 ---- for (;;) { ! const int option_char(getopt_long(argc, argv, "m:p:i:kh", NULL, NULL)); if (-1 == option_char) break; |
From: Takenori Y. <tak...@us...> - 2017-04-06 09:46:52
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv8050 Modified Files: Makefile mgc2mgc.cc mgc2sp.cc Log Message: rename class names Index: mgc2mgc.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mgc2mgc.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** mgc2mgc.cc 15 Mar 2017 13:38:04 -0000 1.5 --- mgc2mgc.cc 6 Apr 2017 09:46:50 -0000 1.6 *************** *** 49,53 **** #include <vector> ! #include "generalized_cepstrum_transform.h" #include "sptk_utils.h" --- 49,53 ---- #include <vector> ! #include "mel_generalized_cepstrum_transform.h" #include "sptk_utils.h" *************** *** 245,254 **** // prepare for gain normalization ! sptk::GeneralizedCepstrumTransform generalized_cepstrum_transform( input_num_order, input_alpha, input_gamma, input_normalization_flag, input_multiplication_flag, output_num_order, output_alpha, output_gamma, output_normalization_flag, output_multiplication_flag); ! sptk::GeneralizedCepstrumTransform::Buffer buffer; ! if (!generalized_cepstrum_transform.IsValid()) { std::ostringstream error_message; error_message << "Failed to set the condition"; --- 245,254 ---- // prepare for gain normalization ! sptk::MelGeneralizedCepstrumTransform mel_generalized_cepstrum_transform( input_num_order, input_alpha, input_gamma, input_normalization_flag, input_multiplication_flag, output_num_order, output_alpha, output_gamma, output_normalization_flag, output_multiplication_flag); ! sptk::MelGeneralizedCepstrumTransform::Buffer buffer; ! if (!mel_generalized_cepstrum_transform.IsValid()) { std::ostringstream error_message; error_message << "Failed to set the condition"; *************** *** 259,276 **** const int input_length(input_num_order + 1); const int output_length(output_num_order + 1); ! std::vector<double> generalized_cepstrum(input_length); ! std::vector<double> transformed_generalized_cepstrum(output_length); ! while (sptk::ReadStream(false, 0, 0, input_length, &generalized_cepstrum, &input_stream)) { // input modification: 1+g*mgc[0] -> mgc[0] if (!input_normalization_flag && input_multiplication_flag) ! (*generalized_cepstrum.begin()) = ! (*(generalized_cepstrum.begin()) - 1.0) / input_gamma; // transform ! if (!generalized_cepstrum_transform.Run( ! generalized_cepstrum, &transformed_generalized_cepstrum, &buffer)) { std::ostringstream error_message; ! error_message << "Failed to run generalized cepstral transformation"; sptk::PrintErrorMessage("mgc2mgc", error_message); return 1; --- 259,277 ---- const int input_length(input_num_order + 1); const int output_length(output_num_order + 1); ! std::vector<double> mel_generalized_cepstrum(input_length); ! std::vector<double> transformed_mel_generalized_cepstrum(output_length); ! while (sptk::ReadStream(false, 0, 0, input_length, &mel_generalized_cepstrum, &input_stream)) { // input modification: 1+g*mgc[0] -> mgc[0] if (!input_normalization_flag && input_multiplication_flag) ! (*mel_generalized_cepstrum.begin()) = ! (*(mel_generalized_cepstrum.begin()) - 1.0) / input_gamma; // transform ! if (!mel_generalized_cepstrum_transform.Run( ! mel_generalized_cepstrum, &transformed_mel_generalized_cepstrum, ! &buffer)) { std::ostringstream error_message; ! error_message << "Failed to run mel-generalized cepstral transformation"; sptk::PrintErrorMessage("mgc2mgc", error_message); return 1; *************** *** 278,288 **** // output modification: mgc[0] -> 1+g*mgc[0] if (!output_normalization_flag && output_multiplication_flag) ! (*transformed_generalized_cepstrum.begin()) = ! *(transformed_generalized_cepstrum.begin()) * output_gamma + 1.0; // write results ! if (!sptk::WriteStream(0, output_length, transformed_generalized_cepstrum, ! &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write generalized cepstrum"; sptk::PrintErrorMessage("mgc2mgc", error_message); return 1; --- 279,289 ---- // output modification: mgc[0] -> 1+g*mgc[0] if (!output_normalization_flag && output_multiplication_flag) ! (*transformed_mel_generalized_cepstrum.begin()) = ! *(transformed_mel_generalized_cepstrum.begin()) * output_gamma + 1.0; // write results ! if (!sptk::WriteStream(0, output_length, ! transformed_mel_generalized_cepstrum, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write mel-generalized cepstrum"; sptk::PrintErrorMessage("mgc2mgc", error_message); return 1; Index: Makefile =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/Makefile,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Makefile 3 Apr 2017 02:03:06 -0000 1.28 --- Makefile 6 Apr 2017 09:46:50 -0000 1.29 *************** *** 56,61 **** generalized_cepstrum_gain_normalization.cc \ generalized_cepstrum_inverse_gain_normalization.cc \ - generalized_cepstrum_to_spectrum.cc \ - generalized_cepstrum_transform.cc \ input_source_from_array.cc \ input_source_from_matrix.cc \ --- 56,59 ---- *************** *** 67,75 **** levinson_durbin_recursion.cc \ line_spectral_pairs_to_linear_predictive_coefficients.cc \ - line_spectral_pairs_to_spectrum.cc \ linear_predictive_coefficients_to_cepstrum.cc \ linear_predictive_coefficients_to_line_spectral_pairs.cc \ linear_predictive_coefficients_to_parcor_coefficients.cc \ m_sequence_generation.cc \ normal_distributed_random_value_generation.cc \ parcor_coefficients_to_linear_predictive_coefficients.cc \ --- 65,75 ---- levinson_durbin_recursion.cc \ line_spectral_pairs_to_linear_predictive_coefficients.cc \ linear_predictive_coefficients_to_cepstrum.cc \ linear_predictive_coefficients_to_line_spectral_pairs.cc \ linear_predictive_coefficients_to_parcor_coefficients.cc \ m_sequence_generation.cc \ + mel_generalized_cepstrum_to_spectrum.cc \ + mel_generalized_cepstrum_transform.cc \ + mel_generalized_line_spectral_pairs_to_spectrum.cc \ normal_distributed_random_value_generation.cc \ parcor_coefficients_to_linear_predictive_coefficients.cc \ Index: mgc2sp.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mgc2sp.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mgc2sp.cc 15 Mar 2017 13:38:04 -0000 1.3 --- mgc2sp.cc 6 Apr 2017 09:46:50 -0000 1.4 *************** *** 52,56 **** #include <vector> ! #include "generalized_cepstrum_to_spectrum.h" #include "sptk_utils.h" --- 52,56 ---- #include <vector> ! #include "mel_generalized_cepstrum_to_spectrum.h" #include "sptk_utils.h" *************** *** 230,238 **** // prepare for gain normalization ! sptk::GeneralizedCepstrumToSpectrum generalized_cepstrum_to_spectrum( num_order, alpha, gamma, normalization_flag, multiplication_flag, fft_size); ! sptk::GeneralizedCepstrumToSpectrum::Buffer buffer; ! if (!generalized_cepstrum_to_spectrum.IsValid()) { std::ostringstream error_message; error_message << "Failed to set condition for transformation"; --- 230,238 ---- // prepare for gain normalization ! sptk::MelGeneralizedCepstrumToSpectrum mel_generalized_cepstrum_to_spectrum( num_order, alpha, gamma, normalization_flag, multiplication_flag, fft_size); ! sptk::MelGeneralizedCepstrumToSpectrum::Buffer buffer; ! if (!mel_generalized_cepstrum_to_spectrum.IsValid()) { std::ostringstream error_message; error_message << "Failed to set condition for transformation"; *************** *** 243,260 **** const int input_length(num_order + 1); const int output_length(fft_size / 2 + 1); ! std::vector<double> generalized_cepstrum(input_length); std::vector<double> amplitude_spectrum(fft_size); std::vector<double> phase_spectrum(fft_size); ! while (sptk::ReadStream(false, 0, 0, input_length, &generalized_cepstrum, &input_stream)) { // input modification if (!normalization_flag && multiplication_flag) { ! (*generalized_cepstrum.begin()) = ! (*(generalized_cepstrum.begin()) - 1.0) / gamma; } // transform ! if (!generalized_cepstrum_to_spectrum.Run(generalized_cepstrum, &litude_spectrum, &phase_spectrum, &buffer)) { --- 243,260 ---- const int input_length(num_order + 1); const int output_length(fft_size / 2 + 1); ! std::vector<double> mel_generalized_cepstrum(input_length); std::vector<double> amplitude_spectrum(fft_size); std::vector<double> phase_spectrum(fft_size); ! while (sptk::ReadStream(false, 0, 0, input_length, &mel_generalized_cepstrum, &input_stream)) { // input modification if (!normalization_flag && multiplication_flag) { ! (*mel_generalized_cepstrum.begin()) = ! (*(mel_generalized_cepstrum.begin()) - 1.0) / gamma; } // transform ! if (!mel_generalized_cepstrum_to_spectrum.Run(mel_generalized_cepstrum, &litude_spectrum, &phase_spectrum, &buffer)) { |
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv7879 Added Files: mel_generalized_cepstrum_to_spectrum.cc mel_generalized_cepstrum_to_spectrum.h mel_generalized_cepstrum_transform.cc mel_generalized_cepstrum_transform.h mel_generalized_line_spectral_pairs_to_spectrum.cc mel_generalized_line_spectral_pairs_to_spectrum.h mglsp2sp.cc Removed Files: generalized_cepstrum_to_spectrum.cc generalized_cepstrum_to_spectrum.h generalized_cepstrum_transform.cc generalized_cepstrum_transform.h line_spectral_pairs_to_spectrum.cc line_spectral_pairs_to_spectrum.h lsp2sp.cc Log Message: rename files --- generalized_cepstrum_transform.h DELETED --- --- NEW FILE: mel_generalized_cepstrum_to_spectrum.cc --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // // All rights reserved. // // // // Redistribution and use in source and binary forms, with or // // without modification, are permitted provided that the following // // conditions are met: // // // // - Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above // // copyright notice, this list of conditions and the following // // disclaimer in the documentation and/or other materials provided // // with the distribution. // // - Neither the name of the SPTK working group nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND // // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS // // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // ----------------------------------------------------------------- // #include "mel_generalized_cepstrum_to_spectrum.h" namespace sptk { MelGeneralizedCepstrumToSpectrum::MelGeneralizedCepstrumToSpectrum( int num_order, double alpha, double gamma, bool is_normalized, bool is_multiplied, int fft_size) : mel_generalized_cepstrum_transform_(num_order, alpha, gamma, is_normalized, is_multiplied, fft_size / 2, 0.0, 0.0, false, false), fast_fourier_transform_(fft_size / 2, fft_size, false), is_valid_(true) { if (!mel_generalized_cepstrum_transform_.IsValid() || !fast_fourier_transform_.IsValid()) { is_valid_ = false; } } bool MelGeneralizedCepstrumToSpectrum::Run( const std::vector<double>& mel_generalized_cepstrum, std::vector<double>* amplitude_spectrum, std::vector<double>* phase_spectrum, MelGeneralizedCepstrumToSpectrum::Buffer* buffer) const { if (!is_valid_ || mel_generalized_cepstrum.size() != static_cast<std::size_t>(GetNumOrder() + 1) || NULL == amplitude_spectrum || NULL == phase_spectrum || NULL == buffer) { return false; } if (!mel_generalized_cepstrum_transform_.Run( mel_generalized_cepstrum, &buffer->cepstrum_, &buffer->mel_generalized_cepstrum_transform_buffer_) || !fast_fourier_transform_.Run(buffer->cepstrum_, amplitude_spectrum, phase_spectrum, &buffer->fast_fourier_transform_buffer_)) { return false; } return true; } } // namespace sptk --- NEW FILE: mel_generalized_cepstrum_to_spectrum.h --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // // All rights reserved. // // // // Redistribution and use in source and binary forms, with or // // without modification, are permitted provided that the following // // conditions are met: // // // // - Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above // // copyright notice, this list of conditions and the following // // disclaimer in the documentation and/or other materials provided // // with the distribution. // // - Neither the name of the SPTK working group nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND // // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS // // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // ----------------------------------------------------------------- // #ifndef SPTK_SRC_MEL_GENERALIZED_CEPSTRUM_TO_SPECTRUM_H_ #define SPTK_SRC_MEL_GENERALIZED_CEPSTRUM_TO_SPECTRUM_H_ #include <vector> // std::vector #include "fast_fourier_transform_for_real_sequence.h" #include "mel_generalized_cepstrum_transform.h" #include "sptk_utils.h" namespace sptk { class MelGeneralizedCepstrumToSpectrum { public: class Buffer { public: Buffer() { } virtual ~Buffer() { } private: MelGeneralizedCepstrumTransform::Buffer mel_generalized_cepstrum_transform_buffer_; FastFourierTransformForRealSequence::Buffer fast_fourier_transform_buffer_; std::vector<double> cepstrum_; friend class MelGeneralizedCepstrumToSpectrum; DISALLOW_COPY_AND_ASSIGN(Buffer); }; // MelGeneralizedCepstrumToSpectrum(int num_order, double alpha, double gamma, bool is_normalized, bool is_multiplied, int fft_size); // virtual ~MelGeneralizedCepstrumToSpectrum() { } // int GetNumOrder() const { return mel_generalized_cepstrum_transform_.GetNumInputOrder(); } // double GetAlpha() const { return mel_generalized_cepstrum_transform_.GetInputAlpha(); } // double GetGamma() const { return mel_generalized_cepstrum_transform_.GetInputGamma(); } // bool IsNormalized() const { return mel_generalized_cepstrum_transform_.IsNormalizedInput(); } // bool IsMultiplied() const { return mel_generalized_cepstrum_transform_.IsMultipliedInput(); } // int GetFftSize() const { return fast_fourier_transform_.GetFftSize(); } // bool IsValid() const { return is_valid_; } // bool Run(const std::vector<double>& mel_generalized_cepstrum, std::vector<double>* amplitude_spectrum, std::vector<double>* phase_spectrum, MelGeneralizedCepstrumToSpectrum::Buffer* buffer) const; private: // const MelGeneralizedCepstrumTransform mel_generalized_cepstrum_transform_; // const FastFourierTransformForRealSequence fast_fourier_transform_; // bool is_valid_; // DISALLOW_COPY_AND_ASSIGN(MelGeneralizedCepstrumToSpectrum); }; } // namespace sptk #endif // SPTK_SRC_MEL_GENERALIZED_CEPSTRUM_TO_SPECTRUM_H_ --- NEW FILE: mel_generalized_line_spectral_pairs_to_spectrum.cc --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-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_generalized_line_spectral_pairs_to_spectrum.h" #include <cmath> // std::atan, std::cos, std::fabs, std::sin #include <cstddef> // std::size_t namespace sptk { MelGeneralizedLineSpectralPairsToSpectrum:: MelGeneralizedLineSpectralPairsToSpectrum(int num_input_order, double alpha, double gamma, int num_output_order) : num_input_order_(num_input_order), alpha_(alpha), gamma_(gamma), num_output_order_(num_output_order), is_valid_(true) { if (num_input_order < 0 || num_output_order < 0 || gamma < -1.0 || 0.0 <= gamma) { is_valid_ = false; } } bool MelGeneralizedLineSpectralPairsToSpectrum::Run( const std::vector<double>& mel_generalized_line_spectral_pairs, std::vector<double>* spectrum) const { if (!is_valid_ || mel_generalized_line_spectral_pairs.size() != static_cast<std::size_t>(num_input_order_ + 1) || NULL == spectrum) { return false; } // prepare memory const int output_length(num_output_order_ + 1); if (spectrum->size() < static_cast<std::size_t>(output_length)) { spectrum->resize(output_length); } // get values const double* input(&(mel_generalized_line_spectral_pairs[0])); double* output(&((*spectrum)[0])); // set value const bool is_odd(num_input_order_ % 2 == 1); const double c1(is_odd ? (num_input_order_ - 1) * sptk::kLogTwo : num_input_order_ * sptk::kLogTwo); const double c2(0.5 / gamma_); const double delta(0 == num_output_order_ ? 0.0 : sptk::kPi / num_output_order_); double omega(0.0); for (int j(0); j < output_length; ++j, omega += delta) { const double warped_omega( 0.0 == alpha_ ? omega : omega + 2.0 * std::atan(alpha_ * std::sin(omega) / (1.0 - alpha_ * std::cos(omega)))); const double cos_omega(std::cos(warped_omega)); double p(0.0); for (int i(2); i <= num_input_order_; i += 2) { p += 2.0 * sptk::FloorLog(std::fabs(cos_omega - std::cos(input[i]))); } double q(0.0); for (int i(1); i <= num_input_order_; i += 2) { q += 2.0 * sptk::FloorLog(std::fabs(cos_omega - std::cos(input[i]))); } if (is_odd) { p += 2.0 * sptk::FloorLog(std::sin(warped_omega)); } else { p += 2.0 * sptk::FloorLog(std::sin(warped_omega * 0.5)); q += 2.0 * sptk::FloorLog(std::cos(warped_omega * 0.5)); } output[j] = sptk::FloorLog(input[0]) + c2 * (c1 + sptk::AddInLogSpace(p, q)); } return true; } } // namespace sptk --- NEW FILE: mel_generalized_line_spectral_pairs_to_spectrum.h --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-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_GENERALIZED_LINE_SPECTRAL_PAIRS_TO_SPECTRUM_H_ #define SPTK_SRC_MEL_GENERALIZED_LINE_SPECTRAL_PAIRS_TO_SPECTRUM_H_ #include <vector> // std::vector #include "sptk_utils.h" namespace sptk { class MelGeneralizedLineSpectralPairsToSpectrum { public: // MelGeneralizedLineSpectralPairsToSpectrum(int num_input_order, double alpha, double gamma, int num_output_order); // virtual ~MelGeneralizedLineSpectralPairsToSpectrum() { } // int GetNumInputOrder() const { return num_input_order_; } // double GetAlpha() const { return alpha_; } // double GetGamma() const { return gamma_; } // int GetNumOutputOrder() const { return num_output_order_; } // bool IsValid() const { return is_valid_; } // Assume that the first element of line_spectral_pairs is linear gain and // the other elements are in normalized frequency (0...pi). bool Run(const std::vector<double>& line_spectral_pairs, std::vector<double>* spectrum) const; private: // const int num_input_order_; // const double alpha_; // const double gamma_; // const int num_output_order_; // bool is_valid_; // DISALLOW_COPY_AND_ASSIGN(MelGeneralizedLineSpectralPairsToSpectrum); }; } // namespace sptk #endif // SPTK_SRC_MEL_GENERALIZED_LINE_SPECTRAL_PAIRS_TO_SPECTRUM_H_ --- line_spectral_pairs_to_spectrum.cc DELETED --- --- generalized_cepstrum_transform.cc DELETED --- --- generalized_cepstrum_to_spectrum.cc DELETED --- --- NEW FILE: mel_generalized_cepstrum_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_MEL_GENERALIZED_CEPSTRUM_TRANSFORM_H_ #define SPTK_SRC_MEL_GENERALIZED_CEPSTRUM_TRANSFORM_H_ #include <vector> // std::vector #include "frequency_transform.h" #include "sptk_utils.h" namespace sptk { class MelGeneralizedCepstrumTransform { public: class Buffer { public: Buffer() { } virtual ~Buffer() { } private: FrequencyTransform::Buffer frequency_transform_buffer_; std::vector<double> temporary_mel_generalized_cepstrum_; friend class MelGeneralizedCepstrumTransform; DISALLOW_COPY_AND_ASSIGN(Buffer); }; class ModuleInterface { public: virtual ~ModuleInterface() { } virtual bool IsValid() const = 0; virtual bool Run( const std::vector<double>& input, std::vector<double>* output, FrequencyTransform::Buffer* frequency_transform_buffer) const = 0; }; // MelGeneralizedCepstrumTransform( int num_input_order_, double input_alpha_, double input_gamma_, bool is_normalized_input_, bool is_multiplied_input_, int num_output_order_, double output_alpha_, double output_gamma_, bool is_normalized_output_, bool is_multiplied_output_); // virtual ~MelGeneralizedCepstrumTransform() { for (std::vector<MelGeneralizedCepstrumTransform::ModuleInterface*>:: iterator itr(modules_.begin()); itr != modules_.end(); ++itr) { delete (*itr); } } // int GetNumInputOrder() const { return num_input_order_; } // double GetInputAlpha() const { return input_alpha_; } // double GetInputGamma() const { return input_gamma_; } // bool IsNormalizedInput() const { return is_normalized_input_; } // bool IsMultipliedInput() const { return is_multiplied_input_; } // int GetNumOutputOrder() const { return num_output_order_; } // double GetOutputAlpha() const { return output_alpha_; } // double GetOutputGamma() const { return output_gamma_; } // bool IsNormalizedOutut() const { return is_normalized_output_; } // bool IsMultipliedOutput() const { return is_multiplied_output_; } // bool IsValid() const { return is_valid_; } // bool Run(const std::vector<double>& input, std::vector<double>* output, MelGeneralizedCepstrumTransform::Buffer* buffer) const; private: // const int num_input_order_; // const double input_alpha_; // const double input_gamma_; // const bool is_normalized_input_; // const bool is_multiplied_input_; // const int num_output_order_; // const double output_alpha_; // const double output_gamma_; // const bool is_normalized_output_; // const bool is_multiplied_output_; // double alpha_transform_; // std::vector<MelGeneralizedCepstrumTransform::ModuleInterface*> modules_; // bool is_valid_; // DISALLOW_COPY_AND_ASSIGN(MelGeneralizedCepstrumTransform); }; } // namespace sptk #endif // SPTK_SRC_MEL_GENERALIZED_CEPSTRUM_TRANSFORM_H_ --- NEW FILE: mel_generalized_cepstrum_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-2016 Nagoya Institute of Technology // // Department of Computer Science // // // // All rights reserved. // // // // Redistribution and use in source and binary forms, with or // // without modification, are permitted provided that the following // // conditions are met: // // // // - Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above // // copyright notice, this list of conditions and the following // // disclaimer in the documentation and/or other materials provided // // with the distribution. // // - Neither the name of the SPTK working group nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND // // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS // // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // ----------------------------------------------------------------- // #include "mel_generalized_cepstrum_transform.h" #include <algorithm> // std::copy, std::transform #include <functional> // std::multiplies #include <vector> // std::vector #include "frequency_transform.h" #include "generalized_cepstrum_gain_normalization.h" #include "generalized_cepstrum_inverse_gain_normalization.h" namespace { class GainNormalizationModule : public sptk::MelGeneralizedCepstrumTransform::ModuleInterface { public: GainNormalizationModule(int num_order, double gamma) : generalized_cepstrum_gain_normalization_(num_order, gamma) { } virtual bool IsValid() const { return generalized_cepstrum_gain_normalization_.IsValid(); } virtual bool Run( const std::vector<double>& input, std::vector<double>* output, sptk::FrequencyTransform::Buffer* frequency_transform_buffer) const { if (!generalized_cepstrum_gain_normalization_.Run(input, output)) { return false; } output->resize(generalized_cepstrum_gain_normalization_.GetNumOrder() + 1); return true; } private: const sptk::GeneralizedCepstrumGainNormalization generalized_cepstrum_gain_normalization_; DISALLOW_COPY_AND_ASSIGN(GainNormalizationModule); }; class InverseGainNormalizationModule : public sptk::MelGeneralizedCepstrumTransform::ModuleInterface { public: InverseGainNormalizationModule(int num_order, double gamma) : generalized_cepstrum_inverse_gain_normalization_(num_order, gamma) { } virtual bool IsValid() const { return generalized_cepstrum_inverse_gain_normalization_.IsValid(); } virtual bool Run( const std::vector<double>& input, std::vector<double>* output, sptk::FrequencyTransform::Buffer* frequency_transform_buffer) const { if (!generalized_cepstrum_inverse_gain_normalization_.Run(input, output)) { return false; } output->resize( generalized_cepstrum_inverse_gain_normalization_.GetNumOrder() + 1); return true; } private: const sptk::GeneralizedCepstrumInverseGainNormalization generalized_cepstrum_inverse_gain_normalization_; DISALLOW_COPY_AND_ASSIGN(InverseGainNormalizationModule); }; class FrequencyTransformModule : public sptk::MelGeneralizedCepstrumTransform::ModuleInterface { public: FrequencyTransformModule(int num_input_order, int num_output_order, double alpha_transform) : frequency_transform_(num_input_order, num_output_order, alpha_transform) { } virtual bool IsValid() const { return frequency_transform_.IsValid(); } virtual bool Run( const std::vector<double>& input, std::vector<double>* output, sptk::FrequencyTransform::Buffer* frequency_transform_buffer) const { if (!frequency_transform_.Run(input, output, frequency_transform_buffer)) { return false; } output->resize(frequency_transform_.GetNumOutputOrder() + 1); return true; } private: const sptk::FrequencyTransform frequency_transform_; DISALLOW_COPY_AND_ASSIGN(FrequencyTransformModule); }; class MelGeneralizedCepstrumTransformModule : public sptk::MelGeneralizedCepstrumTransform::ModuleInterface { public: MelGeneralizedCepstrumTransformModule(int num_input_order, int num_output_order, double input_gamma, double output_gamma) : num_input_order_(num_input_order), num_output_order_(num_output_order), input_gamma_(input_gamma), output_gamma_(output_gamma) { } virtual bool IsValid() const { return true; } virtual bool Run( const std::vector<double>& input, std::vector<double>* output, sptk::FrequencyTransform::Buffer* frequency_transform_buffer) const { if (output->size() != static_cast<std::size_t>(num_output_order_ + 1)) { output->resize(num_output_order_ + 1); } const double* c1(&(input)[0]); double* c2(&((*output)[0])); c2[0] = c1[0]; for (int i(1); i <= num_output_order_; ++i) { double ss1(0.0), ss2(0.0); const int min(num_input_order_ < i ? num_input_order_ : i - 1); for (int k(1); k <= min; ++k) { const int mk(i - k); const double cc(c1[k] * c2[mk]); ss2 += k * cc; ss1 += mk * cc; } if (i <= num_input_order_) c2[i] = c1[i] + (output_gamma_ * ss2 - input_gamma_ * ss1) / i; else c2[i] = (output_gamma_ * ss2 - input_gamma_ * ss1) / i; } return true; } private: const int num_input_order_; const int num_output_order_; const double input_gamma_; const double output_gamma_; DISALLOW_COPY_AND_ASSIGN(MelGeneralizedCepstrumTransformModule); }; class GammaDivisionModule : public sptk::MelGeneralizedCepstrumTransform::ModuleInterface { public: GammaDivisionModule(int num_order, double gamma) : num_order_(num_order), gamma_(gamma) { } virtual bool IsValid() const { return true; } virtual bool Run( const std::vector<double>& input, std::vector<double>* output, sptk::FrequencyTransform::Buffer* frequency_transform_buffer) const { if (output->size() != static_cast<std::size_t>(num_order_ + 1)) { output->resize(num_order_ + 1); } // c[0] is not changed *(output->begin()) = *(input.begin()); // c[1-m] /= g std::transform(++(input.begin()), input.end(), ++(output->begin()), std::bind1st(std::multiplies<double>(), 1.0 / gamma_)); return true; } private: const int num_order_; const double gamma_; DISALLOW_COPY_AND_ASSIGN(GammaDivisionModule); }; class GammaMultiplicationModule : public sptk::MelGeneralizedCepstrumTransform::ModuleInterface { public: GammaMultiplicationModule(int num_order, double gamma) : num_order_(num_order), gamma_(gamma) { } virtual bool IsValid() const { return true; } virtual bool Run( const std::vector<double>& input, std::vector<double>* output, sptk::FrequencyTransform::Buffer* frequency_transform_buffer) const { if (output->size() != static_cast<std::size_t>(num_order_ + 1)) { output->resize(num_order_ + 1); } // copy c[0] *(output->begin()) = *(input.begin()); // c[1-m] *= g std::transform(++(input.begin()), input.end(), ++(output->begin()), std::bind1st(std::multiplies<double>(), gamma_)); return true; } private: const int num_order_; const double gamma_; DISALLOW_COPY_AND_ASSIGN(GammaMultiplicationModule); }; } // namespace namespace sptk { MelGeneralizedCepstrumTransform::MelGeneralizedCepstrumTransform( int num_input_order, double input_alpha, double input_gamma, bool is_normalized_input, bool is_multiplied_input, int num_output_order, double output_alpha, double output_gamma, bool is_normalized_output, bool is_multiplied_output) : num_input_order_(num_input_order), input_alpha_(input_alpha), input_gamma_(input_gamma), is_normalized_input_(is_normalized_input), is_multiplied_input_(is_multiplied_input), num_output_order_(num_output_order), output_alpha_(output_alpha), output_gamma_(output_gamma), is_normalized_output_(is_normalized_output), is_multiplied_output_(is_multiplied_output), alpha_transform_(0.0), is_valid_(true) { if (num_input_order_ < 0 || num_output_order_ < 0 || (input_alpha_ != output_alpha_ && 1.0 == input_alpha_ * output_alpha_) || (is_multiplied_input && 0.0 == input_gamma_)) { is_valid_ = false; return; } if (input_alpha_ != output_alpha_) { alpha_transform_ = (output_alpha_ - input_alpha_) / (1.0 - input_alpha_ * output_alpha_); } // ch_a: change alpha // norm_i: normalized input // norm_o: normalized output // ch_g: change gamma // ch_m: change order // ch_a=F norm_i=F norm_o=F ch_g=F ch_m=F // -> -> -> -> // ch_a=F norm_i=F norm_o=F ch_g=F ch_m=T // -> -> gnorm -> gc2gc -> ignorm // ch_a=F norm_i=F norm_o=F ch_g=T ch_m=F // -> -> gnorm -> gc2gc -> ignorm // ch_a=F norm_i=F norm_o=F ch_g=T ch_m=T // -> -> gnorm -> gc2gc -> ignorm // ch_a=F norm_i=F norm_o=T ch_g=F ch_m=F // -> -> gnorm -> -> // ch_a=F norm_i=F norm_o=T ch_g=F ch_m=T // -> -> gnorm -> gc2gc -> // ch_a=F norm_i=F norm_o=T ch_g=T ch_m=F // -> -> gnorm -> gc2gc -> // ch_a=F norm_i=F norm_o=T ch_g=T ch_m=T // -> -> gnorm -> gc2gc -> // ch_a=F norm_i=T norm_o=F ch_g=F ch_m=F // -> -> -> -> ignorm // ch_a=F norm_i=T norm_o=F ch_g=F ch_m=T // -> -> -> gc2gc -> ignorm // ch_a=F norm_i=T norm_o=F ch_g=T ch_m=F // -> -> -> gc2gc -> ignorm // ch_a=F norm_i=T norm_o=F ch_g=T ch_m=T // -> -> -> gc2gc -> ignorm // ch_a=F norm_i=T norm_o=T ch_g=F ch_m=F // -> -> -> -> // ch_a=F norm_i=T norm_o=T ch_g=F ch_m=T // -> -> -> gc2gc -> // ch_a=F norm_i=T norm_o=T ch_g=T ch_m=F // -> -> -> gc2gc -> // ch_a=F norm_i=T norm_o=T ch_g=T ch_m=T // -> -> -> gc2gc -> // ch_a=T norm_i=F norm_o=F ch_g=F ch_m=F // -> freqt -> -> -> // ch_a=T norm_i=F norm_o=F ch_g=F ch_m=T // -> freqt -> -> -> // ch_a=T norm_i=F norm_o=F ch_g=T ch_m=F // -> freqt -> gnorm -> gc2gc -> ignorm // ch_a=T norm_i=F norm_o=F ch_g=T ch_m=T // -> freqt -> gnorm -> gc2gc -> ignorm // ch_a=T norm_i=F norm_o=T ch_g=F ch_m=F // -> freqt -> gnorm -> -> // ch_a=T norm_i=F norm_o=T ch_g=F ch_m=T // -> freqt -> gnorm -> -> // ch_a=T norm_i=F norm_o=T ch_g=T ch_m=F // -> freqt -> gnorm -> gc2gc -> // ch_a=T norm_i=F norm_o=T ch_g=T ch_m=T // -> freqt -> gnorm -> gc2gc -> // ch_a=T norm_i=T norm_o=F ch_g=F ch_m=F // ignorm -> freqt -> -> -> // ch_a=T norm_i=T norm_o=F ch_g=F ch_m=T // ignorm -> freqt -> -> -> // ch_a=T norm_i=T norm_o=F ch_g=T ch_m=F // ignorm -> freqt -> gnorm -> gc2gc -> ignorm // ch_a=T norm_i=T norm_o=F ch_g=T ch_m=T // ignorm -> freqt -> gnorm -> gc2gc -> ignorm // ch_a=T norm_i=T norm_o=T ch_g=F ch_m=F // ignorm -> freqt -> gnorm -> -> // ch_a=T norm_i=T norm_o=T ch_g=F ch_m=T // ignorm -> freqt -> gnorm -> -> // ch_a=T norm_i=T norm_o=T ch_g=T ch_m=F // ignorm -> freqt -> gnorm -> gc2gc -> // ch_a=T norm_i=T norm_o=T ch_g=T ch_m=T // ignorm -> freqt -> gnorm -> gc2gc -> if (0.0 == alpha_transform_) { if (num_input_order_ == num_output_order_ && input_gamma_ == output_gamma_) { if (!is_multiplied_input_ && is_multiplied_output_) modules_.push_back( new GammaMultiplicationModule(num_input_order_, input_gamma_)); if (!is_normalized_input_ && is_normalized_output_) modules_.push_back( new GainNormalizationModule(num_input_order_, input_gamma_)); if (is_normalized_input_ && !is_normalized_output_) modules_.push_back(new InverseGainNormalizationModule(num_output_order_, output_gamma_)); if (is_multiplied_input_ && !is_multiplied_output_) modules_.push_back( new GammaDivisionModule(num_output_order_, output_gamma_)); } else { if (is_multiplied_input_) modules_.push_back( new GammaDivisionModule(num_input_order_, input_gamma_)); if (!is_normalized_input_) modules_.push_back( new GainNormalizationModule(num_input_order_, input_gamma_)); modules_.push_back(new MelGeneralizedCepstrumTransformModule( num_input_order_, num_output_order_, input_gamma_, output_gamma_)); if (!is_normalized_output_) modules_.push_back(new InverseGainNormalizationModule(num_output_order_, output_gamma_)); if (is_multiplied_output_) modules_.push_back( new GammaMultiplicationModule(num_output_order_, output_gamma_)); } } else { if (is_multiplied_input_) modules_.push_back( new GammaDivisionModule(num_input_order_, input_gamma_)); if (is_normalized_input_) modules_.push_back( new InverseGainNormalizationModule(num_input_order_, input_gamma_)); modules_.push_back(new FrequencyTransformModule( num_input_order_, num_output_order_, alpha_transform_)); if (is_normalized_output_ || input_gamma_ != output_gamma_) modules_.push_back( new GainNormalizationModule(num_output_order_, input_gamma_)); if (input_gamma_ != output_gamma_) modules_.push_back(new MelGeneralizedCepstrumTransformModule( num_output_order_, num_output_order_, input_gamma_, output_gamma_)); if (!is_normalized_output_ && input_gamma_ != output_gamma_) modules_.push_back( new InverseGainNormalizationModule(num_output_order_, output_gamma_)); if (is_multiplied_output_) modules_.push_back( new GammaMultiplicationModule(num_output_order_, output_gamma_)); } for (std::vector<MelGeneralizedCepstrumTransform::ModuleInterface*>::iterator itr(modules_.begin()); itr != modules_.end(); ++itr) { if (!(*itr)->IsValid()) { is_valid_ = false; break; } } } bool MelGeneralizedCepstrumTransform::Run( const std::vector<double>& input, std::vector<double>* output, MelGeneralizedCepstrumTransform::Buffer* buffer) const { if (!is_valid_ || static_cast<std::size_t>(num_input_order_ + 1) != input.size() || NULL == output || NULL == buffer) { return false; } if (modules_.empty()) { if (output->size() < static_cast<std::size_t>(num_output_order_ + 1)) { output->resize(num_output_order_ + 1); } std::copy(input.begin(), input.end(), output->begin()); return true; } for (std::vector<MelGeneralizedCepstrumTransform::ModuleInterface*>:: const_iterator itr(modules_.begin()); itr != modules_.end(); ++itr) { if (itr != modules_.begin()) { output->swap(buffer->temporary_mel_generalized_cepstrum_); } if (!(*itr)->Run((itr == modules_.begin()) ? input : buffer->temporary_mel_generalized_cepstrum_, output, &(buffer->frequency_transform_buffer_))) { return false; } } return true; } } // namespace sptk --- generalized_cepstrum_to_spectrum.h DELETED --- --- lsp2sp.cc DELETED --- --- line_spectral_pairs_to_spectrum.h DELETED --- --- NEW FILE: mglsp2sp.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 <algorithm> #include <cmath> #include <fstream> #include <functional> #include <iostream> #include <sstream> #include <vector> #include "mel_generalized_line_spectral_pairs_to_spectrum.h" #include "sptk_utils.h" namespace { enum InputGainTypes { kLinearGain = 0, kLogGain, kWithoutGain, kNumInputGainTypes }; enum InputFormats { kNormalizedFrequencyInRadians = 0, kNormalizedFrequencyInCycles, kFrequencyInkHz, kFrequencyInHz, kNumInputFormats }; enum OutputFormats { kLogAmplitudeSpectrumInDecibels = 0, kLogAmplitudeSpectrum, kAmplitudeSpectrum, kPowerSpectrum, kNumOutputFormats }; const int kDefaultNumOrder(25); const double kDefaultAlpha(0.0); const double kDefaultGamma(-1.0); const int kDefaultSpectrumLength(128); const double kDefaultSamplingFrequency(10.0); const InputGainTypes kDefaultInputGainType(kLinearGain); const InputFormats kDefaultInputFormat(kNormalizedFrequencyInRadians); const OutputFormats kDefaultOutputFormat(kLogAmplitudeSpectrumInDecibels); void PrintUsage(std::ostream* stream) { // clang-format off *stream << std::endl; *stream << " mglsp2sp - transform mel-generalized line spectral pairs to spectrum" << std::endl; *stream << std::endl; *stream << " usage:" << std::endl; *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; *stream << " 2 (|H(z)|)" << std::endl; *stream << " 3 (|H(z)|^2)" << std::endl; *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; *stream << std::endl; // clang-format on } } // namespace int main(int argc, char* argv[]) { int num_order(kDefaultNumOrder); double alpha(kDefaultAlpha); double gamma(kDefaultGamma); int spectrum_length(kDefaultSpectrumLength); double sampling_frequency(kDefaultSamplingFrequency); InputGainTypes input_gain_type(kDefaultInputGainType); InputFormats input_format(kDefaultInputFormat); OutputFormats output_format(kDefaultOutputFormat); for (;;) { const int option_char( getopt_long(argc, argv, "m:a:g:c:l:s:k:q: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("mglsp2sp", 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("mglsp2sp", error_message); return 1; } break; } case 'g': { const int min(-1.0); const int max(0.0); if (!sptk::ConvertStringToDouble(optarg, &gamma) || gamma < min || max <= gamma) { std::ostringstream error_message; error_message << "The argument for the -g option must be numeric " << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("mglsp2sp", error_message); return 1; } break; } case 'c': { int tmp; if (!sptk::ConvertStringToInteger(optarg, &tmp) || tmp < 1) { std::ostringstream error_message; error_message << "The argument for the -c option must be a " << "positive integer"; sptk::PrintErrorMessage("mglsp2sp", error_message); return 1; } gamma = -1.0 / tmp; break; } case 'l': { if (!sptk::ConvertStringToInteger(optarg, &spectrum_length) || spectrum_length <= 0) { std::ostringstream error_message; error_message << "The argument for the -l option must be a positive integer"; sptk::PrintErrorMessage("mglsp2sp", error_message); return 1; } break; } case 's': { if (!sptk::ConvertStringToDouble(optarg, &sampling_frequency) || sampling_frequency <= 0.0) { std::ostringstream error_message; error_message << "The argument for the -s option must be a positive number"; sptk::PrintErrorMessage("mglsp2sp", error_message); return 1; } break; } case 'k': { const int min(0); const int max(static_cast<int>(kNumInputGainTypes) - 1); int tmp; if (!sptk::ConvertStringToInteger(optarg, &tmp) || !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; error_message << "The argument for the -k option must be an integer " << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("mglsp2sp", error_message); return 1; } input_gain_type = static_cast<InputGainTypes>(tmp); break; } case 'q': { const int min(0); const int max(static_cast<int>(kNumInputFormats) - 1); int tmp; if (!sptk::ConvertStringToInteger(optarg, &tmp) || !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; error_message << "The argument for the -q option must be an integer " << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("mglsp2sp", error_message); return 1; } input_format = static_cast<InputFormats>(tmp); break; } case 'o': { const int min(0); const int max(static_cast<int>(kNumOutputFormats) - 1); int tmp; if (!sptk::ConvertStringToInteger(optarg, &tmp) || !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; error_message << "The argument for the -o option must be an integer " << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("mglsp2sp", error_message); return 1; } output_format = static_cast<OutputFormats>(tmp); break; } case 'h': { PrintUsage(&std::cout); return 0; } default: { PrintUsage(&std::cerr); return 1; } } } // get input file const char* input_file((optind < argc) ? argv[argc - 1] : NULL); // open stream std::ifstream ifs; ifs.open(input_file, std::ios::in | std::ios::binary); if (ifs.fail() && NULL != input_file) { std::ostringstream error_message; error_message << "Cannot open file " << input_file; sptk::PrintErrorMessage("mglsp2sp", error_message); return 1; } std::istream& input_stream(ifs.fail() ? std::cin : ifs); // prepare to transform sptk::MelGeneralizedLineSpectralPairsToSpectrum mel_generalized_line_spectral_pairs_to_spectrum(num_order, alpha, gamma, spectrum_length); if (!mel_generalized_line_spectral_pairs_to_spectrum.IsValid()) { std::ostringstream error_message; error_message << "Failed to set condition for transformation"; sptk::PrintErrorMessage("mglsp2sp", error_message); return 1; } const int input_length(num_order + 1); const int output_length(spectrum_length + 1); const int read_size(kWithoutGain == input_gain_type ? num_order : input_length); const int read_point(kWithoutGain == input_gain_type ? 1 : 0); std::vector<double> mel_generalized_line_spectral_pairs(input_length); std::vector<double> spectrum(output_length); while (sptk::ReadStream(false, 0, read_point, read_size, &mel_generalized_line_spectral_pairs, &input_stream)) { switch (input_gain_type) { case kLinearGain: { // nothing to do break; } case kLogGain: { mel_generalized_line_spectral_pairs[0] = std::exp(mel_generalized_line_spectral_pairs[0]); break; } case kWithoutGain: { mel_generalized_line_spectral_pairs[0] = 1.0; break; } default: { break; } } switch (input_format) { case kNormalizedFrequencyInRadians: { // nothing to do break; } case kNormalizedFrequencyInCycles: { std::transform(mel_generalized_line_spectral_pairs.begin() + 1, mel_generalized_line_spectral_pairs.end(), mel_generalized_line_spectral_pairs.begin() + 1, std::bind1st(std::multiplies<double>(), sptk::kTwoPi)); break; } case kFrequencyInkHz: { std::transform(mel_generalized_line_spectral_pairs.begin() + 1, mel_generalized_line_spectral_pairs.end(), mel_generalized_line_spectral_pairs.begin() + 1, std::bind1st(std::multiplies<double>(), sptk::kTwoPi / sampling_frequency)); break; } case kFrequencyInHz: { std::transform(mel_generalized_line_spectral_pairs.begin() + 1, mel_generalized_... [truncated message content] |
From: Takenori Y. <tak...@us...> - 2017-04-03 11:16:19
|
Update of /cvsroot/sp-tk/SPTK/src/bin/mgclsp2sp In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv23562 Modified Files: mgclsp2sp.c Log Message: fix bugs Index: mgclsp2sp.c =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/mgclsp2sp/mgclsp2sp.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** mgclsp2sp.c 22 Dec 2016 10:53:08 -0000 1.5 --- mgclsp2sp.c 3 Apr 2017 11:16:17 -0000 1.6 *************** *** 281,285 **** } ! if (loggain == 0) *lsp = log(*lsp); --- 281,289 ---- } ! if (itype == 3) ! for (i = gain; i < m + gain; i++) ! lsp[i] /= 1000; ! ! if (gain == 1 && loggain == 0) *lsp = log(*lsp); |
From: Takenori Y. <tak...@us...> - 2017-04-03 06:05:56
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv8703 Added Files: lsp2sp.cc Log Message: add lsp2sp command --- NEW FILE: lsp2sp.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 <algorithm> #include <cmath> #include <fstream> #include <functional> #include <iostream> #include <sstream> #include <vector> #include "line_spectral_pairs_to_spectrum.h" #include "sptk_utils.h" namespace { enum InputGainTypes { kLinearGain = 0, kLogGain, kWithoutGain, kNumInputGainTypes }; enum InputFormats { kNormalizedFrequencyInRadians = 0, kNormalizedFrequencyInCycles, kFrequencyInkHz, kFrequencyInHz, kNumInputFormats }; enum OutputFormats { kLogAmplitudeSpectrumInDecibels = 0, kLogAmplitudeSpectrum, kAmplitudeSpectrum, kPowerSpectrum, kNumOutputFormats }; const int kDefaultNumOrder(25); const int kDefaultSpectrumLength(256); const double kDefaultSamplingFrequency(10.0); const InputGainTypes kDefaultInputGainType(kLinearGain); const InputFormats kDefaultInputFormat(kNormalizedFrequencyInRadians); const OutputFormats kDefaultOutputFormat(kLogAmplitudeSpectrumInDecibels); void PrintUsage(std::ostream* stream) { // clang-format off *stream << std::endl; *stream << " lsp2sp - transform line spectral pairs to spectrum" << std::endl; *stream << std::endl; *stream << " usage:" << std::endl; *stream << " lsp2sp [ options ] [ infile ] > stdout" << std::endl; *stream << " options:" << std::endl; *stream << " -m m : order of line spectral pairs [" << kDefaultNumOrder << "]" << 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; *stream << " 2 (|H(z)|)" << std::endl; *stream << " 3 (|H(z)|^2)" << std::endl; *stream << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; *stream << " 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 << 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 spectrum_length(kDefaultSpectrumLength); double sampling_frequency(kDefaultSamplingFrequency); InputGainTypes input_gain_type(kDefaultInputGainType); InputFormats input_format(kDefaultInputFormat); OutputFormats output_format(kDefaultOutputFormat); for (;;) { const int option_char(getopt_long(argc, argv, "m:l:s:k:q: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("lsp2sp", error_message); return 1; } break; } case 'l': { if (!sptk::ConvertStringToInteger(optarg, &spectrum_length) || spectrum_length <= 0) { std::ostringstream error_message; error_message << "The argument for the -l option must be a positive integer"; sptk::PrintErrorMessage("lsp2sp", error_message); return 1; } break; } case 's': { if (!sptk::ConvertStringToDouble(optarg, &sampling_frequency) || sampling_frequency <= 0.0) { std::ostringstream error_message; error_message << "The argument for the -s option must be a positive number"; sptk::PrintErrorMessage("lsp2sp", error_message); return 1; } break; } case 'k': { const int min(0); const int max(static_cast<int>(kNumInputGainTypes) - 1); int tmp; if (!sptk::ConvertStringToInteger(optarg, &tmp) || !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; error_message << "The argument for the -k option must be an integer " << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("lsp2sp", error_message); return 1; } input_gain_type = static_cast<InputGainTypes>(tmp); break; } case 'q': { const int min(0); const int max(static_cast<int>(kNumInputFormats) - 1); int tmp; if (!sptk::ConvertStringToInteger(optarg, &tmp) || !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; error_message << "The argument for the -q option must be an integer " << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("lsp2sp", error_message); return 1; } input_format = static_cast<InputFormats>(tmp); break; } case 'o': { const int min(0); const int max(static_cast<int>(kNumOutputFormats) - 1); int tmp; if (!sptk::ConvertStringToInteger(optarg, &tmp) || !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; error_message << "The argument for the -o option must be an integer " << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("lsp2sp", error_message); return 1; } output_format = static_cast<OutputFormats>(tmp); break; } case 'h': { PrintUsage(&std::cout); return 0; } default: { PrintUsage(&std::cerr); return 1; } } } // get input file const char* input_file((optind < argc) ? argv[argc - 1] : NULL); // open stream std::ifstream ifs; ifs.open(input_file, std::ios::in | std::ios::binary); if (ifs.fail() && NULL != input_file) { std::ostringstream error_message; error_message << "Cannot open file " << input_file; sptk::PrintErrorMessage("lsp2sp", error_message); return 1; } std::istream& input_stream(ifs.fail() ? std::cin : ifs); // prepare to transform sptk::LineSpectralPairsToSpectrum line_spectral_pairs_to_spectrum( num_order, spectrum_length); if (!line_spectral_pairs_to_spectrum.IsValid()) { std::ostringstream error_message; error_message << "Failed to set condition for transformation"; sptk::PrintErrorMessage("lsp2sp", error_message); return 1; } const int input_length(num_order + 1); const int output_length(spectrum_length + 1); const int read_size(kWithoutGain == input_gain_type ? num_order : input_length); const int read_point(kWithoutGain == input_gain_type ? 1 : 0); std::vector<double> line_spectral_pairs(input_length); std::vector<double> spectrum(output_length); while (sptk::ReadStream(false, 0, read_point, read_size, &line_spectral_pairs, &input_stream)) { switch (input_gain_type) { case kLinearGain: { // nothing to do break; } case kLogGain: { line_spectral_pairs[0] = std::exp(line_spectral_pairs[0]); break; } case kWithoutGain: { line_spectral_pairs[0] = 1.0; break; } default: { break; } } switch (input_format) { case kNormalizedFrequencyInRadians: { // nothing to do break; } case kNormalizedFrequencyInCycles: { std::transform(line_spectral_pairs.begin() + 1, line_spectral_pairs.end(), line_spectral_pairs.begin() + 1, std::bind1st(std::multiplies<double>(), sptk::kTwoPi)); break; } case kFrequencyInkHz: { std::transform(line_spectral_pairs.begin() + 1, line_spectral_pairs.end(), line_spectral_pairs.begin() + 1, std::bind1st(std::multiplies<double>(), sptk::kTwoPi / sampling_frequency)); break; } case kFrequencyInHz: { std::transform(line_spectral_pairs.begin() + 1, line_spectral_pairs.end(), line_spectral_pairs.begin() + 1, std::bind1st(std::multiplies<double>(), sptk::kTwoPi * 0.001 / sampling_frequency)); break; } default: { break; } } if (!line_spectral_pairs_to_spectrum.Run(line_spectral_pairs, &spectrum)) { std::ostringstream error_message; error_message << "Failed to transform line spectral pairs to spectrum"; sptk::PrintErrorMessage("lsp2sp", error_message); return 1; } switch (output_format) { case kLogAmplitudeSpectrumInDecibels: { std::transform(spectrum.begin(), spectrum.end(), spectrum.begin(), std::bind1st(std::multiplies<double>(), sptk::kNp)); break; } case kLogAmplitudeSpectrum: { // nothing to do break; } case kAmplitudeSpectrum: { std::transform(spectrum.begin(), spectrum.end(), spectrum.begin(), std::ptr_fun<double, double>(std::exp)); break; } case kPowerSpectrum: { std::transform(spectrum.begin(), spectrum.end(), spectrum.begin(), std::ptr_fun<double, double>( [](double x) { return std::exp(2.0 * x); })); break; } default: { break; } } if (!sptk::WriteStream(0, output_length, spectrum, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write spectrum"; sptk::PrintErrorMessage("lsp2sp", error_message); return 1; } } return 0; } |
From: Takenori Y. <tak...@us...> - 2017-04-03 02:03:08
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv29728 Modified Files: Makefile line_spectral_pairs_to_linear_predictive_coefficients.cc linear_predictive_coefficients_to_line_spectral_pairs.cc linear_predictive_coefficients_to_line_spectral_pairs.h lsp2lpc.cc sptk_utils.cc sptk_utils.h Added Files: line_spectral_pairs_to_spectrum.cc line_spectral_pairs_to_spectrum.h Log Message: add LineSpectralPairsToSpectrum class Index: lsp2lpc.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/lsp2lpc.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** lsp2lpc.cc 15 Mar 2017 13:42:44 -0000 1.1 --- lsp2lpc.cc 3 Apr 2017 02:03:06 -0000 1.2 *************** *** 237,255 **** switch (input_format) { case kNormalizedFrequencyInRadians: { ! std::transform( ! line_spectral_pairs.begin() + 1, line_spectral_pairs.end(), ! line_spectral_pairs.begin() + 1, ! std::bind1st(std::multiplies<double>(), 1.0 / sptk::kTwoPi)); break; } case kNormalizedFrequencyInCycles: { ! // nothing to do break; } case kFrequecnyInkHz: { ! std::transform( ! line_spectral_pairs.begin() + 1, line_spectral_pairs.end(), ! line_spectral_pairs.begin() + 1, ! std::bind1st(std::multiplies<double>(), 1.0 / sampling_frequency)); break; } --- 237,256 ---- switch (input_format) { case kNormalizedFrequencyInRadians: { ! // nothing to do break; } case kNormalizedFrequencyInCycles: { ! std::transform(line_spectral_pairs.begin() + 1, ! line_spectral_pairs.end(), ! line_spectral_pairs.begin() + 1, ! std::bind1st(std::multiplies<double>(), sptk::kTwoPi)); break; } case kFrequecnyInkHz: { ! std::transform(line_spectral_pairs.begin() + 1, ! line_spectral_pairs.end(), ! line_spectral_pairs.begin() + 1, ! std::bind1st(std::multiplies<double>(), ! sptk::kTwoPi / sampling_frequency)); break; } *************** *** 259,263 **** line_spectral_pairs.begin() + 1, std::bind1st(std::multiplies<double>(), ! 0.001 / sampling_frequency)); break; } --- 260,264 ---- line_spectral_pairs.begin() + 1, std::bind1st(std::multiplies<double>(), ! sptk::kTwoPi * 0.001 / sampling_frequency)); break; } Index: sptk_utils.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/sptk_utils.cc,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** sptk_utils.cc 15 Mar 2017 13:38:04 -0000 1.14 --- sptk_utils.cc 3 Apr 2017 02:03:06 -0000 1.15 *************** *** 47,57 **** #include <algorithm> // std::fill_n #include <cerrno> // errno, ERANGE ! #include <cmath> // std::ceil #include <cstdint> // int8_t, etc. ! #include <cstdlib> // std::size_t, std::strtol. std::strtod #include "int24_t.h" #include "uint24_t.h" namespace sptk { --- 47,64 ---- #include <algorithm> // std::fill_n #include <cerrno> // errno, ERANGE ! #include <cmath> // std::ceil, std::exp, std::log #include <cstdint> // int8_t, etc. ! #include <cstdlib> // std::size_t, std::strtod, std::strtol #include "int24_t.h" #include "uint24_t.h" + namespace { + + // 34 is a reasonable number near log(1e-15) + static const double kThresholdOfInformationLossInLogSpace(-34.0); + + } // namespace + namespace sptk { *************** *** 192,195 **** --- 199,217 ---- } + double FloorLog(double x) { + return (x <= 0.0) ? sptk::kLogZero : std::log(x); + } + + // compute log(x + y) given log(x) and log(y). + double AddInLogSpace(double log_x, double log_y) { + if (log_x == log_y) return log_x + sptk::kLogTwo; + + const double smaller((log_x < log_y) ? log_x : log_y); + const double greater((log_x < log_y) ? log_y : log_x); + const double diff(smaller - greater); + if (diff < kThresholdOfInformationLossInLogSpace) return greater; + return greater + std::log(std::exp(diff) + 1.0); + } + void PrintErrorMessage(const std::string& program_name, const std::ostringstream& message) { Index: linear_predictive_coefficients_to_line_spectral_pairs.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/linear_predictive_coefficients_to_line_spectral_pairs.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** linear_predictive_coefficients_to_line_spectral_pairs.cc 7 Feb 2017 10:00:38 -0000 1.2 --- linear_predictive_coefficients_to_line_spectral_pairs.cc 3 Apr 2017 02:03:06 -0000 1.3 *************** *** 48,51 **** --- 48,74 ---- #include <cstddef> // std::size_t + namespace { + + bool CalculateChebyshevPolynomial(const std::vector<double>& coefficients, + double x, double* y) { + if (coefficients.empty() || NULL == y) { + return false; + } + + const double* c(&coefficients[0]); + double b2(0.0); + double b1(0.0); + for (int i(coefficients.size() - 1); 0 < i; --i) { + const double b0(2.0 * x * b1 - b2 + c[i]); + b2 = b1; + b1 = b0; + } + *y = x * b1 - b2 + c[0]; + + return true; + } + + } // namespace + namespace sptk { *************** *** 179,201 **** } - bool LinearPredictiveCoefficientsToLineSpectralPairs:: - CalculateChebyshevPolynomial(const std::vector<double>& coefficients, - double x, double* y) const { - if (coefficients.empty() || NULL == y) { - return false; - } - - const double* c(&coefficients[0]); - double b2(0.0); - double b1(0.0); - for (int i(coefficients.size() - 1); 0 < i; --i) { - const double b0(2.0 * x * b1 - b2 + c[i]); - b2 = b1; - b1 = b0; - } - *y = x * b1 - b2 + c[0]; - - return true; - } - } // namespace sptk --- 202,204 ---- Index: Makefile =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/Makefile,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Makefile 7 Feb 2017 10:00:38 -0000 1.27 --- Makefile 3 Apr 2017 02:03:06 -0000 1.28 *************** *** 67,70 **** --- 67,71 ---- levinson_durbin_recursion.cc \ line_spectral_pairs_to_linear_predictive_coefficients.cc \ + line_spectral_pairs_to_spectrum.cc \ linear_predictive_coefficients_to_cepstrum.cc \ linear_predictive_coefficients_to_line_spectral_pairs.cc \ Index: linear_predictive_coefficients_to_line_spectral_pairs.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/linear_predictive_coefficients_to_line_spectral_pairs.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** linear_predictive_coefficients_to_line_spectral_pairs.h 26 Jan 2017 10:33:53 -0000 1.1 --- linear_predictive_coefficients_to_line_spectral_pairs.h 3 Apr 2017 02:03:06 -0000 1.2 *************** *** 110,117 **** private: // - bool CalculateChebyshevPolynomial(const std::vector<double>& coefficients, - double x, double* y) const; - - // const int num_order_; --- 110,113 ---- Index: sptk_utils.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/sptk_utils.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** sptk_utils.h 15 Mar 2017 13:38:04 -0000 1.10 --- sptk_utils.h 3 Apr 2017 02:03:06 -0000 1.11 *************** *** 63,66 **** --- 63,68 ---- static const double kTwoPi(6.283185307179586); static const double kNp(8.685889638065035); // 1 Np = 20 / ln(10) dB + static const double kLogTwo(0.693147180559945); + static const double kLogZero(-1.0e+10); template <typename T> *************** *** 81,84 **** --- 83,88 ---- bool IsInRange(int num, int min, int max); bool IsPowerOfTwo(int num); + double FloorLog(double x); + double AddInLogSpace(double log_x, double log_y); void PrintErrorMessage(const std::string& program_name, const std::ostringstream& message); --- NEW FILE: line_spectral_pairs_to_spectrum.cc --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // // All rights reserved. // // // // Redistribution and use in source and binary forms, with or // // without modification, are permitted provided that the following // // conditions are met: // // // // - Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above // // copyright notice, this list of conditions and the following // // disclaimer in the documentation and/or other materials provided // // with the distribution. // // - Neither the name of the SPTK working group nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND // // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS // // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // ----------------------------------------------------------------- // #include "line_spectral_pairs_to_spectrum.h" #include <cmath> // std::cos, std::fabs, std::sin #include <cstddef> // std::size_t namespace sptk { LineSpectralPairsToSpectrum::LineSpectralPairsToSpectrum(int num_input_order, int num_output_order) : num_input_order_(num_input_order), num_output_order_(num_output_order), is_valid_(true) { if (num_input_order < 0 || num_output_order < 0) { is_valid_ = false; } } bool LineSpectralPairsToSpectrum::Run( const std::vector<double>& line_spectral_pairs, std::vector<double>* spectrum) const { if (!is_valid_ || line_spectral_pairs.size() != static_cast<std::size_t>(num_input_order_ + 1) || NULL == spectrum) { return false; } // prepare memory const int output_length(num_output_order_ + 1); if (spectrum->size() < static_cast<std::size_t>(output_length)) { spectrum->resize(output_length); } // get values const double* input(&(line_spectral_pairs[0])); double* output(&((*spectrum)[0])); // set value const bool is_odd(num_input_order_ % 2 == 1); const double c(is_odd ? (num_input_order_ - 1) * sptk::kLogTwo : num_input_order_ * sptk::kLogTwo); const double delta(0 == num_output_order_ ? 0.0 : sptk::kPi / num_output_order_); double omega(0.0); for (int j(0); j < output_length; ++j, omega += delta) { const double cos_omega(std::cos(omega)); double p(0.0); for (int i(2); i <= num_input_order_; i += 2) { p += 2.0 * sptk::FloorLog(std::fabs(cos_omega - std::cos(input[i]))); } double q(0.0); for (int i(1); i <= num_input_order_; i += 2) { q += 2.0 * sptk::FloorLog(std::fabs(cos_omega - std::cos(input[i]))); } if (is_odd) { p += 2.0 * sptk::FloorLog(std::sin(omega)); } else { p += 2.0 * sptk::FloorLog(std::sin(omega * 0.5)); q += 2.0 * sptk::FloorLog(std::cos(omega * 0.5)); } output[j] = sptk::FloorLog(input[0]) - 0.5 * (c + sptk::AddInLogSpace(p, q)); } return true; } } // namespace sptk --- NEW FILE: line_spectral_pairs_to_spectrum.h --- // ----------------------------------------------------------------- // // The Speech Signal Processing Toolkit (SPTK) // // developed by SPTK Working Group // // http://sp-tk.sourceforge.net/ // // ----------------------------------------------------------------- // // // // Copyright (c) 1984-2007 Tokyo Institute of Technology // // Interdisciplinary Graduate School of // // Science and Engineering // // // // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // // All rights reserved. // // // // Redistribution and use in source and binary forms, with or // // without modification, are permitted provided that the following // // conditions are met: // // // // - Redistributions of source code must retain the above copyright // // notice, this list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above // // copyright notice, this list of conditions and the following // // disclaimer in the documentation and/or other materials provided // // with the distribution. // // - Neither the name of the SPTK working group nor the names of its // // contributors may be used to endorse or promote products derived // // from this software without specific prior written permission. // // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND // // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS // // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // // POSSIBILITY OF SUCH DAMAGE. // // ----------------------------------------------------------------- // #ifndef SPTK_SRC_LINE_SPECTRAL_PAIRS_TO_SPECTRUM_H_ #define SPTK_SRC_LINE_SPECTRAL_PAIRS_TO_SPECTRUM_H_ #include <vector> // std::vector #include "sptk_utils.h" namespace sptk { class LineSpectralPairsToSpectrum { public: // LineSpectralPairsToSpectrum(int num_input_order, int num_output_order); // virtual ~LineSpectralPairsToSpectrum() { } // int GetNumInputOrder() const { return num_input_order_; } // int GetNumOutputOrder() const { return num_output_order_; } // bool IsValid() const { return is_valid_; } // Assume that the first element of line_spectral_pairs is linear gain and // the other elements are in normalized frequency (0...pi). bool Run(const std::vector<double>& line_spectral_pairs, std::vector<double>* spectrum) const; private: // const int num_input_order_; // const int num_output_order_; // bool is_valid_; // DISALLOW_COPY_AND_ASSIGN(LineSpectralPairsToSpectrum); }; } // namespace sptk #endif // SPTK_SRC_LINE_SPECTRAL_PAIRS_TO_SPECTRUM_H_ Index: line_spectral_pairs_to_linear_predictive_coefficients.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/line_spectral_pairs_to_linear_predictive_coefficients.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** line_spectral_pairs_to_linear_predictive_coefficients.cc 7 Feb 2017 10:00:38 -0000 1.1 --- line_spectral_pairs_to_linear_predictive_coefficients.cc 3 Apr 2017 02:03:06 -0000 1.2 *************** *** 135,142 **** // calculate line spectral pairs filter parameters for (int i(0), j(2); i < num_asymmetric_polynomial_order_; ++i, j += 2) { ! p[i] = -2.0 * std::cos(sptk::kTwoPi * input[j]); } for (int i(0), j(1); i < num_symmetric_polynomial_order_; ++i, j += 2) { ! q[i] = -2.0 * std::cos(sptk::kTwoPi * input[j]); } --- 135,142 ---- // calculate line spectral pairs filter parameters for (int i(0), j(2); i < num_asymmetric_polynomial_order_; ++i, j += 2) { ! p[i] = -2.0 * std::cos(input[j]); } for (int i(0), j(1); i < num_symmetric_polynomial_order_; ++i, j += 2) { ! q[i] = -2.0 * std::cos(input[j]); } |
From: Takenori Y. <tak...@us...> - 2017-03-23 07:04:55
|
Update of /cvsroot/sp-tk/SPTK/src/bin/lsp2sp In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv2443 Modified Files: lsp2sp.c Log Message: fix bugs Index: lsp2sp.c =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/lsp2sp/lsp2sp.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** lsp2sp.c 22 Dec 2016 10:53:07 -0000 1.8 --- lsp2sp.c 23 Mar 2017 07:04:53 -0000 1.9 *************** *** 243,247 **** } ! if (loggain == 0) *lsp = log(*lsp); --- 243,251 ---- } ! if (itype == 3) ! for (i = gain; i < m + gain; i++) ! lsp[i] /= 1000; ! ! if (gain == 1 && loggain == 0) *lsp = log(*lsp); |
From: Takenori Y. <tak...@us...> - 2017-03-17 11:39:19
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv29139 Added Files: int24_t.h merge.cc uint24_t.h Log Message: add merge command --- NEW FILE: uint24_t.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_UINT24_T_H_ #define SPTK_SRC_UINT24_T_H_ #include <cstdint> // uint8_t namespace sptk { class uint24_t { public: uint24_t() { } explicit uint24_t(int initial_value) { *this = initial_value; } ~uint24_t() { } operator int() const { return (value[2] << 16) | (value[1] << 8) | (value[0] << 0); } uint24_t& operator=(const uint24_t& input) { value[0] = input.value[0]; value[1] = input.value[1]; value[2] = input.value[2]; return *this; } uint24_t& operator=(int input) { value[0] = (reinterpret_cast<uint8_t*>(&input))[0]; value[1] = (reinterpret_cast<uint8_t*>(&input))[1]; value[2] = (reinterpret_cast<uint8_t*>(&input))[2]; return *this; } uint24_t operator-() const { return uint24_t(-static_cast<int>(*this)); } uint24_t operator+(const uint24_t& input) const { return uint24_t(static_cast<int>(*this) + static_cast<int>(input)); } uint24_t operator-(const uint24_t& input) const { return uint24_t(static_cast<int>(*this) - static_cast<int>(input)); } uint24_t operator*(const uint24_t& input) const { return uint24_t(static_cast<int>(*this) * static_cast<int>(input)); } uint24_t operator/(const uint24_t& input) const { return uint24_t(static_cast<int>(*this) / static_cast<int>(input)); } uint24_t operator+(int input) const { return uint24_t(static_cast<int>(*this) + input); } uint24_t operator-(int input) const { return uint24_t(static_cast<int>(*this) - input); } uint24_t operator*(int input) const { return uint24_t(static_cast<int>(*this) * input); } uint24_t operator/(int input) const { return uint24_t(static_cast<int>(*this) / input); } uint24_t& operator+=(const uint24_t& input) { *this = *this + input; return *this; } uint24_t& operator-=(const uint24_t& input) { *this = *this - input; return *this; } uint24_t& operator*=(const uint24_t& input) { *this = *this * input; return *this; } uint24_t& operator/=(const uint24_t& input) { *this = *this / input; return *this; } uint24_t& operator+=(int input) { *this = *this + input; return *this; } uint24_t& operator-=(int input) { *this = *this - input; return *this; } uint24_t& operator*=(int input) { *this = *this * input; return *this; } uint24_t& operator/=(int input) { *this = *this / input; return *this; } protected: uint8_t value[3]; }; } // namespace sptk #endif // SPTK_SRC_UINT24_T_H_ --- NEW FILE: merge.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 <cstdint> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <sstream> #include <unordered_map> #include <vector> #include "int24_t.h" #include "sptk_utils.h" #include "uint24_t.h" namespace { const int kDefaultInsertPoint(0); const int kDefaultFrameLengthOfInputData(25); const int kDefaultFrameLengthOfInsertData(10); const bool kDefaultOverwriteMode(false); const char* kDefaultDataType("d"); void PrintDataType(const std::string& symbol, const std::string& type, std::ostream* stream) { std::unordered_map<std::string, std::size_t> size({ {"c", sizeof(int8_t)}, {"s", sizeof(int16_t)}, {"i3", sizeof(sptk::int24_t)}, {"i", sizeof(int32_t)}, {"l", sizeof(int64_t)}, {"C", sizeof(uint8_t)}, {"S", sizeof(uint16_t)}, {"I3", sizeof(sptk::uint24_t)}, {"I", sizeof(uint32_t)}, {"L", sizeof(uint64_t)}, {"f", sizeof(float)}, {"d", sizeof(double)}, {"de", sizeof(long double)}, }); std::ostringstream oss; oss << std::setw(3) << std::left << symbol; oss << "(" << type << ", " << size[symbol] << "byte)"; *stream << std::setw(27) << std::left << oss.str(); } void PrintUsage(std::ostream* stream) { // clang-format off *stream << std::endl; *stream << " merge - data merge" << std::endl; *stream << std::endl; *stream << " usage:" << std::endl; *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 *stream << " "; PrintDataType("i3", "int", stream); PrintDataType("I3", "unsigned int", stream); *stream << std::endl; // NOLINT *stream << " "; PrintDataType("i", "int", stream); PrintDataType("I", "unsigned int", stream); *stream << std::endl; // NOLINT *stream << " "; PrintDataType("l", "long", stream); PrintDataType("L", "unsigned long", stream); *stream << std::endl; // NOLINT *stream << " "; PrintDataType("f", "float", stream); PrintDataType("d", "double", stream); *stream << std::endl; // NOLINT *stream << " "; PrintDataType("de", "long double", stream); *stream << std::endl; // NOLINT *stream << " -h : print this message" << std::endl; *stream << " file1:" << std::endl; *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; *stream << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; *stream << std::endl; // clang-format on } class VectorMergeInterface { public: virtual ~VectorMergeInterface() { } virtual bool Run() = 0; }; template <typename T> class VectorMerge : public VectorMergeInterface { public: VectorMerge(int insert_point, int input_length, int insert_length, bool overwrite_mode, std::istream* input_stream, std::istream* insert_stream) : insert_point_(insert_point), input_length_(input_length), insert_length_(insert_length), merged_length_(overwrite_mode ? input_length : input_length + insert_length), input_rest_length_(merged_length_ - insert_point - insert_length), input_skip_length_(overwrite_mode ? insert_length : 0), input_stream_(input_stream), insert_stream_(insert_stream), merged_vector_(merged_length_) { } ~VectorMerge() { } virtual bool Run() { for (;;) { if (0 < insert_point_) { if (!sptk::ReadStream(false, 0, 0, insert_point_, &merged_vector_, input_stream_)) { break; } } if (!sptk::ReadStream(false, 0, insert_point_, insert_length_, &merged_vector_, insert_stream_)) { break; } if (0 < input_rest_length_) { if (!sptk::ReadStream( false, input_skip_length_, insert_point_ + insert_length_, input_rest_length_, &merged_vector_, input_stream_)) { break; } } if (!sptk::WriteStream(0, merged_length_, merged_vector_, &std::cout)) { return false; } } return (input_stream_->peek() == std::istream::traits_type::eof() && insert_stream_->peek() == std::istream::traits_type::eof()); } private: const int insert_point_; const int input_length_; const int insert_length_; const int merged_length_; const int input_rest_length_; const int input_skip_length_; std::istream* input_stream_; std::istream* insert_stream_; std::vector<T> merged_vector_; DISALLOW_COPY_AND_ASSIGN(VectorMerge<T>); }; template class VectorMerge<int8_t>; template class VectorMerge<int16_t>; template class VectorMerge<sptk::int24_t>; template class VectorMerge<int32_t>; template class VectorMerge<int64_t>; template class VectorMerge<uint8_t>; template class VectorMerge<uint16_t>; template class VectorMerge<sptk::uint24_t>; template class VectorMerge<uint32_t>; template class VectorMerge<uint64_t>; template class VectorMerge<float>; template class VectorMerge<double>; template class VectorMerge<long double>; class VectorMergeWrapper { public: VectorMergeWrapper(const std::string& data_type, int insert_point, int input_length, int insert_length, bool overwrite_mode, std::istream* input_stream, std::istream* insert_stream) : merge_(NULL) { if ("c" == data_type) { merge_ = new VectorMerge<int8_t>(insert_point, input_length, insert_length, overwrite_mode, input_stream, insert_stream); } else if ("s" == data_type) { merge_ = new VectorMerge<int16_t>(insert_point, input_length, insert_length, overwrite_mode, input_stream, insert_stream); } else if ("i3" == data_type) { merge_ = new VectorMerge<sptk::int24_t>(insert_point, input_length, insert_length, overwrite_mode, input_stream, insert_stream); } else if ("i" == data_type) { merge_ = new VectorMerge<int32_t>(insert_point, input_length, insert_length, overwrite_mode, input_stream, insert_stream); } else if ("l" == data_type) { merge_ = new VectorMerge<int64_t>(insert_point, input_length, insert_length, overwrite_mode, input_stream, insert_stream); } else if ("C" == data_type) { merge_ = new VectorMerge<uint8_t>(insert_point, input_length, insert_length, overwrite_mode, input_stream, insert_stream); } else if ("S" == data_type) { merge_ = new VectorMerge<uint16_t>(insert_point, input_length, insert_length, overwrite_mode, input_stream, insert_stream); } else if ("I3" == data_type) { merge_ = new VectorMerge<sptk::uint24_t>(insert_point, input_length, insert_length, overwrite_mode, input_stream, insert_stream); } else if ("I" == data_type) { merge_ = new VectorMerge<uint32_t>(insert_point, input_length, insert_length, overwrite_mode, input_stream, insert_stream); } else if ("L" == data_type) { merge_ = new VectorMerge<uint64_t>(insert_point, input_length, insert_length, overwrite_mode, input_stream, insert_stream); } else if ("f" == data_type) { merge_ = new VectorMerge<float>(insert_point, input_length, insert_length, overwrite_mode, input_stream, insert_stream); } else if ("d" == data_type) { merge_ = new VectorMerge<double>(insert_point, input_length, insert_length, overwrite_mode, input_stream, insert_stream); } else if ("de" == data_type) { merge_ = new VectorMerge<long double>(insert_point, input_length, insert_length, overwrite_mode, input_stream, insert_stream); } } ~VectorMergeWrapper() { delete merge_; } bool IsValid() const { return NULL != merge_; } bool Run() const { return IsValid() && merge_->Run(); } private: VectorMergeInterface* merge_; DISALLOW_COPY_AND_ASSIGN(VectorMergeWrapper); }; } // namespace int main(int argc, char* argv[]) { int insert_point(kDefaultInsertPoint); int input_length(kDefaultFrameLengthOfInputData); int insert_length(kDefaultFrameLengthOfInsertData); bool overwrite_mode(kDefaultOverwriteMode); std::string data_type(kDefaultDataType); for (;;) { const int option_char(getopt_long(argc, argv, "s:l:n:L:N:wh", NULL, NULL)); if (-1 == option_char) break; switch (option_char) { case 's': { if (!sptk::ConvertStringToInteger(optarg, &insert_point) || insert_point < 0) { std::ostringstream error_message; error_message << "The argument for the -s option must be a " << "non-negative integer"; sptk::PrintErrorMessage("merge", error_message); return 1; } break; } case 'l': { if (!sptk::ConvertStringToInteger(optarg, &input_length) || input_length <= 0) { std::ostringstream error_message; error_message << "The argument for the -l option must be a positive integer"; sptk::PrintErrorMessage("merge", error_message); return 1; } break; } case 'n': { if (!sptk::ConvertStringToInteger(optarg, &input_length) || input_length < 0) { std::ostringstream error_message; error_message << "The argument for the -n option must be a " << "non-negative integer"; sptk::PrintErrorMessage("merge", error_message); return 1; } ++input_length; break; } case 'L': { if (!sptk::ConvertStringToInteger(optarg, &insert_length) || insert_length <= 0) { std::ostringstream error_message; error_message << "The argument for the -L option must be a positive integer"; sptk::PrintErrorMessage("merge", error_message); return 1; } break; } case 'N': { if (!sptk::ConvertStringToInteger(optarg, &insert_length) || insert_length < 0) { std::ostringstream error_message; error_message << "The argument for the -N option must be a " << "non-negative integer"; sptk::PrintErrorMessage("merge", error_message); return 1; } ++insert_length; break; } case 'w': { overwrite_mode = true; break; } case 'h': { PrintUsage(&std::cout); return 0; } default: { PrintUsage(&std::cerr); return 1; } } } if (input_length < insert_point) { std::ostringstream error_message; error_message << "Insert point must not be greater than input length"; sptk::PrintErrorMessage("merge", error_message); return 1; } if (overwrite_mode && input_length < insert_point + insert_length) { std::ostringstream error_message; error_message << "The arguments must satisfy s + L <= l in overwrite mode"; sptk::PrintErrorMessage("merge", error_message); return 1; } // get input files const char* insert_file(NULL); const char* input_file(NULL); for (int i(argc - optind); 1 <= i; --i) { const char* arg = argv[argc - i]; if (0 == std::strncmp(arg, "+", 1)) { const std::string str(arg); data_type = str.substr(1, std::string::npos); } else if (NULL == insert_file) { insert_file = arg; } else if (NULL == input_file) { input_file = arg; } else { std::ostringstream error_message; error_message << "Just two input files, file1 and infile, are required"; sptk::PrintErrorMessage("merge", error_message); return 1; } } if (NULL == insert_file || NULL == input_file) { std::ostringstream error_message; error_message << "Two input files, file1 and infile, are required"; sptk::PrintErrorMessage("merge", error_message); return 1; } // open stream for reading insert data std::ifstream ifs1; ifs1.open(insert_file, std::ios::in | std::ios::binary); if (ifs1.fail()) { std::ostringstream error_message; error_message << "Cannot open file " << insert_file; sptk::PrintErrorMessage("merge", error_message); return 1; } std::istream& insert_stream(ifs1); // open stream for reading input data std::ifstream ifs2; ifs2.open(input_file, std::ios::in | std::ios::binary); if (ifs2.fail() && NULL != input_file) { std::ostringstream error_message; error_message << "Cannot open file " << input_file; sptk::PrintErrorMessage("merge", error_message); return 1; } std::istream& input_stream(ifs2.fail() ? std::cin : ifs2); VectorMergeWrapper merge(data_type, insert_point, input_length, insert_length, overwrite_mode, &input_stream, &insert_stream); if (!merge.IsValid()) { std::ostringstream error_message; error_message << "Unexpected argument for the +type option"; sptk::PrintErrorMessage("merge", error_message); return 1; } if (!merge.Run()) { std::ostringstream error_message; error_message << "Failed to merge"; sptk::PrintErrorMessage("merge", error_message); return 1; } return 0; } --- NEW FILE: int24_t.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_INT24_T_H_ #define SPTK_SRC_INT24_T_H_ #include <cstdint> // uint8_t namespace sptk { class int24_t { public: int24_t() { } explicit int24_t(int initial_value) { *this = initial_value; } ~int24_t() { } operator int() const { if (value[2] & 0x80) { return (0xff << 24) | (value[2] << 16) | (value[1] << 8) | (value[0] << 0); } return (value[2] << 16) | (value[1] << 8) | (value[0] << 0); } int24_t& operator=(const int24_t& input) { value[0] = input.value[0]; value[1] = input.value[1]; value[2] = input.value[2]; return *this; } int24_t& operator=(int input) { value[0] = (reinterpret_cast<uint8_t*>(&input))[0]; value[1] = (reinterpret_cast<uint8_t*>(&input))[1]; value[2] = (reinterpret_cast<uint8_t*>(&input))[2]; return *this; } int24_t operator-() const { return int24_t(-static_cast<int>(*this)); } int24_t operator+(const int24_t& input) const { return int24_t(static_cast<int>(*this) + static_cast<int>(input)); } int24_t operator-(const int24_t& input) const { return int24_t(static_cast<int>(*this) - static_cast<int>(input)); } int24_t operator*(const int24_t& input) const { return int24_t(static_cast<int>(*this) * static_cast<int>(input)); } int24_t operator/(const int24_t& input) const { return int24_t(static_cast<int>(*this) / static_cast<int>(input)); } int24_t operator+(int input) const { return int24_t(static_cast<int>(*this) + input); } int24_t operator-(int input) const { return int24_t(static_cast<int>(*this) - input); } int24_t operator*(int input) const { return int24_t(static_cast<int>(*this) * input); } int24_t operator/(int input) const { return int24_t(static_cast<int>(*this) / input); } int24_t& operator+=(const int24_t& input) { *this = *this + input; return *this; } int24_t& operator-=(const int24_t& input) { *this = *this - input; return *this; } int24_t& operator*=(const int24_t& input) { *this = *this * input; return *this; } int24_t& operator/=(const int24_t& input) { *this = *this / input; return *this; } int24_t& operator+=(int input) { *this = *this + input; return *this; } int24_t& operator-=(int input) { *this = *this - input; return *this; } int24_t& operator*=(int input) { *this = *this * input; return *this; } int24_t& operator/=(int input) { *this = *this / input; return *this; } protected: uint8_t value[3]; }; } // namespace sptk #endif // SPTK_SRC_INT24_T_H_ |
From: Takenori Y. <tak...@us...> - 2017-03-15 13:42:46
|
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv6995 Added Files: lsp2lpc.cc Log Message: add lsp2lpc command --- NEW FILE: lsp2lpc.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 <algorithm> #include <cmath> #include <fstream> #include <functional> #include <iostream> #include <sstream> #include <vector> #include "line_spectral_pairs_to_linear_predictive_coefficients.h" #include "sptk_utils.h" namespace { enum InputGainTypes { kLinearGain = 0, kLogGain, kWithoutGain, kNumInputGainTypes }; enum InputFormats { kNormalizedFrequencyInRadians = 0, kNormalizedFrequencyInCycles, kFrequecnyInkHz, kFrequecnyInHz, kNumInputFormats }; const int kDefaultNumOrder(25); const double kDefaultSamplingFrequency(10.0); const InputGainTypes kDefaultInputGainType(kLinearGain); const InputFormats kDefaultInputFormat(kNormalizedFrequencyInRadians); void PrintUsage(std::ostream* stream) { // clang-format off *stream << std::endl; *stream << " lsp2lpc - transform line spectral pairs to " << std::endl; *stream << " linear predictive coefficients" << std::endl; *stream << std::endl; *stream << " usage:" << std::endl; *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)" << 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 << " -h : print this message" << std::endl; *stream << " infile:" << std::endl; *stream << " line spectral pairs (double) [stdin]" << std::endl; // NOLINT *stream << " stdout:" << std::endl; *stream << " linear predictive coefficients (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 << std::endl; *stream << " SPTK: version " << sptk::kVersion << std::endl; *stream << std::endl; // clang-format on } } // namespace int main(int argc, char* argv[]) { int num_order(kDefaultNumOrder); double sampling_frequency(kDefaultSamplingFrequency); InputGainTypes input_gain_type(kDefaultInputGainType); InputFormats input_format(kDefaultInputFormat); for (;;) { const int option_char(getopt_long(argc, argv, "m:s:k:q: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("lsp2lpc", error_message); return 1; } break; } case 's': { if (!sptk::ConvertStringToDouble(optarg, &sampling_frequency) || sampling_frequency <= 0.0) { std::ostringstream error_message; error_message << "The argument for the -s option must be a positive number"; sptk::PrintErrorMessage("lsp2lpc", error_message); return 1; } break; } case 'k': { const int min(0); const int max(static_cast<int>(kNumInputGainTypes) - 1); int tmp; if (!sptk::ConvertStringToInteger(optarg, &tmp) || !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; error_message << "The argument for the -k option must be an integer " << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("lsp2lpc", error_message); return 1; } input_gain_type = static_cast<InputGainTypes>(tmp); break; } case 'q': { const int min(0); const int max(static_cast<int>(kNumInputFormats) - 1); int tmp; if (!sptk::ConvertStringToInteger(optarg, &tmp) || !sptk::IsInRange(tmp, min, max)) { std::ostringstream error_message; error_message << "The argument for the -q option must be an integer " << "in the range of " << min << " to " << max; sptk::PrintErrorMessage("lsp2lpc", error_message); return 1; } input_format = static_cast<InputFormats>(tmp); break; } case 'h': { PrintUsage(&std::cout); return 0; } default: { PrintUsage(&std::cerr); return 1; } } } // get input file const char* input_file((optind < argc) ? argv[argc - 1] : NULL); // open stream std::ifstream ifs; ifs.open(input_file, std::ios::in | std::ios::binary); if (ifs.fail() && NULL != input_file) { std::ostringstream error_message; error_message << "Cannot open file " << input_file; sptk::PrintErrorMessage("lsp2lpc", error_message); return 1; } std::istream& input_stream(ifs.fail() ? std::cin : ifs); // prepare to transform sptk::LineSpectralPairsToLinearPredictiveCoefficients line_spectral_pairs_to_linear_predictive_coefficients(num_order); sptk::LineSpectralPairsToLinearPredictiveCoefficients::Buffer buffer; if (!line_spectral_pairs_to_linear_predictive_coefficients.IsValid()) { std::ostringstream error_message; error_message << "Failed to set condition for transformation"; sptk::PrintErrorMessage("lsp2lpc", error_message); return 1; } const int length(num_order + 1); const int read_size(kWithoutGain == input_gain_type ? num_order : length); const int read_point(kWithoutGain == input_gain_type ? 1 : 0); std::vector<double> line_spectral_pairs(length); std::vector<double> linear_predictive_coefficients(length); while (sptk::ReadStream(false, 0, read_point, read_size, &line_spectral_pairs, &input_stream)) { switch (input_gain_type) { case kLinearGain: { // nothing to do break; } case kLogGain: { line_spectral_pairs[0] = std::exp(line_spectral_pairs[0]); break; } case kWithoutGain: { line_spectral_pairs[0] = 1.0; break; } default: { break; } } switch (input_format) { case kNormalizedFrequencyInRadians: { std::transform( line_spectral_pairs.begin() + 1, line_spectral_pairs.end(), line_spectral_pairs.begin() + 1, std::bind1st(std::multiplies<double>(), 1.0 / sptk::kTwoPi)); break; } case kNormalizedFrequencyInCycles: { // nothing to do break; } case kFrequecnyInkHz: { std::transform( line_spectral_pairs.begin() + 1, line_spectral_pairs.end(), line_spectral_pairs.begin() + 1, std::bind1st(std::multiplies<double>(), 1.0 / sampling_frequency)); break; } case kFrequecnyInHz: { std::transform(line_spectral_pairs.begin() + 1, line_spectral_pairs.end(), line_spectral_pairs.begin() + 1, std::bind1st(std::multiplies<double>(), 0.001 / sampling_frequency)); break; } default: { break; } } if (!line_spectral_pairs_to_linear_predictive_coefficients.Run( line_spectral_pairs, &linear_predictive_coefficients, &buffer)) { std::ostringstream error_message; error_message << "Failed to transform line spectral pairs to " << "linear predictive coefficients"; sptk::PrintErrorMessage("lsp2lpc", error_message); return 1; } if (!sptk::WriteStream(0, length, linear_predictive_coefficients, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write linear predictive coefficients"; sptk::PrintErrorMessage("lsp2lpc", error_message); return 1; } } return 0; } |
Update of /cvsroot/sp-tk/SPTK4/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv5659 Modified Files: acorr.cc c2mpir.cc excite.cc fft.cc fftr.cc freqt.cc gnorm.cc ifft.cc ignorm.cc input_source_from_stream.cc levdur.cc levinson_durbin_recursion.cc levinson_durbin_recursion.h lpc.cc lpc2c.cc lpc2lsp.cc lpc2par.cc ltcdf.cc mgc2mgc.cc mgc2sp.cc mseq.cc nan.cc nrand.cc poledf.cc sptk_utils.cc sptk_utils.h zerodf.cc Log Message: use getopt_long instead of getopt Index: mgc2mgc.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mgc2mgc.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mgc2mgc.cc 23 Jan 2017 00:41:23 -0000 1.4 --- mgc2mgc.cc 15 Mar 2017 13:38:04 -0000 1.5 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 43,47 **** // ----------------------------------------------------------------- // ! #include <unistd.h> #include <fstream> #include <iostream> --- 43,47 ---- // ----------------------------------------------------------------- // ! #include <getopt.h> #include <fstream> #include <iostream> *************** *** 116,120 **** for (;;) { ! const char option_char(getopt(argc, argv, "m:a:g:c:nuM:A:G:C:NUh")); if (-1 == option_char) break; --- 116,121 ---- for (;;) { ! const int option_char( ! getopt_long(argc, argv, "m:a:g:c:nuM:A:G:C:NUh", NULL, NULL)); if (-1 == option_char) break; *************** *** 261,265 **** std::vector<double> transformed_generalized_cepstrum(output_length); ! while (sptk::ReadStream(false, input_length, &generalized_cepstrum, &input_stream)) { // input modification: 1+g*mgc[0] -> mgc[0] --- 262,266 ---- std::vector<double> transformed_generalized_cepstrum(output_length); ! while (sptk::ReadStream(false, 0, 0, input_length, &generalized_cepstrum, &input_stream)) { // input modification: 1+g*mgc[0] -> mgc[0] *************** *** 271,275 **** generalized_cepstrum, &transformed_generalized_cepstrum, &buffer)) { std::ostringstream error_message; ! error_message << "Failed to run the transform"; sptk::PrintErrorMessage("mgc2mgc", error_message); return 1; --- 272,276 ---- generalized_cepstrum, &transformed_generalized_cepstrum, &buffer)) { std::ostringstream error_message; ! error_message << "Failed to run generalized cepstral transformation"; sptk::PrintErrorMessage("mgc2mgc", error_message); return 1; *************** *** 280,287 **** *(transformed_generalized_cepstrum.begin()) * output_gamma + 1.0; // write results ! if (!sptk::WriteStream(output_length, transformed_generalized_cepstrum, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write an output sequence"; sptk::PrintErrorMessage("mgc2mgc", error_message); return 1; --- 281,288 ---- *(transformed_generalized_cepstrum.begin()) * output_gamma + 1.0; // write results ! if (!sptk::WriteStream(0, output_length, transformed_generalized_cepstrum, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write generalized cepstrum"; sptk::PrintErrorMessage("mgc2mgc", error_message); return 1; Index: lpc2par.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/lpc2par.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lpc2par.cc 2 Feb 2017 05:25:50 -0000 1.2 --- lpc2par.cc 15 Mar 2017 13:38:04 -0000 1.3 *************** *** 43,47 **** // ----------------------------------------------------------------- // ! #include <unistd.h> #include <fstream> #include <iostream> --- 43,47 ---- // ----------------------------------------------------------------- // ! #include <getopt.h> #include <fstream> #include <iostream> *************** *** 63,67 **** const int kDefaultNumOrder(25); const double kDefaultGamma(1.0); ! const int kDefaultBehaviorForUnstableCoefficient(kIgnore); void PrintUsage(std::ostream* stream) { --- 63,68 ---- const int kDefaultNumOrder(25); const double kDefaultGamma(1.0); ! const BehaviorForUnstableCoefficients kDefaultBehaviorForUnstableCoefficients( ! kIgnore); void PrintUsage(std::ostream* stream) { *************** *** 76,80 **** *stream << " -g g : gamma of generalized cepstrum [" << kDefaultGamma << "]" << std::endl; // NOLINT *stream << " -c c : gamma of generalized cepstrum = -1 / (int) c" << std::endl; // NOLINT ! *stream << " -e e : check whether the derived PARCOR [" << kDefaultBehaviorForUnstableCoefficient << "]" << std::endl; // NOLINT *stream << " coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; --- 77,81 ---- *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; *************** *** 103,111 **** double gamma(kDefaultGamma); BehaviorForUnstableCoefficients behavior( ! static_cast<BehaviorForUnstableCoefficients>( ! kDefaultBehaviorForUnstableCoefficient)); for (;;) { ! const char option_char(getopt(argc, argv, "m:g:c:e:h")); if (-1 == option_char) break; --- 104,111 ---- double gamma(kDefaultGamma); BehaviorForUnstableCoefficients behavior( ! kDefaultBehaviorForUnstableCoefficients); for (;;) { ! const int option_char(getopt_long(argc, argv, "m:g:c:e:h", NULL, NULL)); if (-1 == option_char) break; *************** *** 198,202 **** for (int frame_index(0); sptk::ReadStream( ! false, length, &linear_predictive_coefficients, &input_stream); ++frame_index) { bool is_stable(false); --- 198,202 ---- for (int frame_index(0); sptk::ReadStream( ! false, 0, 0, length, &linear_predictive_coefficients, &input_stream); ++frame_index) { bool is_stable(false); *************** *** 218,222 **** } ! if (!sptk::WriteStream(length, parcor_coefficients, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write PARCOR coefficients"; --- 218,222 ---- } ! if (!sptk::WriteStream(0, length, parcor_coefficients, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write PARCOR coefficients"; Index: sptk_utils.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/sptk_utils.cc,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** sptk_utils.cc 26 Jan 2017 10:33:54 -0000 1.13 --- sptk_utils.cc 15 Mar 2017 13:38:04 -0000 1.14 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 45,61 **** #include "sptk_utils.h" ! #include <algorithm> // std::fill #include <cerrno> // errno, ERANGE #include <cmath> // std::ceil #include <cstdlib> // std::size_t, std::strtol. std::strtod ! namespace sptk { ! bool ReadStream(double* read_data, std::istream* input_stream) { ! if (NULL == read_data || NULL == input_stream) { ! return false; ! } ! if (input_stream->eof()) { return false; } --- 45,62 ---- #include "sptk_utils.h" ! #include <algorithm> // std::fill_n #include <cerrno> // errno, ERANGE #include <cmath> // std::ceil + #include <cstdint> // int8_t, etc. #include <cstdlib> // std::size_t, std::strtol. std::strtod ! #include "int24_t.h" ! #include "uint24_t.h" ! namespace sptk { ! template <typename T> ! bool ReadStream(T* read_data, std::istream* input_stream) { ! if (NULL == read_data || NULL == input_stream || input_stream->eof()) { return false; } *************** *** 67,92 **** } ! bool ReadStream(bool zero_padding, int read_size, ! std::vector<double>* sequence_to_read, std::istream* input_stream) { ! if (read_size <= 0 || NULL == sequence_to_read || NULL == input_stream) { return false; } ! if (input_stream->eof()) { ! return false; } ! if (sequence_to_read->size() < static_cast<std::size_t>(read_size)) { ! sequence_to_read->resize(read_size); } ! const int type_byte(sizeof((*sequence_to_read)[0])); ! const int num_bytes(type_byte * read_size); ! input_stream->read(reinterpret_cast<char*>(&((*sequence_to_read)[0])), ! num_bytes); const int gcount(input_stream->gcount()); ! if (num_bytes == gcount) { return !input_stream->fail(); } else if (zero_padding && 0 < gcount) { --- 68,99 ---- } ! template <typename T> ! bool ReadStream(bool zero_padding, int stream_skip, int read_point, ! int read_size, std::vector<T>* sequence_to_read, std::istream* input_stream) { ! if (stream_skip < 0 || read_point < 0 || read_size <= 0 || ! NULL == sequence_to_read || NULL == input_stream || input_stream->eof()) { return false; } ! const int type_byte(sizeof((*sequence_to_read)[0])); ! ! if (0 < stream_skip) { ! input_stream->ignore(type_byte * stream_skip); ! if (input_stream->eof()) return false; } ! const int end(read_point + read_size); ! if (sequence_to_read->size() < static_cast<std::size_t>(end)) { ! sequence_to_read->resize(end); } ! const int num_read_bytes(type_byte * read_size); ! input_stream->read( ! reinterpret_cast<char*>(&((*sequence_to_read)[0]) + read_point), ! num_read_bytes); const int gcount(input_stream->gcount()); ! if (num_read_bytes == gcount) { return !input_stream->fail(); } else if (zero_padding && 0 < gcount) { *************** *** 94,104 **** // as gcount may not be a multiple of sizeof(double). const int num_zeros( ! std::ceil(static_cast<double>(num_bytes - gcount) / type_byte)); if (num_zeros < 0) { return false; // Something wrong! } ! std::fill(sequence_to_read->end() - num_zeros, sequence_to_read->end(), ! 0.0); return !input_stream->bad(); --- 101,110 ---- // as gcount may not be a multiple of sizeof(double). const int num_zeros( ! std::ceil(static_cast<double>(num_read_bytes - gcount) / type_byte)); if (num_zeros < 0) { return false; // Something wrong! } ! std::fill_n(sequence_to_read->begin() + end - num_zeros, num_zeros, 0.0); return !input_stream->bad(); *************** *** 108,112 **** } ! bool WriteStream(double data_to_write, std::ostream* output_stream) { if (NULL == output_stream) { return false; --- 114,119 ---- } ! template <typename T> ! bool WriteStream(T data_to_write, std::ostream* output_stream) { if (NULL == output_stream) { return false; *************** *** 119,134 **** } ! bool WriteStream(int write_size, const std::vector<double>& sequence_to_write, ! std::ostream* output_stream) { ! return WriteStream(0, write_size, sequence_to_write, output_stream); ! } ! ! bool WriteStream(int begin, int end, ! const std::vector<double>& sequence_to_write, std::ostream* output_stream) { ! if (begin < 0 || end <= begin || NULL == output_stream) { return false; } if (sequence_to_write.size() < static_cast<std::size_t>(end)) { return false; --- 126,138 ---- } ! template <typename T> ! bool WriteStream(int write_point, int write_size, ! const std::vector<T>& sequence_to_write, std::ostream* output_stream) { ! if (write_point < 0 || write_size <= 0 || NULL == output_stream) { return false; } + const int end(write_point + write_size); if (sequence_to_write.size() < static_cast<std::size_t>(end)) { return false; *************** *** 136,141 **** output_stream->write( ! reinterpret_cast<const char*>(&(sequence_to_write[0]) + begin), ! sizeof(sequence_to_write[0]) * (end - begin)); return !output_stream->fail(); --- 140,145 ---- output_stream->write( ! reinterpret_cast<const char*>(&(sequence_to_write[0]) + write_point), ! sizeof(sequence_to_write[0]) * write_size); return !output_stream->fail(); *************** *** 147,151 **** bool ConvertStringToInteger(const std::string& input, int* output) { ! if (NULL == output) { return false; } --- 151,155 ---- bool ConvertStringToInteger(const std::string& input, int* output) { ! if (input.empty() || NULL == output) { return false; } *************** *** 163,167 **** bool ConvertStringToDouble(const std::string& input, double* output) { ! if (NULL == output) { return false; } --- 167,171 ---- bool ConvertStringToDouble(const std::string& input, double* output) { ! if (input.empty() || NULL == output) { return false; } *************** *** 182,187 **** } ! // check whether a number is a power of two, 2^p where p is a non-negative ! // integer. bool IsPowerOfTwo(int num) { return !((num < 1) || (num & (num - 1))); --- 186,191 ---- } ! // check whether the given number is a power of two, 2^p where p is a ! // non-negative integer. bool IsPowerOfTwo(int num) { return !((num < 1) || (num & (num - 1))); *************** *** 191,197 **** const std::ostringstream& message) { std::ostringstream stream; ! stream << program_name << " : " << message.str() << "!" << std::endl; std::cerr << stream.str(); } } // namespace sptk --- 195,232 ---- const std::ostringstream& message) { std::ostringstream stream; ! stream << program_name << ": " << message.str() << "!" << std::endl; std::cerr << stream.str(); } + // clang-format off + template bool ReadStream<double>(double*, std::istream*); + template bool ReadStream<int8_t>(bool, int, int, int, std::vector<int8_t>*, std::istream*); // NOLINT + template bool ReadStream<int16_t>(bool, int, int, int, std::vector<int16_t>*, std::istream*); // NOLINT + template bool ReadStream<sptk::int24_t>(bool, int, int, int, std::vector<sptk::int24_t>*, std::istream*); // NOLINT + template bool ReadStream<int32_t>(bool, int, int, int, std::vector<int32_t>*, std::istream*); // NOLINT + template bool ReadStream<int64_t>(bool, int, int, int, std::vector<int64_t>*, std::istream*); // NOLINT + template bool ReadStream<uint8_t>(bool, int, int, int, std::vector<uint8_t>*, std::istream*); // NOLINT + template bool ReadStream<uint16_t>(bool, int, int, int, std::vector<uint16_t>*, std::istream*); // NOLINT + template bool ReadStream<sptk::uint24_t>(bool, int, int, int, std::vector<sptk::uint24_t>*, std::istream*); // NOLINT + template bool ReadStream<uint32_t>(bool, int, int, int, std::vector<uint32_t>*, std::istream*); // NOLINT + template bool ReadStream<uint64_t>(bool, int, int, int, std::vector<uint64_t>*, std::istream*); // NOLINT + template bool ReadStream<float>(bool, int, int, int, std::vector<float>*, std::istream*); // NOLINT + template bool ReadStream<double>(bool, int, int, int, std::vector<double>*, std::istream*); // NOLINT + template bool ReadStream<long double>(bool, int, int, int, std::vector<long double>*, std::istream*); // NOLINT + template bool WriteStream<double>(double, std::ostream*); + template bool WriteStream<int8_t>(int, int, const std::vector<int8_t>&, std::ostream*); // NOLINT + template bool WriteStream<int16_t>(int, int, const std::vector<int16_t>&, std::ostream*); // NOLINT + template bool WriteStream<sptk::int24_t>(int, int, const std::vector<sptk::int24_t>&, std::ostream*); // NOLINT + template bool WriteStream<int32_t>(int, int, const std::vector<int32_t>&, std::ostream*); // NOLINT + template bool WriteStream<int64_t>(int, int, const std::vector<int64_t>&, std::ostream*); // NOLINT + template bool WriteStream<uint8_t>(int, int, const std::vector<uint8_t>&, std::ostream*); // NOLINT + template bool WriteStream<uint16_t>(int, int, const std::vector<uint16_t>&, std::ostream*); // NOLINT + template bool WriteStream<sptk::uint24_t>(int, int, const std::vector<sptk::uint24_t>&, std::ostream*); // NOLINT + template bool WriteStream<uint32_t>(int, int, const std::vector<uint32_t>&, std::ostream*); // NOLINT + template bool WriteStream<uint64_t>(int, int, const std::vector<uint64_t>&, std::ostream*); // NOLINT + template bool WriteStream<float>(int, int, const std::vector<float>&, std::ostream*); // NOLINT + template bool WriteStream<double>(int, int, const std::vector<double>&, std::ostream*); // NOLINT + template bool WriteStream<long double>(int, int, const std::vector<long double>&, std::ostream*); // NOLINT + // clang-format on + } // namespace sptk Index: nrand.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/nrand.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** nrand.cc 12 Oct 2016 12:14:38 -0000 1.4 --- nrand.cc 15 Mar 2017 13:38:04 -0000 1.5 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 43,47 **** // ----------------------------------------------------------------- // ! #include <unistd.h> #include <cmath> // std::sqrt #include <iostream> --- 43,47 ---- // ----------------------------------------------------------------- // ! #include <getopt.h> #include <cmath> // std::sqrt #include <iostream> *************** *** 91,95 **** for (;;) { ! const char option_char(getopt(argc, argv, "l:s:m:v:d:h")); if (-1 == option_char) break; --- 91,95 ---- for (;;) { ! const int option_char(getopt_long(argc, argv, "l:s:m:v:d:h", NULL, NULL)); if (-1 == option_char) break; *************** *** 160,164 **** if (!generator.Get(&output)) { std::ostringstream error_message; ! error_message << "Failed to generate M sequence"; sptk::PrintErrorMessage("nrand", error_message); return 1; --- 160,164 ---- if (!generator.Get(&output)) { std::ostringstream error_message; ! error_message << "Failed to generate random values"; sptk::PrintErrorMessage("nrand", error_message); return 1; *************** *** 167,171 **** if (!sptk::WriteStream(output, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write an output sequence"; sptk::PrintErrorMessage("nrand", error_message); return 1; --- 167,171 ---- if (!sptk::WriteStream(output, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write random values"; sptk::PrintErrorMessage("nrand", error_message); return 1; Index: levinson_durbin_recursion.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/levinson_durbin_recursion.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** levinson_durbin_recursion.h 26 Dec 2016 07:41:20 -0000 1.6 --- levinson_durbin_recursion.h 15 Mar 2017 13:38:04 -0000 1.7 *************** *** 89,94 **** // bool Run(const std::vector<double>& autocorrelation_sequence, ! std::vector<double>* linear_predictive_coefficients, ! bool* is_stable, LevinsonDurbinRecursion::Buffer* buffer) const; private: --- 89,94 ---- // bool Run(const std::vector<double>& autocorrelation_sequence, ! std::vector<double>* linear_predictive_coefficients, bool* is_stable, ! LevinsonDurbinRecursion::Buffer* buffer) const; private: Index: acorr.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/acorr.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** acorr.cc 12 Oct 2016 12:14:38 -0000 1.4 --- acorr.cc 15 Mar 2017 13:38:04 -0000 1.5 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 43,47 **** // ----------------------------------------------------------------- // ! #include <unistd.h> #include <fstream> #include <iostream> --- 43,47 ---- // ----------------------------------------------------------------- // ! #include <getopt.h> #include <fstream> #include <iostream> *************** *** 85,89 **** for (;;) { ! const char option_char(getopt(argc, argv, "l:m:h")); if (-1 == option_char) break; --- 85,89 ---- for (;;) { ! const int option_char(getopt_long(argc, argv, "l:m:h", NULL, NULL)); if (-1 == option_char) break; *************** *** 139,143 **** if (!autocorrelation.SetNumOrder(num_order)) { std::ostringstream error_message; ! error_message << "Failed to set the order of autocorrelation sequences"; sptk::PrintErrorMessage("acorr", error_message); return 1; --- 139,143 ---- if (!autocorrelation.SetNumOrder(num_order)) { std::ostringstream error_message; ! error_message << "Failed to set the order of autocorrelation sequence"; sptk::PrintErrorMessage("acorr", error_message); return 1; *************** *** 148,163 **** std::vector<double> output_sequence(output_length); ! while ( ! sptk::ReadStream(false, frame_length, &input_sequence, &input_stream)) { if (!autocorrelation.Run(input_sequence, &output_sequence)) { std::ostringstream error_message; ! error_message << "Failed to obtain an autocorrelation sequence"; sptk::PrintErrorMessage("acorr", error_message); return 1; } ! if (!sptk::WriteStream(output_length, output_sequence, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write an autocorrelation sequence"; sptk::PrintErrorMessage("acorr", error_message); return 1; --- 148,163 ---- std::vector<double> output_sequence(output_length); ! while (sptk::ReadStream(false, 0, 0, frame_length, &input_sequence, ! &input_stream)) { if (!autocorrelation.Run(input_sequence, &output_sequence)) { std::ostringstream error_message; ! error_message << "Failed to obtain autocorrelation sequence"; sptk::PrintErrorMessage("acorr", error_message); return 1; } ! if (!sptk::WriteStream(0, output_length, output_sequence, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write autocorrelation sequence"; sptk::PrintErrorMessage("acorr", error_message); return 1; Index: levdur.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/levdur.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** levdur.cc 2 Feb 2017 05:25:50 -0000 1.8 --- levdur.cc 15 Mar 2017 13:38:04 -0000 1.9 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 43,47 **** // ----------------------------------------------------------------- // ! #include <unistd.h> #include <fstream> #include <iostream> --- 43,47 ---- // ----------------------------------------------------------------- // ! #include <getopt.h> #include <fstream> #include <iostream> *************** *** 63,67 **** const int kDefaultNumOrder(25); const double kDefaultEpsilon(1.0e-6); ! const int kDefaultBehaviorForUnstableCoefficient(kIgnore); void PrintUsage(std::ostream* stream) { --- 63,68 ---- const int kDefaultNumOrder(25); const double kDefaultEpsilon(1.0e-6); ! const BehaviorForUnstableCoefficients kDefaultBehaviorForUnstableCoefficients( ! kIgnore); void PrintUsage(std::ostream* stream) { *************** *** 76,81 **** *stream << " -m m : order of autocorrelation [" << 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 [" << kDefaultBehaviorForUnstableCoefficient << "]" << std::endl; // NOLINT *stream << " predictive coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; --- 77,82 ---- *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; *************** *** 102,110 **** double epsilon(kDefaultEpsilon); BehaviorForUnstableCoefficients behavior( ! static_cast<BehaviorForUnstableCoefficients>( ! kDefaultBehaviorForUnstableCoefficient)); for (;;) { ! const char option_char(getopt(argc, argv, "m:f:e:h")); if (-1 == option_char) break; --- 103,110 ---- double epsilon(kDefaultEpsilon); BehaviorForUnstableCoefficients behavior( ! kDefaultBehaviorForUnstableCoefficients); for (;;) { ! const int option_char(getopt_long(argc, argv, "m:f:e:h", NULL, NULL)); if (-1 == option_char) break; *************** *** 175,179 **** if (!recursion.SetEpsilon(epsilon)) { std::ostringstream error_message; ! error_message << "Failed to set the minimum value of the determinant"; sptk::PrintErrorMessage("levdur", error_message); return 1; --- 175,179 ---- if (!recursion.SetEpsilon(epsilon)) { std::ostringstream error_message; ! error_message << "Failed to set minimum value of determinant"; sptk::PrintErrorMessage("levdur", error_message); return 1; *************** *** 185,189 **** for (int frame_index(0); sptk::ReadStream( ! false, length, &autocorrelation_sequence, &input_stream); ++frame_index) { bool is_stable(false); --- 185,189 ---- for (int frame_index(0); sptk::ReadStream( ! false, 0, 0, length, &autocorrelation_sequence, &input_stream); ++frame_index) { bool is_stable(false); *************** *** 191,195 **** &linear_predictive_coefficients, &is_stable, &buffer)) { std::ostringstream error_message; ! error_message << "Failed to solve an autocorrelation normal equation"; sptk::PrintErrorMessage("levdur", error_message); return 1; --- 191,195 ---- &linear_predictive_coefficients, &is_stable, &buffer)) { std::ostringstream error_message; ! error_message << "Failed to solve autocorrelation normal equations"; sptk::PrintErrorMessage("levdur", error_message); return 1; *************** *** 203,207 **** } ! if (!sptk::WriteStream(length, linear_predictive_coefficients, &std::cout)) { std::ostringstream error_message; --- 203,207 ---- } ! if (!sptk::WriteStream(0, length, linear_predictive_coefficients, &std::cout)) { std::ostringstream error_message; Index: lpc.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/lpc.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** lpc.cc 2 Feb 2017 05:25:50 -0000 1.7 --- lpc.cc 15 Mar 2017 13:38:04 -0000 1.8 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 43,47 **** // ----------------------------------------------------------------- // ! #include <unistd.h> #include <fstream> #include <iostream> --- 43,47 ---- // ----------------------------------------------------------------- // ! #include <getopt.h> #include <fstream> #include <iostream> *************** *** 65,69 **** const int kDefaultNumOrder(25); const double kDefaultEpsilon(1.0e-6); ! const int kDefaultBehaviorForUnstableCoefficient(kIgnore); void PrintUsage(std::ostream* stream) { --- 65,70 ---- const int kDefaultNumOrder(25); const double kDefaultEpsilon(1.0e-6); ! const BehaviorForUnstableCoefficients kDefaultBehaviorForUnstableCoefficients( ! kIgnore); void PrintUsage(std::ostream* stream) { *************** *** 79,83 **** *stream << " -f f : minimum value of the determinant of [" << kDefaultEpsilon << "]" << std::endl; // NOLINT *stream << " the normal matrix" << std::endl; ! *stream << " -e e : check whether the derived linear [" << kDefaultBehaviorForUnstableCoefficient << "]" << std::endl; // NOLINT *stream << " predictive coefficients are stable" << std::endl; *stream << " 0 (the check is not performed)" << std::endl; --- 80,84 ---- *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; *************** *** 105,113 **** double epsilon(kDefaultEpsilon); BehaviorForUnstableCoefficients behavior( ! static_cast<BehaviorForUnstableCoefficients>( ! kDefaultBehaviorForUnstableCoefficient)); for (;;) { ! const char option_char(getopt(argc, argv, "l:m:f:e:h")); if (-1 == option_char) break; --- 106,113 ---- double epsilon(kDefaultEpsilon); BehaviorForUnstableCoefficients behavior( ! kDefaultBehaviorForUnstableCoefficients); for (;;) { ! const int option_char(getopt_long(argc, argv, "l:m:f:e:h", NULL, NULL)); if (-1 == option_char) break; *************** *** 188,192 **** if (!autocorrelation.SetNumOrder(num_order)) { std::ostringstream error_message; ! error_message << "Failed to set the number of orders"; sptk::PrintErrorMessage("lpc", error_message); return 1; --- 188,192 ---- if (!autocorrelation.SetNumOrder(num_order)) { std::ostringstream error_message; ! error_message << "Failed to set the order of autocorrelation sequence"; sptk::PrintErrorMessage("lpc", error_message); return 1; *************** *** 197,201 **** if (!recursion.SetEpsilon(epsilon)) { std::ostringstream error_message; ! error_message << "Failed to set the minimum value of the determinant"; sptk::PrintErrorMessage("lpc", error_message); return 1; --- 197,201 ---- if (!recursion.SetEpsilon(epsilon)) { std::ostringstream error_message; ! error_message << "Failed to set the minimum value of determinant"; sptk::PrintErrorMessage("lpc", error_message); return 1; *************** *** 207,216 **** std::vector<double> linear_predictive_coefficients(output_length); ! for (int frame_index(0); ! sptk::ReadStream(false, frame_length, &windowed_sequence, &input_stream); ++frame_index) { if (!autocorrelation.Run(windowed_sequence, &autocorrelation_sequence)) { std::ostringstream error_message; ! error_message << "Failed to obtain an autocorrelation sequence"; sptk::PrintErrorMessage("lpc", error_message); return 1; --- 207,216 ---- std::vector<double> linear_predictive_coefficients(output_length); ! for (int frame_index(0); sptk::ReadStream(false, 0, 0, frame_length, ! &windowed_sequence, &input_stream); ++frame_index) { if (!autocorrelation.Run(windowed_sequence, &autocorrelation_sequence)) { std::ostringstream error_message; ! error_message << "Failed to obtain autocorrelation sequence"; sptk::PrintErrorMessage("lpc", error_message); return 1; *************** *** 221,225 **** &linear_predictive_coefficients, &is_stable, &buffer)) { std::ostringstream error_message; ! error_message << "Failed to solve an autocorrelation normal equation"; sptk::PrintErrorMessage("lpc", error_message); return 1; --- 221,225 ---- &linear_predictive_coefficients, &is_stable, &buffer)) { std::ostringstream error_message; ! error_message << "Failed to solve autocorrelation normal equations"; sptk::PrintErrorMessage("lpc", error_message); return 1; *************** *** 233,237 **** } ! if (!sptk::WriteStream(output_length, linear_predictive_coefficients, &std::cout)) { std::ostringstream error_message; --- 233,237 ---- } ! if (!sptk::WriteStream(0, output_length, linear_predictive_coefficients, &std::cout)) { std::ostringstream error_message; Index: ifft.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/ifft.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ifft.cc 2 Feb 2017 05:25:50 -0000 1.7 --- ifft.cc 15 Mar 2017 13:38:04 -0000 1.8 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 43,47 **** // ----------------------------------------------------------------- // ! #include <unistd.h> #include <fstream> #include <iostream> --- 43,47 ---- // ----------------------------------------------------------------- // ! #include <getopt.h> #include <fstream> #include <iostream> *************** *** 62,66 **** const int kDefaultFftSize(256); ! const int kDefaultOutputFormat(kOutputRealAndImaginaryParts); void PrintUsage(std::ostream* stream) { --- 62,66 ---- const int kDefaultFftSize(256); ! const OutputFormats kDefaultOutputFormat(kOutputRealAndImaginaryParts); void PrintUsage(std::ostream* stream) { *************** *** 92,99 **** int main(int argc, char* argv[]) { int fft_size(kDefaultFftSize); ! OutputFormats output_format(static_cast<OutputFormats>(kDefaultOutputFormat)); for (;;) { ! const char option_char(getopt(argc, argv, "l:o:h")); if (-1 == option_char) break; --- 92,99 ---- int main(int argc, char* argv[]) { int fft_size(kDefaultFftSize); ! OutputFormats output_format(kDefaultOutputFormat); for (;;) { ! const int option_char(getopt_long(argc, argv, "l:o:h", NULL, NULL)); if (-1 == option_char) break; *************** *** 162,170 **** std::vector<double> output_y(fft_size); ! while (sptk::ReadStream(false, fft_size, &input_x, &input_stream) && ! sptk::ReadStream(false, 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 the inverse fast Fourier transform"; sptk::PrintErrorMessage("ifft", error_message); return 1; --- 162,170 ---- std::vector<double> output_y(fft_size); ! 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"; sptk::PrintErrorMessage("ifft", error_message); return 1; *************** *** 172,178 **** if (kOutputImaginaryPart != output_format && ! !sptk::WriteStream(fft_size, output_x, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write an output sequence"; sptk::PrintErrorMessage("ifft", error_message); return 1; --- 172,178 ---- if (kOutputImaginaryPart != output_format && ! !sptk::WriteStream(0, fft_size, output_x, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write real parts"; sptk::PrintErrorMessage("ifft", error_message); return 1; *************** *** 181,187 **** if ((kOutputRealAndImaginaryParts == output_format || kOutputImaginaryPart == output_format) && ! !sptk::WriteStream(fft_size, output_y, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write an output sequence"; sptk::PrintErrorMessage("ifft", error_message); return 1; --- 181,187 ---- if ((kOutputRealAndImaginaryParts == output_format || kOutputImaginaryPart == output_format) && ! !sptk::WriteStream(0, fft_size, output_y, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write imaginary parts"; sptk::PrintErrorMessage("ifft", error_message); return 1; Index: c2mpir.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/c2mpir.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** c2mpir.cc 12 Oct 2016 12:14:38 -0000 1.4 --- c2mpir.cc 15 Mar 2017 13:38:04 -0000 1.5 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 43,47 **** // ----------------------------------------------------------------- // ! #include <unistd.h> #include <fstream> #include <iostream> --- 43,47 ---- // ----------------------------------------------------------------- // ! #include <getopt.h> #include <fstream> #include <iostream> *************** *** 86,90 **** for (;;) { ! const char option_char(getopt(argc, argv, "m:M:l:h")); if (-1 == option_char) break; --- 86,90 ---- for (;;) { ! const int option_char(getopt_long(argc, argv, "m:M:l:h", NULL, NULL)); if (-1 == option_char) break; *************** *** 144,148 **** std::ostringstream error_message; error_message << "Cannot open file " << input_file; ! sptk::PrintErrorMessage("freqt", error_message); return 1; } --- 144,148 ---- std::ostringstream error_message; error_message << "Cannot open file " << input_file; ! sptk::PrintErrorMessage("c2mpir", error_message); return 1; } *************** *** 165,169 **** std::vector<double> minimum_phase_impulse_response(output_length); ! while (sptk::ReadStream(false, input_length, &cepstrum, &input_stream)) { if (!cepstrum_to_minimum_phase_impulse_response.Run( cepstrum, &minimum_phase_impulse_response)) { --- 165,170 ---- std::vector<double> minimum_phase_impulse_response(output_length); ! while ( ! sptk::ReadStream(false, 0, 0, input_length, &cepstrum, &input_stream)) { if (!cepstrum_to_minimum_phase_impulse_response.Run( cepstrum, &minimum_phase_impulse_response)) { *************** *** 175,182 **** } ! if (!sptk::WriteStream(output_length, minimum_phase_impulse_response, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write an output sequence"; sptk::PrintErrorMessage("c2mpir", error_message); return 1; --- 176,183 ---- } ! if (!sptk::WriteStream(0, output_length, minimum_phase_impulse_response, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write minimum phase impulse response"; sptk::PrintErrorMessage("c2mpir", error_message); return 1; Index: excite.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/excite.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** excite.cc 12 Oct 2016 12:27:53 -0000 1.5 --- excite.cc 15 Mar 2017 13:38:04 -0000 1.6 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 43,47 **** // ----------------------------------------------------------------- // ! #include <unistd.h> #include <fstream> #include <iostream> --- 43,47 ---- // ----------------------------------------------------------------- // ! #include <getopt.h> #include <fstream> #include <iostream> *************** *** 99,103 **** for (;;) { ! const char option_char(getopt(argc, argv, "p:i:nsh")); if (-1 == option_char) break; --- 99,103 ---- for (;;) { ! const int option_char(getopt_long(argc, argv, "p:i:nsh", NULL, NULL)); if (-1 == option_char) break; *************** *** 198,202 **** if (!excitation_generation.IsValid()) { std::ostringstream error_message; ! error_message << "Failed to set the condition for excitation generation"; sptk::PrintErrorMessage("excite", error_message); delete random_generation; --- 198,202 ---- if (!excitation_generation.IsValid()) { std::ostringstream error_message; ! error_message << "Failed to set condition for excitation generation"; sptk::PrintErrorMessage("excite", error_message); delete random_generation; *************** *** 208,212 **** if (!sptk::WriteStream(excitation, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write an excitation"; sptk::PrintErrorMessage("excite", error_message); delete random_generation; --- 208,212 ---- if (!sptk::WriteStream(excitation, &std::cout)) { std::ostringstream error_message; ! error_message << "Failed to write excitation"; sptk::PrintErrorMessage("excite", error_message); delete random_generation; Index: levinson_durbin_recursion.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/levinson_durbin_recursion.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** levinson_durbin_recursion.cc 26 Dec 2016 07:41:20 -0000 1.8 --- levinson_durbin_recursion.cc 15 Mar 2017 13:38:04 -0000 1.9 *************** *** 52,57 **** bool LevinsonDurbinRecursion::Run( const std::vector<double>& autocorrelation_sequence, ! std::vector<double>* linear_predictive_coefficients, ! bool* is_stable, LevinsonDurbinRecursion::Buffer* buffer) const { // check inputs if (autocorrelation_sequence.empty() || --- 52,57 ---- bool LevinsonDurbinRecursion::Run( const std::vector<double>& autocorrelation_sequence, ! std::vector<double>* linear_predictive_coefficients, bool* is_stable, ! LevinsonDurbinRecursion::Buffer* buffer) const { // check inputs if (autocorrelation_sequence.empty() || Index: ltcdf.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/ltcdf.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ltcdf.cc 26 Oct 2016 08:18:58 -0000 1.1 --- ltcdf.cc 15 Mar 2017 13:38:04 -0000 1.2 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 43,47 **** // ----------------------------------------------------------------- // ! #include <unistd.h> #include <fstream> #include <iostream> --- 43,47 ---- // ----------------------------------------------------------------- // ! #include <getopt.h> #include <fstream> #include <iostream> *************** *** 96,100 **** for (;;) { ! const char option_char(getopt(argc, argv, "m:p:i:tkh")); if (-1 == option_char) break; --- 96,100 ---- for (;;) { ! const int option_char(getopt_long(argc, argv, "m:p:i:tkh", NULL, NULL)); if (-1 == option_char) break; *************** *** 151,155 **** std::ostringstream error_message; error_message ! << "Interpolation period should not be greater than half frame period"; sptk::PrintErrorMessage("ltcdf", error_message); return 1; --- 151,155 ---- std::ostringstream error_message; error_message ! << "Interpolation period must not be greater than half frame period"; sptk::PrintErrorMessage("ltcdf", error_message); return 1; *************** *** 215,219 **** if (!interpolation.IsValid() || !filter.IsValid()) { std::ostringstream error_message; ! error_message << "Failed to set the conditions for filtering"; sptk::PrintErrorMessage("ltcdf", error_message); return 1; --- 215,219 ---- if (!interpolation.IsValid() || !filter.IsValid()) { std::ostringstream error_message; ! error_message << "Failed to set condition for filtering"; sptk::PrintErrorMessage("ltcdf", error_message); return 1; Index: sptk_utils.h =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/sptk_utils.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** sptk_utils.h 26 Jan 2017 10:33:54 -0000 1.9 --- sptk_utils.h 15 Mar 2017 13:38:04 -0000 1.10 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 64,76 **** static const double kNp(8.685889638065035); // 1 Np = 20 / ln(10) dB ! bool ReadStream(double* data_to_read, std::istream* input_stream); ! bool ReadStream(bool zero_padding, int read_size, ! std::vector<double>* sequence_to_read, std::istream* input_stream); ! bool WriteStream(double data_to_write, std::ostream* output_stream); ! bool WriteStream(int write_size, const std::vector<double>& sequence_to_write, ! std::ostream* output_stream); ! bool WriteStream(int begin, int end, ! const std::vector<double>& sequence_to_write, std::ostream* output_stream); const char* ConvertBooleanToString(bool input); --- 64,78 ---- static const double kNp(8.685889638065035); // 1 Np = 20 / ln(10) dB ! template <typename T> ! bool ReadStream(T* data_to_read, std::istream* input_stream); ! template <typename T> ! bool ReadStream(bool zero_padding, int stream_skip, int read_point, ! int read_size, std::vector<T>* sequence_to_read, std::istream* input_stream); ! template <typename T> ! bool WriteStream(T data_to_write, std::ostream* output_stream); ! template <typename T> ! bool WriteStream(int write_point, int write_size, ! const std::vector<T>& sequence_to_write, std::ostream* output_stream); const char* ConvertBooleanToString(bool input); Index: mgc2sp.cc =================================================================== RCS file: /cvsroot/sp-tk/SPTK4/src/mgc2sp.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mgc2sp.cc 2 Feb 2017 05:25:50 -0000 1.2 --- mgc2sp.cc 15 Mar 2017 13:38:04 -0000 1.3 *************** *** 9,13 **** // Science and Engineering // // // ! // 1996-2016 Nagoya Institute of Technology // // Department of Computer Science // // // --- 9,13 ---- // Science and Engineering // // // ! // 1996-2017 Nagoya Institute of Technology // // Department of Computer Science // // // *************** *** 43,47 **** // ----------------------------------------------------------------- // ! #include <unistd.h> #include <algorithm> #include <cmath> --- 43,47 ---- // ----------------------------------------------------------------- // ! #include <getopt.h> #include <algorithm> #include <cmath> *************** *** 74,78 **** const bool kDefaultMultiplicationFlag(false); const int kDefaultFftSize(256); ! const int kDefaultOutputFormat(kLogAmplitudeSpectrumInDecibels); void PrintUsage(std::ostream* stream) { --- 74,78 ---- const bool kDefaultMultiplicationFlag(false); const int kDefaultFftSize(256); ! const OutputFormats kDefaultOutputFormat(kLogAmplitudeSpectrumInDecibels); void PrintUsage(std::ostream* stream) { *************** *** 123,130 **** bool multiplication_flag(kDefaultMultiplicationFlag); int fft_size(kDefaultFftSize); ! OutputFormats output_format(static_cast<OutputFormats>(kDefaultOutputFormat)); for (;;) { ! const char option_char(getopt(argc, argv, "m:a:g:c:nul:o:h")); if (-1 == option_char) break; --- 123,131 ---- bool multiplication_flag(kDefaultMultiplicationFlag); int fft_size(kDefaultFftSize); ! OutputFormats output_format(kDefaultOutputFormat); for (;;) { ! const int option_char( ! getopt_long(argc, argv, "m:a:g:c:nul:o:h", NULL, NULL)); if (-1 == option_char) break; *************** *** 235,239 **** if (!generalized_cepstrum_to_spectrum.IsValid()) { std::ostringstream error_message; ! error_message << "Failed to set the condition"; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; --- 236,240 ---- if (!generalized_cepstrum_to_spectrum.IsValid()) { std::ostringstream error_message; ! error_message << "Failed to set condition for transformation"; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; *************** *** 246,250 **** std::vector<double> phase_spectrum(fft_size); ! while (sptk::ReadStream(false, input_length, &generalized_cepstrum, &input_stream)) { // input modification --- 247,251 ---- std::vector<double> phase_spectrum(fft_size); ! while (sptk::ReadStream(false, 0, 0, input_length, &generalized_cepstrum, &input_stream)) { // input modification *************** *** 259,263 **** &phase_spectrum, &buffer)) { std::ostringstream error_message; ! error_message << "Failed to transform"; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; --- 260,265 ---- &phase_spectrum, &buffer)) { std::ostringstream error_message; ! error_message ! << "Failed to transform mel-generalized ceptrum to spectrum"; sptk::PrintErrorMessage("mgc2sp", error_message); return 1; *************** *** 317,321 **** case kAmplitudeSpectrum: case kPowerSpectrum: { ! if (!sptk::WriteStream(output_length, amplitude_spectrum, &std::cout)) { std::ostringstream error_message; error_message << "Failed to write amplitude spectrum"; --- 319,324 ---- case kAmplitudeSpectrum: case kPowerSpectrum: { ! if (!sptk::WriteStream(0, output_length, amplitude_spectrum, ! &std::cout)) { std::ostringstream error_message; error_message << "Failed to write amplitude spectrum"; ***... [truncated message content] |
From: fujishita t. <fjs...@us...> - 2017-02-27 05:14:04
|
Update of /cvsroot/sp-tk/SPTK/src/bin/pitch/snack In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv19163 Modified Files: sigproc.c jkGetF0.c Log Message: delete unused parameter Index: jkGetF0.c =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/pitch/snack/jkGetF0.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** jkGetF0.c 22 Dec 2016 10:53:10 -0000 1.16 --- jkGetF0.c 27 Feb 2017 05:14:02 -0000 1.17 *************** *** 544,551 **** register int i, lastl, *t; register float o, p, q, *r, *s, clip; ! int start, ncan, maxl; clip = (float) (cand_thresh * cross->maxval); - maxl = cross->maxloc; lastl = nlags - 2; start = cross->firstlag; --- 544,550 ---- register int i, lastl, *t; register float o, p, q, *r, *s, clip; ! int start, ncan; clip = (float) (cand_thresh * cross->maxval); lastl = nlags - 2; start = cross->firstlag; *************** *** 1863,1867 **** int done; long buff_size, actsize; ! double sf, start_time; F0_params *par, *read_f0_params(); float *f0p, *vuvp, *rms_speech, *acpkp; --- 1862,1866 ---- int done; long buff_size, actsize; ! double sf; F0_params *par, *read_f0_params(); float *f0p, *vuvp, *rms_speech, *acpkp; *************** *** 1967,1971 **** if (framestep > 0) /* If a value was specified with -S, use it. */ par->frame_step = (float) (framestep / sf); - start_time = 0.0f; if(check_f0_params(interp, par, sf)){ Tcl_AppendResult(interp, "invalid/inconsistent parameters -- exiting.", NULL); --- 1966,1969 ---- *************** *** 1999,2003 **** if (framestep > 0) /* If a value was specified with -S, use it. */ par->frame_step = (float) (framestep / sf); - start_time = 0.0f; if (check_f0_params(par, sf)) { --- 1997,2000 ---- Index: sigproc.c =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/pitch/snack/sigproc.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** sigproc.c 22 Dec 2016 10:53:11 -0000 1.8 --- sigproc.c 27 Feb 2017 05:14:02 -0000 1.9 *************** *** 552,556 **** register double engc; int i, iloc, total; - int sizei, sizeo, maxsize; /* Compute mean in reference window and subtract this from the --- 552,555 ---- *************** *** 585,592 **** for(j=size+nlags+start, dq = dbdata, p=data; j--; ) *dq++ = *p++ - engr; - maxsize = start + nlags; - sizei = size + start + nlags + 1; - sizeo = nlags + 1; - /* Compute energy in reference window. */ for(j=size, dp=dbdata, sum=0.0; j--; ) { --- 584,587 ---- |
From: Shikano M. <sh...@us...> - 2017-02-14 05:41:23
|
Update of /cvsroot/sp-tk/SPTK/src/bin/agcep In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv9831 Modified Files: agcep.c Log Message: delete unused variable 'mu' Index: agcep.c =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/agcep/agcep.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** agcep.c 22 Dec 2016 10:52:59 -0000 1.34 --- agcep.c 14 Feb 2017 05:41:20 -0000 1.35 *************** *** 173,177 **** Boolean ave = AVERAGE, norm = NORM; double lambda = LAMBDA, step = STEP, eps = EPS, ! *c, *cc, *avec, tau = TAU, x, mu, gamma; if ((cmnd = strrchr(argv[0], '/')) == NULL) --- 173,177 ---- Boolean ave = AVERAGE, norm = NORM; double lambda = LAMBDA, step = STEP, eps = EPS, ! *c, *cc, *avec, tau = TAU, x, gamma; if ((cmnd = strrchr(argv[0], '/')) == NULL) |
From: Shikano M. <sh...@us...> - 2017-02-14 05:30:41
|
Update of /cvsroot/sp-tk/SPTK/src/bin/lmadf In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv9405 Modified Files: lmadf.c _lmadf.c Log Message: add Header file Index: _lmadf.c =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/lmadf/_lmadf.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** _lmadf.c 22 Dec 2016 10:53:06 -0000 1.21 --- _lmadf.c 14 Feb 2017 05:30:39 -0000 1.22 *************** *** 62,65 **** --- 62,66 ---- #include <stdio.h> + #include <stdlib.h> #if defined(WIN32) Index: lmadf.c =================================================================== RCS file: /cvsroot/sp-tk/SPTK/src/bin/lmadf/lmadf.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** lmadf.c 22 Dec 2016 10:53:06 -0000 1.35 --- lmadf.c 14 Feb 2017 05:30:39 -0000 1.36 *************** *** 94,97 **** --- 94,98 ---- #endif + #include <ctype.h> #include <math.h> |
From: Shikano M. <sh...@us...> - 2017-02-13 08:04:34
|
Update of /cvsroot/sp-tk/SPTK/doc/ref_e In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv31775 Modified Files: glogsp.tex grlogsp.tex Log Message: add 12kHz, 96kHz, 192kHz (x option) Index: grlogsp.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/grlogsp.tex,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** grlogsp.tex 2 Feb 2017 07:19:15 -0000 1.27 --- grlogsp.tex 13 Feb 2017 08:04:32 -0000 1.28 *************** *** 95,102 **** --- 95,105 ---- 8 & frequency ($0 \sim 8$ kHz) \\ 10 & frequency ($0 \sim 10$ kHz) \\ + 12 & frequency ($0 \sim 12$ kHz) \\ 16 & frequency ($0 \sim 16$ kHz) \\ 22 & frequency ($0 \sim 22$ kHz) \\ 24 & frequency ($0 \sim 24$ kHz) \\ 48 & frequency ($0 \sim 48$ kHz) \\ + 96 & frequency ($0 \sim 96$ kHz) \\ + 192 & frequency ($0 \sim 192$ kHz) \\ \end{tabular}\\\hspace*{\fill}}{1} \argm{y}{ymin}{ $y$ minimum}{-100} Index: glogsp.tex =================================================================== RCS file: /cvsroot/sp-tk/SPTK/doc/ref_e/glogsp.tex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** glogsp.tex 2 Feb 2017 07:19:15 -0000 1.24 --- glogsp.tex 13 Feb 2017 08:04:32 -0000 1.25 *************** *** 87,94 **** 8 & frequency ($0 \sim 8$ kHz) \\ 10 & frequency ($0 \sim 10$ kHz) \\ 16 & frequency ($0 \sim 16$ kHz) \\ 22 & frequency ($0 \sim 22$ kHz) \\ 24 & frequency ($0 \sim 24$ kHz) \\ ! 48 & frequency ($0 \sim 48$ kHz) \end{tabular}\\\hspace*{\fill}}{1} \argm{y}{ymin \; ymax}{ $y$ scale[dB]}{0 100} --- 87,97 ---- 8 & frequency ($0 \sim 8$ kHz) \\ 10 & frequency ($0 \sim 10$ kHz) \\ + 12 & frequency ($0 \sim 12$ kHz) \\ 16 & frequency ($0 \sim 16$ kHz) \\ 22 & frequency ($0 \sim 22$ kHz) \\ 24 & frequency ($0 \sim 24$ kHz) \\ ! 48 & frequency ($0 \sim 48$ kHz) \\ ! 96 & frequency ($0 \sim 96$ kHz) \\ ! 192 & frequency ($0 \sim 192$ kHz) \end{tabular}\\\hspace*{\fill}}{1} \argm{y}{ymin \; ymax}{ $y$ scale[dB]}{0 100} |