Skip to content

Python library based on librosa for finding seamless music loops

License

Notifications You must be signed in to change notification settings

Kexanone/librosa_loopfinder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

librosa_loopfinder

Python library based on librosa for finding seamless music loops

Installation

python3 -m pip install git+https://github.com/Kexanone/librosa_loopfinder.git

Usage Example

import numpy as np
import soundfile as sf
import  librosa
from librosa_loopfinder import find_loop_points

data, sr = librosa.load('input.wav', sr=None)
# Get loop points based on a feature window of 8 seconds and a minimum loop duration of 60 seconds
loop_begin, loop_end, score = find_loop_points(y=data, sr=sr,
    win_length=librosa.time_to_samples(8),
    min_length=librosa.time_to_samples(60)
)[0]
intro = data[:loop_begin]
loop = data[loop_begin:loop_end]
outro = data[loop_end:]
# Run the music loop three times
new_data = np.hstack([intro] + 3*[loop] + [outro])
sf.write('output.wav', new_data, sr)

About

Python library based on librosa for finding seamless music loops

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages