Audacity 3.2.0
FormantShifter.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*!********************************************************************
3
4 Audacity: A Digital Audio Editor
5
6 FormantShifter.h
7
8 A class for shifting the formants of a voice signal.
9
10 Matthieu Hodgkinson
11
12**********************************************************************/
13#pragma once
14
17#include <complex>
18#include <memory>
19
21{
22class FourierTransform;
23}
24
26
28{
29public:
30 const double cutoffQuefrency;
31
33 int sampleRate, double cutoffQuefrency,
35
36 void Reset(size_t fftSize);
37 void Reset();
38
56 void Process(
57 const float* powerSpectrum, std::complex<float>* spectrum, double factor);
58
59private:
60 const int mSampleRate;
62 std::unique_ptr<staffpad::audio::FourierTransform> mFft;
65 std::vector<float> mEnvelopeReal;
66 std::vector<float> mWeights;
67};
std::unique_ptr< staffpad::audio::FourierTransform > mFft
const double cutoffQuefrency
std::vector< float > mEnvelopeReal
std::vector< float > mWeights
staffpad::SamplesReal mCepstrum
const int mSampleRate
staffpad::SamplesComplex mEnvelope
FormantShifterLoggerInterface & mLogger
FormantShifter(int sampleRate, double cutoffQuefrency, FormantShifterLoggerInterface &logger)
void Process(const float *powerSpectrum, std::complex< float > *spectrum, double factor)
Processes spectrum in place, or does nothing if Reset(fftSize) wasn't called or Reset() was called si...