Skip to content

Commit

Permalink
bpm is None case added
Browse files Browse the repository at this point in the history
  • Loading branch information
sakemin committed Dec 5, 2023
1 parent c26bb7c commit 6179c8c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,13 @@ def predict(
print("BPM : ", music_input_analysis.bpm)

if not beat_sync_threshold or beat_sync_threshold == -1:
beat_sync_threshold = 1.1/(int(music_input_analysis.bpm)/60)
if music_input_analysis.bpm is not None:
beat_sync_threshold = 1.1/(int(music_input_analysis.bpm)/60)
else:
beat_sync_threshold = 0.75

prompt = prompt + f', bpm : {int(music_input_analysis.bpm)}'
if music_input_analysis.bpm is not None:
prompt = prompt + f', bpm : {int(music_input_analysis.bpm)}'

music_input = music_input[None] if music_input.dim() == 2 else music_input
duration = music_input.shape[-1]/sr
Expand Down Expand Up @@ -303,7 +307,7 @@ def predict(
wav_downbeats = []
input_downbeats = []
bpm_hard_sync=False
if bpm_hard_sync:
if bpm_hard_sync and music_input_analysis.bpm is not None:
music_input_bpm_based_downbeats = [music_input_analysis.downbeats[0]]
downbeat_step = 60.9/music_input_analysis.bpm
while True:
Expand Down

0 comments on commit 6179c8c

Please sign in to comment.