Skip to main content

redeflacue

redeflacue splits CUE + FLAC album images without assuming a 44.1 kHz sample rate.

It uses deflacue to parse cue sheets and keeps its command-line interface, output layout, and tag mapping. The difference is in the arguments sent to SoX: cue positions are passed as times instead of sample counts. This avoids misplaced track boundaries on 96 kHz, 192 kHz, and other non-44.1 kHz files.

Install

Install the package with uv or pipx:

uv tool install redeflacue
# or
pipx install redeflacue

SoX is also required:

sudo apt install sox libsox-fmt-all  # Debian / Ubuntu
brew install sox                     # macOS

Usage

# Split .cue files in a directory.
redeflacue /home/me/cues/

# Read Windows-1251 cue sheets recursively and choose an output directory.
redeflacue -e windows-1251 -r -d /mnt/library/ /home/me/cues/

# Print the SoX commands without running them.
redeflacue --dry-run -v /home/me/cues/
Flag Description
-d, --dest DIR Output root; defaults to deflacue/ beside each cue sheet
-e, --encoding ENC Cue-sheet encoding, such as windows-1251
-r, --recursive Search subdirectories
--dry-run Print planned work without running SoX
-v, --verbose Print each SoX command
--version Print the version

Tracks are written to:

<destination>/<performer>/<date - album>/<track number - title>.flac

The cue sheet supplies the track number, title, artist, album, genre, date, ISRC, and description tags.

Sample-rate fix

deflacue stores cue positions as 44.1 kHz sample offsets and passes them to sox trim as sample counts. SoX interprets those counts using the input file's actual sample rate, so boundaries are wrong when that rate is not 44.1 kHz.

A cue position is based on 75 frames per second. Because deflacue uses 588 samples per cue frame (44100 / 75), dividing its stored offset by 44100 recovers the cue time. redeflacue sends that time to SoX as HH:MM:SS.ssssss, which works independently of the input rate.

Python API

from pathlib import Path

from deflacue.parser import CueParser
from redeflacue import build_sox_command, plan_extractions

cue = CueParser.from_file(fpath=Path("album.cue")).run()
for extraction in plan_extractions(cue, Path("."), Path("out")):
    print(
        build_sox_command(
            extraction.src,
            extraction.dst,
            extraction.start_s,
            extraction.end_s,
            extraction.tags,
        )
    )

Development

git clone https://github.com/r8/redeflacue.git
cd redeflacue
uv sync
uv run pytest
uv run ruff check
uv run ruff format --check
uv run mypy src

Integration tests are skipped when SoX is not installed.

License

BSD-3-Clause. Cue-sheet parsing is provided by Igor Starikov's BSD-licensed deflacue.

Metadata

Release files for redeflacue 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for redeflacue 0.1.0
File Size Uploaded
redeflacue-0.1.0.tar.gz 77.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for redeflacue 0.1.0
File Interpreter ABI Platform
redeflacue-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 85.5 kB

Release files / redeflacue-0.1.0.tar.gz

Download URL redeflacue-0.1.0.tar.gz
Size 77.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ad4ec79002c802db49609885a1fe43ea5e6ed1efb365e98fd05e55aacd9115a6
BLAKE2b-256 checksum
How to use checksums
384adf198c73cc02c088a38536b1ca5227e3a273a35ec024d7d411d75248e259
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / redeflacue-0.1.0-py3-none-any.whl

Download URL redeflacue-0.1.0-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f255e3b4adabb56e448a8e10336a8f87eb18d98b6352245c313f45dc3df41a12
BLAKE2b-256 checksum
How to use checksums
fdaf2c607a4669077205ef3feca1ca427ae840ec526190c5276c78c4e032e9e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page