pitch_spec

Functions

int main(int argc, char *argv[])

pitch_spec [ option ] f0file [ infile ]

  • -a int

    • algorithm used for spectrum extraction

      • 0 WORLD (CheapTrick)

  • -l int

    • FFT length

  • -p int

    • frame shift [point] \((1 \le P)\)

  • -s double

    • sampling rate [kHz] \((8 \le F_s \le 98)\)

  • -q int

    • f0 input format

      • 0 pitch \((F_s / F_0)\)

      • 1 F0

      • 2 log F0

  • -o int

    • output format

      • 0 \(20 \log_{10} |H(z)|\)

      • 1 \(\log |H(z)|\)

      • 2 \(|H(z)|\)

      • 3 \(|H(z)|^2\)

  • infile str

    • double-type waveform

  • f0file str

    • double-type pitch

  • stdout

    • double-type spectrum

The below is a simple example to extract spectrum from data.d.

pitch -s 16 -p 80 -L 80 -H 200 -o 1 < data.d > data.f0
pitch_spec -s 16 -p 80 -q 1 data.f0 < data.d > data.sp
Parameters:
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns:

0 on success, 1 on failure.

See also

spec pitch

class SpectrumExtraction

Extract spectrum from waveform.

The input is whole audio waveform and the output is the sequence of the spectrum measure. The implemented algorithm of the extraction is CheapTrick.

[1] M. Morise, “CheapTrick, a spectral envelope estimator for high-quality speech synthesis,” Proc. of Speech Communication, vol. 67, pp. 1-7, 2015.

Public Types

enum Algorithms

Spectrum extraction algorithm type.

Values:

enumerator kWorld
enumerator kNumAlgorithms

Public Functions

SpectrumExtraction(int fft_length, int frame_shift, double sampling_rate, Algorithms algorithm)
Parameters:
  • fft_length[in] FFT length.

  • frame_shift[in] Frame shift in point.

  • sampling_rate[in] Sampling rate in Hz.

  • algorithm[in] Algorithm used for spectrum extraction.

inline bool IsValid() const
Returns:

True if this object is valid.

bool Run(const std::vector<double> &waveform, const std::vector<double> &f0, std::vector<std::vector<double>> *spectrum) const
Parameters:
  • waveform[in] Waveform.

  • f0[in] Fundamental frequency in Hz.

  • spectrum[out] Power spectrum.

Returns:

True on success, false on failure.