Python 可无限循环播放音乐并创建无缝音乐循环的程序,支持播放、导出和标记。
A python-based program for repeating music seamlessly and endlessly, by automatically finding the best loop points.
Features:
The following software must be installed for pymusiclooper to function correctly.
Supported audio formats without ffmpeg include: WAV, FLAC, Ogg/Vorbis, Ogg/Opus, MP3. A full list can be found at libsndfile's supported formats page
Additionally, to use the play command on Linux systems, you may need to
install the PortAudio library. On Ubuntu, run sudo apt install libportaudio2.
This method of installation is strongly recommended, as it isolates PyMusicLooper's dependencies from the rest of your environment, and as a result, avoids dependency conflicts and breakage due to other packages.
Required tool: uv.
Note: python is not required, as uv automatically installs this package's required python version automatically if not present.
# Normal install
# (follows the official releases on https://pypi.org/project/pymusiclooper/)
uv tool install pymusiclooper
# Alternative install
# (follows the git repository; equivalent to a nightly release channel)
uv tool install git+https://github.com/arkrow/PyMusicLooper.git
# Updating to new releases in either case can be done simply using:
uv tool upgrade pymusiclooperInstallation note: you may need to specify a Python version if the latest Python release is not supported and fails to install, e.g.
uv tool install pymusiclooper --python "3.12"Like uv, isolates PyMusicLooper's dependencies from the rest of your environment,
and as a result, avoids dependency conflicts and breakage due to other packages.
However, unlike uv, requires python to already be installed along with pipx.
Required python packages: pipx (can be installed using pip install pipx ).
# Normal install
# (follows the official releases on https://pypi.org/project/pymusiclooper/)
pipx install pymusiclooper
# Alternative install
# (follows the git repository; equivalent to a nightly release channel)
pipx install git+https://github.com/arkrow/PyMusicLooper.git
# Updating to new releases in either case can be done simply using:
pipx upgrade pymusiclooperTraditional package installation method.
Note: fragile compared to an installation using uv or pipx. PyMusicLooper may suddenly stop working if its dependencies were overwritten by another package (e.g. issue #12).
pip install pymusiclooperNote: further help and options can be found in each subcommand's help message (e.g. pymusiclooper export-points --help);
all commands and their --help message can be seen in CLI_README.md
Note: using the interactive -i option is highly recommended, since the automatically chosen "best" loop point may not necessarily be the best one perceptually. As such, it is shown in all the examples. Can be disabled if the -i flag is omitted. Interactive mode is also available when batch processing.
# Play the song on repeat with the best discovered loop point.
pymusiclooper -i play --path "TRACK_NAME.mp3"
# Audio can also be loaded from any stream supported by yt-dlp, e.g. youtube
# (also available for the `tag` and `split-audio` subcommands)
pymusiclooper -i play --url "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
# Reads the loop metadata tags from an audio file and play it with the loop active
# using the loop start and end specified in the file (must be stored as samples)
pymusiclooper play-tagged --path "TRACK_NAME.mp3" --tag-names LOOP_START LOOP_ENDNote: batch processing is available for all export subcommands. Simply specify a directory instead of a file as the path to be used.
……By default, the minimum loop duration is 35% of the track length (excluding trailing silence), and the maximum is unbounded. Alternative constraints can be specified using the options below.
# If the loop is very long (or very short), a different minimum loop duration can be specified.
## --min-duration-multiplier 0.85 implies that the loop is at least 85% of the track,
## excluding trailing silence.
pymusiclooper -i split-audio --path "TRACK_NAME.flac" --min-duration-multiplier 0.85
# Alternatively, the loop length constraints can be specified in seconds
pymusiclooper -i split-audio --path "TRACK_NAME.flac" --min-loop-duration 120 --max-loop-duration 150# If a desired loop point is already known, and you would like to extract the best loop
# positions in samples, the `--approx-loop-position` option can be used,
# which searches with +/- 2 seconds of the point specified.
# Best used interactively. Example using the `export-points` subcommand:
pymusiclooper -i export-points --path "/path/to/track.mp3" --approx-loop-position 20 210
## `--approx-loop-position 20 210` means the desired loop point starts around 20 seconds
## and loops back around the 210 seconds mark.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; this project would not have been possible without their initial contribution.
Available at CHANGELOG.md
暂无开放 Issues,或尚未同步最近议题。