Add build support for Nvidia Spark
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
from typing import Optional
|
||||
|
||||
import librosa
|
||||
try:
|
||||
import librosa
|
||||
except ImportError:
|
||||
librosa = None
|
||||
import numpy as np
|
||||
import torch
|
||||
import torchaudio
|
||||
@@ -41,6 +44,11 @@ KEY_NAMES = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"]
|
||||
|
||||
def analyze_audio(audio_path):
|
||||
"""Extract BPM, key, and time signature from audio using librosa."""
|
||||
if librosa is None:
|
||||
raise ImportError(
|
||||
"librosa is required for the AceStep captioner but is not "
|
||||
"installed (no numba/llvmlite wheels for this platform yet)."
|
||||
)
|
||||
y, sr = librosa.load(audio_path, sr=22050, mono=True)
|
||||
duration = librosa.get_duration(y=y, sr=sr)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user