History

readd period detection alpha and tolerance

Matthew Wang committed 6 years ago

Commit 249e21c1 parent 63e93a54 files · +33 −0Browse files

Unified · Split

4 files
  1. LEAF/Inc/leaf-analysis.h +6 −0
  2. LEAF/Inc/leaf-effects.h +2 −0
  3. LEAF/Src/leaf-analysis.c +13 −0
  4. LEAF/Src/leaf-effects.c +12 −0
LEAF/Inc/leaf-analysis.h+6−0
@@ -239,6 +239,10 @@ extern "C" { · 238 unmodified lines
239239
240240 float fidelityThreshold;
241241
242+ float history;
243+ float alpha;
244+ float tolerance;
245+
242246 } _tPeriodDetection;
243247
244248 typedef _tPeriodDetection* tPeriodDetection;
@@ -253,6 +257,8 @@ extern "C" { · 8 unmodified lines
253257 void tPeriodDetection_setHopSize (tPeriodDetection* const, int hs);
254258 void tPeriodDetection_setWindowSize (tPeriodDetection* const, int ws);
255259 void tPeriodDetection_setFidelityThreshold(tPeriodDetection* const, float threshold);
260+ void tPeriodDetection_setAlpha (tPeriodDetection* const, float alpha);
261+ void tPeriodDetection_setTolerance (tPeriodDetection* const, float tolerance);
256262
257263 //==============================================================================
258264
LEAF/Inc/leaf-effects.h+2−0
@@ -298,6 +298,8 @@ extern "C" { · 297 unmodified lines
298298 void tAutotune_setHopSize (tAutotune* const, int hs);
299299 void tAutotune_setWindowSize (tAutotune* const, int ws);
300300 void tAutotune_setFidelityThreshold (tAutotune* const, float threshold);
301+ void tAutotune_setAlpha (tAutotune* const, float alpha);
302+ void tAutotune_setTolerance (tAutotune* const, float tolerance);
301303 float tAutotune_getInputPeriod (tAutotune* const);
302304 float tAutotune_getInputFreq (tAutotune* const);
303305
LEAF/Src/leaf-analysis.c+13−0
@@ -944,3 +944,16 @@ void tPeriodDetection_setFidelityThreshold(tPeriodDetection* pd, float threshold · 943 unmodified lines
944944 _tPeriodDetection* p = *pd;
945945 p->fidelityThreshold = threshold;
946946 }
947+
948+void tPeriodDetection_setAlpha (tPeriodDetection* pd, float alpha)
949+{
950+ _tPeriodDetection* p = *pd;
951+ p->alpha = LEAF_clip(0.0f, alpha, 1.0f);
952+}
953+
954+void tPeriodDetection_setTolerance (tPeriodDetection* pd, float tolerance)
955+{
956+ _tPeriodDetection* p = *pd;
957+ if (tolerance < 0.0f) p->tolerance = 0.0f;
958+ else p->tolerance = tolerance;
959+}
LEAF/Src/leaf-effects.c+12−0
@@ -1545,6 +1545,18 @@ void tAutotune_setFidelityThreshold(tAutotune* const rt, float threshold) · 1544 unmodified lines
15451545 tPeriodDetection_setFidelityThreshold(&r->pd, threshold);
15461546 }
15471547
1548+void tAutotune_setAlpha (tAutotune* rt, float alpha)
1549+{
1550+ _tAutotune* r = *rt;
1551+ tPeriodDetection_setAlpha(&r->pd, alpha);
1552+}
1553+
1554+void tAutotune_setTolerance (tAutotune* rt, float tolerance)
1555+{
1556+ _tAutotune* r = *rt;
1557+ tPeriodDetection_setTolerance(&r->pd, tolerance);
1558+}
1559+
15481560 float tAutotune_getInputPeriod(tAutotune* const rt)
15491561 {
15501562 _tAutotune* r = *rt;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t