CLAM-Development
1.4.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
Processing
Transformations
SMS
SMSPitchShift.hxx
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG)
3
* UNIVERSITAT POMPEU FABRA
4
*
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
*
20
*/
21
22
23
#ifndef _SMSPitchShift_
24
#define _SMSPitchShift_
25
26
#include "
InPort.hxx
"
27
#include "
OutPort.hxx
"
28
#include "
InControl.hxx
"
29
#include "
FrameTransformation.hxx
"
30
#include "
SpectralEnvelopeExtract.hxx
"
31
#include "
SpectralEnvelopeApply.hxx
"
32
#include "
FDCombFilter.hxx
"
33
#include "
SpectralPeakArray.hxx
"
34
#include "
Frame.hxx
"
35
36
#include "
FrameTransformationConfig.hxx
"
37
#include "
SegmentTransformationConfig.hxx
"
38
39
40
namespace
CLAM{
41
42
47
class
SMSPitchShift
:
public
FrameTransformation
48
{
49
const
char
*GetClassName()
const
{
return
"SMSPitchShift"
;}
50
51
InPort<SpectralPeakArray>
mInPeaks;
52
OutPort<SpectralPeakArray>
mOutPeaks;
53
InPort<Fundamental>
mInFundamental;
54
OutPort<Fundamental>
mOutFundamental;
55
InPort<Spectrum>
mInSpectrum;
56
OutPort<Spectrum>
mOutSpectrum;
57
58
FloatInControl
mIsHarmonic;
59
FloatInControl
mPitchSteps;
60
public
:
61
SMSPitchShift
()
62
:
63
mInPeaks(
"In SpectralPeaks"
, this),
64
mOutPeaks(
"Out SpectralPeaks"
, this),
65
mInFundamental(
"In Fundamental"
, this),
66
mOutFundamental(
"Out Fundamental"
, this),
67
mInSpectrum(
"In Spectrum"
, this),
68
mOutSpectrum(
"Out Spectrum"
, this),
69
mIsHarmonic(
"Harmonic"
, this),
70
mPitchSteps(
"PitchSteps"
, this),
71
mIgnoreResidual
(
"IgnoreResidual"
, this)
72
{
73
Configure
(
SegmentTransformationConfig
() );
74
}
75
76
~SMSPitchShift
() {}
77
78
bool
ConcreteConfigure
(
const
ProcessingConfig
& config )
79
{
80
mPitchSteps.
SetBounds
(1,100);
81
mPitchSteps.
SetDefaultValue
(1);
//no pitch shift
82
mPitchSteps.
DoControl
(1);
83
84
mIgnoreResidual
.
SetBounds
(0.,1.);
85
mIgnoreResidual
.
SetDefaultValue
(0.);
86
mIgnoreResidual
.
DoControl
(0.);
87
return
true
;
88
}
89
90
bool
Do
(
const
SpectralPeakArray
& inPeaks,
91
const
Fundamental
& inFund,
92
const
Spectrum
& inRes,
93
SpectralPeakArray
& outPeaks,
94
Fundamental
& outFund,
95
Spectrum
& outRes);
96
97
bool
Do
(
const
Frame
& in,
Frame
& out);
98
99
bool
Do
()
100
{
101
bool
result =
Do
(mInPeaks.
GetData
(),
102
mInFundamental.
GetData
(),
103
mInSpectrum.
GetData
(),
104
mOutPeaks.
GetData
(),
105
mOutFundamental.
GetData
(),
106
mOutSpectrum.
GetData
()
107
);
108
109
mInPeaks.
Consume
();
110
mOutPeaks.
Produce
();
111
mInFundamental.
Consume
();
112
mOutFundamental.
Produce
();
113
mInSpectrum.
Consume
();
114
mOutSpectrum.
Produce
();
115
116
return
result;
117
}
118
119
private
:
120
SpectralEnvelopeExtract
mSpectralEnvelopeExtract;
121
SpectralEnvelopeApply
mSpectralEnvelopeApply;
122
FDCombFilter
mFDCombFilter;
123
Spectrum
mSpectralEnvelope;
124
public
:
128
FloatInControl
mIgnoreResidual
;
129
};
130
}
//namespace CLAM
131
132
#endif // _SMSPitchShift_
133
Generated by
1.8.1