Skip to content

Commit

Permalink
fixes #13
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderlerch committed Dec 31, 2021
1 parent 7506ed9 commit 203e486
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pyACA/computeBeatHisto.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ def computeBeatHisto(afAudioData, f_s, cMethod='FFT', afWindow=None, iBlockLengt
T = np.flip(afCorr)
elif cMethod == 'FFT':
iHistoLength = 65536
afWindow = ToolComputeHann(iHistoLength)
afWindow = np.zeros(2*iHistoLength)
afWindow[np.arange(0, iHistoLength)] = ToolComputeHann(iHistoLength)
f_s = f_s / iHopLength
if len(d) < 2 * iHistoLength:
d = [d, np.zeros([1, 2 * iHistoLength - len(d)])]

[X, f, t] = computeSpectrogram(afAudioData, f_s, None, iBlockLength, iHopLength)
[X, f, t] = computeSpectrogram(d, f_s, afWindow, 2*iHistoLength, iHistoLength/4)

T = X.mean(axis=1, keepdims=True)

# restrict range
T[:8] = 0
Bpm = f * 60
lIdx = np.argwhere(Bpm >= 30)[0]
lIdx = np.argwhere(Bpm < 30)[-1]
hIdx = np.argwhere(Bpm > 200)[0]
T = T[np.arange(lIdx, hIdx)]
Bpm = Bpm[np.arange(lIdx, hIdx)]
Expand Down

0 comments on commit 203e486

Please sign in to comment.