Audacity
3.2.0
libraries
lib-time-and-pitch
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
15
#include "
StaffPad/FourierTransform_pffft.h
"
16
#include "
StaffPad/SamplesFloat.h
"
17
#include <complex>
18
#include <memory>
19
20
namespace
staffpad::audio
21
{
22
class
FourierTransform;
23
}
24
25
class
FormantShifterLoggerInterface
;
26
27
class
FormantShifter
28
{
29
public
:
30
const
double
cutoffQuefrency
;
31
32
FormantShifter
(
33
int
sampleRate
,
double
cutoffQuefrency
,
34
FormantShifterLoggerInterface
& logger);
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
59
private
:
60
const
int
mSampleRate
;
61
FormantShifterLoggerInterface
&
mLogger
;
62
std::unique_ptr<staffpad::audio::FourierTransform>
mFft
;
63
staffpad::SamplesComplex
mEnvelope
;
64
staffpad::SamplesReal
mCepstrum
;
65
std::vector<float>
mEnvelopeReal
;
66
std::vector<float>
mWeights
;
67
};
FourierTransform_pffft.h
SamplesFloat.h
FormantShifter
Definition:
FormantShifter.h:28
FormantShifter::mFft
std::unique_ptr< staffpad::audio::FourierTransform > mFft
Definition:
FormantShifter.h:62
FormantShifter::Reset
void Reset()
Definition:
FormantShifter.cpp:63
FormantShifter::cutoffQuefrency
const double cutoffQuefrency
Definition:
FormantShifter.h:30
FormantShifter::mEnvelopeReal
std::vector< float > mEnvelopeReal
Definition:
FormantShifter.h:65
FormantShifter::mWeights
std::vector< float > mWeights
Definition:
FormantShifter.h:66
FormantShifter::mCepstrum
staffpad::SamplesReal mCepstrum
Definition:
FormantShifter.h:64
FormantShifter::mSampleRate
const int mSampleRate
Definition:
FormantShifter.h:60
FormantShifter::mEnvelope
staffpad::SamplesComplex mEnvelope
Definition:
FormantShifter.h:63
FormantShifter::mLogger
FormantShifterLoggerInterface & mLogger
Definition:
FormantShifter.h:61
FormantShifter::FormantShifter
FormantShifter(int sampleRate, double cutoffQuefrency, FormantShifterLoggerInterface &logger)
Definition:
FormantShifter.cpp:43
FormantShifter::Process
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...
Definition:
FormantShifter.cpp:68
FormantShifterLoggerInterface
Definition:
FormantShifterLoggerInterface.h:19
staffpad::SamplesFloat< std::complex< float > >
anonymous_namespace{ClipSegmentTest.cpp}::sampleRate
constexpr auto sampleRate
Definition:
ClipSegmentTest.cpp:20
staffpad::audio
Definition:
FormantShifter.h:21
Generated by
1.9.3