Add an Interface for Pitchtrackers and set VolTresholds
This commit is contained in:
1 parent
5f79406cf2
commit
d04cbe7ceb
16 files changed
+344
-173
No files matched your search
@@ -5,23 +5,27 @@
|
||||
PtDyWa::PtDyWa(unsigned step){
|
||||
_Step = step;
|
||||
dywapitch_inittracking(&_State);
|
||||
_VolTreshold = 0.01f;
|
||||
_LastMaxVol = 0.f;
|
||||
}
|
||||
|
||||
void PtDyWa::Process(){
|
||||
void PtDyWa::SetVolumeThreshold(float threshold){
|
||||
_VolTreshold = threshold;
|
||||
}
|
||||
|
||||
double PtDyWa::FindNote(float* maxVolume){
|
||||
double AnaylsisBuf[_SampleCt];
|
||||
size_t size = _AnalysisBuf.size();
|
||||
if(size > _SampleCt)
|
||||
_AnalysisBuf.pop(size - _SampleCt);
|
||||
if(!_AnalysisBuf.read(AnaylsisBuf, AnaylsisBuf + _SampleCt))
|
||||
return;
|
||||
if(!_AnalysisBuf.read(AnaylsisBuf, AnaylsisBuf + _SampleCt)){
|
||||
*maxVolume = _LastMaxVol * 0.85f;
|
||||
return -1;
|
||||
}
|
||||
_AnalysisBuf.pop(_Step);
|
||||
double pitch = dywapitch_computepitch(&_State, AnaylsisBuf,0,_SampleCt);
|
||||
double pitch = dywapitch_computepitch(&_State, AnaylsisBuf, 0, _SampleCt, maxVolume, _VolTreshold);
|
||||
if(pitch == 0.0)
|
||||
_LastNote = -1;
|
||||
return -1;
|
||||
else
|
||||
_LastNote = FreqToNote(pitch);
|
||||
}
|
||||
|
||||
double PtDyWa::GetNote(){
|
||||
return _LastNote;
|
||||
return FreqToNote(pitch);
|
||||
}
|
||||
Reference in new issue
Block a user