diff --git a/README.md b/README.md index fe7e77b9..6c7a5f27 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,7 @@ If you have anaconda installed, you can run from the root of this repository: conda env update -f environment-cpu.yml # if you don't have GPUs conda env update -f environment-cuda.yml # if you have GPUs conda activate demucs -pip install -e . +pip install -e .[dev] ``` This will create a `demucs` environment with all the dependencies installed. diff --git a/requirements.txt b/requirements.txt index 294290d3..8c238d48 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,3 +17,4 @@ torchaudio>=0.8,<2.1 tqdm treetable soundfile>=0.10.3;sys_platform=="win32" +librosa @ git+https://github.com/librosa/librosa.git diff --git a/tools/automix.py b/tools/automix.py index a839345e..5a324f1b 100644 --- a/tools/automix.py +++ b/tools/automix.py @@ -205,12 +205,18 @@ def find_candidate(spec_ref, catalog, pitch_match=True): def get_part(spec, source, dt, dp): """Apply given delta of tempo and delta of pitch to a stem.""" wav = spec.track[source] - if dt or dp: - wav = repitch(wav, dp, dt * 100, samplerate=SR, voice=source == 3) + if dt != 0 or dp != 0: # Check if there's any change to apply + # Ensure 'dt' is a scalar if it's an array + if isinstance(dt, np.ndarray) and dt.size == 1: + dt = float(dt.item()) # Convert numpy array to Python scalar + # Convert tempo change from relative change (e.g., -0.12 for 88%) to percentage change expected by `repitch` + tempo_percentage_change = dt * 100 # Convert to percentage + # Apply pitch and tempo changes + wav = repitch(wav, dp, tempo_percentage_change, voice=source == 3, samplerate=SR) + # Adjust onsets according to new tempo spec = spec._replace(onsets=spec.onsets / (1 + dt)) return wav, spec - def build_track(ref_index, catalog): """Given the reference track index and a catalog of track, builds a completely new track. One of the source at random from the ref track will