Automatically find loop points of any song and play endlessly or export into intro/loop/outro sections or loop points.
Project description
PyMusicLooper
A script for repeating music seamlessly and endlessly.
Features:
- Find loop points within any music file (if they exist)
- Export to intro/loop/outro sections for editing or seamless playback within any music player that supports gapless playback
- Export loop points in samples for use in creating themes with looped audio
Installation
Requires Python >=3.6 to run. This program depends on NumPy (arrays and mathematical operations) and Librosa (audio analysis and beat extraction). If you don't have these dependencies installed, you'll automatically download them (but keep in mind it might take a while depending on your internet connection):
pip install git+https://github.com/sysnoble/PyMusicLooper.git
To play music endlessly through the terminal, the external library mpg123
is required. Available through the following link: https://www.mpg123.de/download.shtml
Usage
usage: python -m pymusiclooper [-h] [-p] [-e] [-j]
[-m MIN_DURATION_MULTIPLIER] [--skip-cache]
[--purge-cache]
[path]
Automatically find loop points in music files and play/export them.
positional arguments:
path path to music file.
optional arguments:
-h, --help show this help message and exit
-p, --play play the song on repeat with the best discovered loop
point (default).
-e, --export export the song into intro, loop and outro files (WAV
format).
-j, --json export the loop points (in samples) to a JSON file in
the song's directory.
-m MIN_DURATION_MULTIPLIER, --min-duration-multiplier MIN_DURATION_MULTIPLIER
specify minimum loop duration as a multiplier of song
duration (default: 0.35); use with --skip-cache.
--skip-cache skip loading cached loop points.
--purge-cache purges all cached loop points and exits.
PyMusicLooper will find the best loop point it can detect, and will then, depending on your arguments:
(a) play the song on repeat (default, requires mpg123);
(b) export to intro/loop/outro sections (currently outputs as WAV-only, although you may convert with ffmpeg or Audacity);
(c) export the loop points (in samples) to a JSON file, which you can use for audio loops in theme creation, etc..
Example Usage
Note: If on Windows, you can Shift+Right-Click in an empty spot in the song's folder and choose command-line/powershell from the context menu. Otherwise, cd/dir to the folder.
Play the song on repeat with the best discovered loop point.
python -m pymusiclooper track.mp3
Export the song into intro, loop and outro files as well as the loop points used (outputs in the same directory/folder as the track).
python -m pymusiclooper -ej track.mp3
Building from source
Requried python packages: pip and setuptools.
Clone the git repository somewhere and cd to inside the repo.
Run:
python setup.py build
Followed by:
python setup.py install
Contribution
If there is a song that you think PyMusicLooper should be able to loop but doesn't, please feel free to open an issue with a link to that song and mention the approximate timestamp at which it loops. Forks and pull requests are of course welcome.
Acknowledgements
This project started out as a fork of Nolan Nicholson's project Looper. Although at this point only a few lines of code remain from that project due to adopting a completely different approach and implementation, without their contributions this project would not have been possible.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file pymusiclooper-1.0.4-py3.7.egg
.
File metadata
- Download URL: pymusiclooper-1.0.4-py3.7.egg
- Upload date:
- Size: 18.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a44bd9269abfc543dc61778674562198a955a1fce7b6eda9773b59998363b04 |
|
MD5 | 8f969228a6df01df760c173e707dd510 |
|
BLAKE2b-256 | 1561d907c03a5d14d93ebcbb8f0180604557d72a62ea99a43c7553c7c7c8862c |