Spaces:
Running
Running
local os import because code is a mess + removed saving
Browse files
beat_manipulator/beatmap.py
CHANGED
|
@@ -58,7 +58,7 @@ def shift(beatmap:np.ndarray, shift:float, log = True, mode = 1) -> np.ndarray:
|
|
| 58 |
beatmap[i] = int(beatmap[i] - shift * (beatmap[i] - beatmap[i-1]))
|
| 59 |
return beatmap
|
| 60 |
|
| 61 |
-
def generate(audio: np.ndarray, sr: int, lib='madmom.BeatDetectionProcessor', caching=True, filename: str = None, log = True, load_settings =
|
| 62 |
"""Creates beatmap attribute with a list of positions of beats in samples."""
|
| 63 |
if log is True: print(f'Analyzing beats using {lib}; ', end='')
|
| 64 |
|
|
@@ -157,6 +157,7 @@ def generate(audio: np.ndarray, sr: int, lib='madmom.BeatDetectionProcessor', ca
|
|
| 157 |
|
| 158 |
if load_settings is True:
|
| 159 |
settingsDir="beat_manipulator/beatmaps/" + ''.join(filename.split('/')[-1]) + "_"+lib+"_"+str(audio_id)+'_settings.txt'
|
|
|
|
| 160 |
if os.path.exists(settingsDir):
|
| 161 |
with open(settingsDir, 'r') as f:
|
| 162 |
settings = f.read().split(',')
|
|
|
|
| 58 |
beatmap[i] = int(beatmap[i] - shift * (beatmap[i] - beatmap[i-1]))
|
| 59 |
return beatmap
|
| 60 |
|
| 61 |
+
def generate(audio: np.ndarray, sr: int, lib='madmom.BeatDetectionProcessor', caching=True, filename: str = None, log = True, load_settings = False, split=None):
|
| 62 |
"""Creates beatmap attribute with a list of positions of beats in samples."""
|
| 63 |
if log is True: print(f'Analyzing beats using {lib}; ', end='')
|
| 64 |
|
|
|
|
| 157 |
|
| 158 |
if load_settings is True:
|
| 159 |
settingsDir="beat_manipulator/beatmaps/" + ''.join(filename.split('/')[-1]) + "_"+lib+"_"+str(audio_id)+'_settings.txt'
|
| 160 |
+
import os
|
| 161 |
if os.path.exists(settingsDir):
|
| 162 |
with open(settingsDir, 'r') as f:
|
| 163 |
settings = f.read().split(',')
|