Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -37,6 +37,8 @@ def binauralize(audio_file, simulate_rotation, rotation_speed, auto_rotation):
|
|
37 |
# librosa expects float32 input.
|
38 |
audio_float = audio.astype(np.float32)
|
39 |
tempo, _ = librosa.beat.beat_track(y=audio_float, sr=sr)
|
|
|
|
|
40 |
rotation_speed = tempo / 60.0 # Convert BPM to Hz (approx.)
|
41 |
status_msg = f"Auto rotation enabled: Detected tempo = {tempo:.1f} BPM, setting rotation speed = {rotation_speed:.3f} Hz."
|
42 |
except Exception as e:
|
|
|
37 |
# librosa expects float32 input.
|
38 |
audio_float = audio.astype(np.float32)
|
39 |
tempo, _ = librosa.beat.beat_track(y=audio_float, sr=sr)
|
40 |
+
# Cast tempo to float in case it's a NumPy array.
|
41 |
+
tempo = float(tempo)
|
42 |
rotation_speed = tempo / 60.0 # Convert BPM to Hz (approx.)
|
43 |
status_msg = f"Auto rotation enabled: Detected tempo = {tempo:.1f} BPM, setting rotation speed = {rotation_speed:.3f} Hz."
|
44 |
except Exception as e:
|