justus-tobias commited on
Commit
f218c29
·
1 Parent(s): a9a2704

improved type handling

Browse files
Files changed (1) hide show
  1. utils.py +4 -1
utils.py CHANGED
@@ -363,7 +363,10 @@ def plotBeattimes(beattimes: np.ndarray,
363
  )
364
 
365
  # Process and plot primary beat times
366
- beat_indices = np.round(beattimes * sr).astype(int)
 
 
 
367
  beat_indices = beat_indices[beat_indices < len(audiodata)]
368
  beat_amplitudes = audiodata[beat_indices]
369
 
 
363
  )
364
 
365
  # Process and plot primary beat times
366
+ if isinstance(beattimes[0], str):
367
+ beat_indices = np.round(np.array(beattimes, dtype=float) * sr).astype(int)
368
+ else:
369
+ beat_indices = np.round(beattimes * sr).astype(int)
370
  beat_indices = beat_indices[beat_indices < len(audiodata)]
371
  beat_amplitudes = audiodata[beat_indices]
372