@@ -39,6 +39,7 @@ const double kDefaultSamplingRate(16.0);
3939const InputFormats kDefaultInputFormat (kPitch );
4040const sptk::SpectrumToSpectrum::InputOutputFormats kDefaultOutputFormat (
4141 sptk::SpectrumToSpectrum::kLogAmplitudeSpectrumInDecibels );
42+ const bool kDefaultF0Refinement (true );
4243
4344void PrintUsage (std::ostream* stream) {
4445 // clang-format off
@@ -63,6 +64,7 @@ void PrintUsage(std::ostream* stream) {
6364 *stream << " 1 (ln|H(z)|)" << std::endl;
6465 *stream << " 2 (|H(z)|)" << std::endl;
6566 *stream << " 3 (|H(z)|^2)" << std::endl;
67+ *stream << " -x : skip f0 refinement ( bool)[" << std::setw (5 ) << std::right << sptk::ConvertBooleanToString (!kDefaultF0Refinement ) << " ]" << std::endl; // NOLINT
6668 *stream << " -h : print this message" << std::endl;
6769 *stream << " infile:" << std::endl;
6870 *stream << " waveform (double)[stdin]" << std::endl;
@@ -104,6 +106,8 @@ void PrintUsage(std::ostream* stream) {
104106 * \arg @c 1 @f$\log |H(z)|@f$
105107 * \arg @c 2 @f$|H(z)|@f$
106108 * \arg @c 3 @f$|H(z)|^2@f$
109+ * - @b -x
110+ * - disable f0 refinement
107111 * - @b infile @e str
108112 * - double-type waveform
109113 * - @b f0file @e str
@@ -130,9 +134,11 @@ int main(int argc, char* argv[]) {
130134 InputFormats input_format (kDefaultInputFormat );
131135 sptk::SpectrumToSpectrum::InputOutputFormats output_format (
132136 kDefaultOutputFormat );
137+ bool f0_refinement (kDefaultF0Refinement );
133138
134139 for (;;) {
135- const int option_char (getopt_long (argc, argv, " a:l:p:s:q:o:h" , NULL , NULL ));
140+ const int option_char (
141+ getopt_long (argc, argv, " a:l:p:s:q:o:xh" , NULL , NULL ));
136142 if (-1 == option_char) break ;
137143
138144 switch (option_char) {
@@ -222,6 +228,10 @@ int main(int argc, char* argv[]) {
222228 static_cast <sptk::SpectrumToSpectrum::InputOutputFormats>(tmp);
223229 break ;
224230 }
231+ case ' x' : {
232+ f0_refinement = false ;
233+ break ;
234+ }
225235 case ' h' : {
226236 PrintUsage (&std::cout);
227237 return 0 ;
@@ -320,8 +330,8 @@ int main(int argc, char* argv[]) {
320330 }
321331 if (waveform.empty ()) return 0 ;
322332
323- sptk::SpectrumExtraction spectrum_extraction (fft_length, frame_shift,
324- sampling_rate_in_hz, algorithm);
333+ sptk::SpectrumExtraction spectrum_extraction (
334+ fft_length, frame_shift, sampling_rate_in_hz, f0_refinement , algorithm);
325335 if (!spectrum_extraction.IsValid ()) {
326336 std::ostringstream error_message;
327337 error_message << " FFT length must be a power of 2" ;
0 commit comments