|
6 | 6 | # - `harmonicModel`: analysis+synthesis round-trip |
7 | 7 | # - `harmonicModelAnal` / `harmonicModelSynth`: separated analysis/synthesis APIs |
8 | 8 |
|
| 9 | + |
9 | 10 | import math |
10 | 11 |
|
11 | 12 | import numpy as np |
@@ -77,7 +78,7 @@ def f0Detection( |
77 | 78 | ipfreq = fs * iploc / N # convert locations to Hz |
78 | 79 | f0t = UF.f0Twm(ipfreq, ipmag, f0et, minf0, maxf0, f0stable, fs=fs) # find f0 |
79 | 80 | f0stable = f0t if f0t > 0 and abs(f0t - f0stable) < f0et else 0 |
80 | | - f0candidate = f0t |
| 81 | + # f0candidate = f0t # unused variable |
81 | 82 | f0 = np.append(f0, f0t) # add f0 to output array |
82 | 83 | pin += H # advance sound pointer |
83 | 84 | return f0 |
@@ -206,7 +207,9 @@ def harmonicModelAnal( |
206 | 207 | # f0candidate = f0t # unused variable |
207 | 208 | f0.append(f0t) # add f0 to output list |
208 | 209 | # Harmonic detection |
209 | | - hfreq, hmag, hphase = harmonicDetection(ipfreq, ipmag, ipphase, f0t, nH, hfreqp, fs, harmDevSlope) |
| 210 | + hfreq, hmag, hphase = harmonicDetection( |
| 211 | + ipfreq, ipmag, ipphase, f0t, nH, hfreqp, fs, harmDevSlope |
| 212 | + ) |
210 | 213 | xhfreq.append(hfreq) |
211 | 214 | xhmag.append(hmag) |
212 | 215 | xhphase.append(hphase) |
@@ -256,7 +259,9 @@ def harmonicModel( |
256 | 259 | # User can specify N for analysis |
257 | 260 | H = 128 |
258 | 261 | Ns = 512 |
259 | | - hfreq, hmag, hphase = harmonicModelAnal(x, fs, w, N, H, t, nH, minf0, maxf0, f0et) |
| 262 | + hfreq, hmag, hphase = harmonicModelAnal( |
| 263 | + x, fs, w, N, H, t, nH, minf0, maxf0, f0et |
| 264 | + ) |
260 | 265 | # Synthesize using fixed synthesis parameters |
261 | 266 | y = SM.sineModelSynth(hfreq, hmag, hphase, Ns, H, fs) |
262 | 267 | # Ensure output length matches input |
|
0 commit comments