Skip to main content

Audacity .aup3 parser with Rust core and Python interface

Project description

aup-parser

aup-parser is an Audacity .aup3 parser package with a Rust core and typed Python interface.

Highlights

  • Rust core for binary XML and sampleblocks analysis
  • Class-based Python API (AUPParser) with TypedDict return types
  • Optional audio export helper

Package Layout

  • src/: Rust core (PyO3 extension)
  • python/aup_parser/: Python API, types, exports
  • tests/: API/parity tests and golden fixtures

Build (local dev)

cd /Users/joonholee/deeply/aup3-parser
python3 -m pip install --user --break-system-packages maturin
python3 -m maturin build --release -i python3
python3 -m pip install --user --break-system-packages --force-reinstall target/wheels/aup_parser-*.whl

Python API (Class-only)

from aup_parser import AUPParser

parser = AUPParser("tests/test.aup3")
parsed = parser.parse()
raw = parser.inspect_core(profile="full")  # low-level diagnostics payload

AUPParser.parse() signature:

def parse(
    self,
    *,
    audio_output_path: str | pathlib.Path | None = None,
) -> ParseResultTD: ...
  • audio_output_path: None이 아니면 WAV를 export
    • 싱글 채널 프로젝트: audio_output_path를 항상 폴더로 취급하고, 내부에 WAV 1개 생성
    • 싱글 채널 파일명은 원본 오디오 이름(가능하면) 기반으로 결정
    • 멀티 채널 프로젝트: audio_output_path를 폴더로 사용하여 채널별 WAV 파일 생성
    • 멀티 채널 + 파일처럼 보이는 경로(out.wav) 입력 시: 자동으로 out_channels/ 폴더로 정규화
    • 파일명은 항상 track_name 기반으로 생성(트랙명이 없으면 channel_XX)
    • 동일한 트랙명이 여러 개면 _1, _2 suffix를 붙여 충돌 방지
    • 샘플레이트는 wavetrack.rate 우선, 없으면 프로젝트 sample_rate를 사용
    • 타임라인 복원: clip metadata(offset, trimLeft, trimRight)를 우선 적용하고, 불가능한 경우 waveblock.start 기준으로 배치
    • gap 구간은 zero-fill, 겹침 구간은 later block overwrite 규칙 사용

Parse Result

parse()는 항상 full 형식(diagnostics 포함)을 반환합니다:

{
  "schema_version": "2",
  "project": {...},
  "audio": {...},
  "diagnostics": {...},
  "exports": {...}  # optional
}

project fields

Field Type Meaning
project_path str .aup3 절대/정규화 경로
project_file_name str | None .aup3 파일명 (예: session.aup3)
project_file_stem str | None 확장자 제외 파일명 (예: session)
project_extension str 확장자 (기본 aup3)
project_size_bytes int | None 프로젝트 파일 크기
original_audio_file_name str | None 원본 오디오 파일명 추정값 (가능할 때)
original_audio_file_name_source "embedded_name" | "track_name" | "unavailable" 추정 출처

original_audio_file_name 주의:

  • Audacity .aup3는 원본 입력 파일명을 항상 보존하지 않습니다.
  • 따라서 확정값이 아닐 수 있으며, 추정 출처는 original_audio_file_name_source로 확인하세요.

audio fields

Field Type Meaning
sample_rate_hz float | int | str | None 프로젝트 샘플레이트
duration_seconds float | None 전체 재생 길이(초)
total_samples int | None 전체 샘플 수
total_sample_bytes int | None 전체 PCM 바이트 수
channel_indices list[int] 채널 인덱스 목록
channel_count int 채널 개수
track_count int | None wavetrack 개수
clip_count int | None waveclip 개수
block_count int | None sample block 개수
sample_format SampleFormatInfoTD | None 샘플 포맷 정보
tracks list[TrackSummaryTD] 트랙 요약 리스트
clips list[ClipSummaryTD] 클립 요약 리스트
timeline TimelineSummaryTD 블록 사용/누락/미사용 정보
exactness_notes list[str] 정확도 관련 메모

audio.sample_format

Field Type Meaning
raw int Audacity raw sampleformat 정수
sample_width_bytes int 샘플 폭 (바이트)
encoding_id int 인코딩 식별자

audio.tracks[] (TrackSummaryTD)

Field Type Meaning
channel_index int | None 채널 인덱스
name str | None 트랙 이름
clip_count int | None 트랙 내 클립 수
mute bool | None mute 상태
solo bool | None solo 상태
gain float | None 게인
pan float | None
sampleformat_raw int | None 트랙 raw sampleformat

audio.clips[] (ClipSummaryTD)

Field Type Meaning
name str | None 클립 이름
offset_seconds float | None 클립 오프셋(초)
trim_left_seconds float | None 좌측 trim(초)
trim_right_seconds float | None 우측 trim(초)
raw_audio_tempo float | None 원시 템포 메타
stretch_ratio float | None stretch 비율
sample_count int | None 클립 샘플 수
max_block_sample_count int | None 블록 최대 샘플 수

audio.timeline (TimelineSummaryTD)

Field Type Meaning
used_block_ids list[int] 타임라인에서 참조한 block IDs
missing_block_ids list[int] 타임라인엔 있으나 sampleblocks엔 없는 IDs
unused_block_ids list[int] sampleblocks엔 있으나 타임라인에 없는 IDs

diagnostics fields

Field Type Meaning
sqlite dict[str, object] SQLite 개요 정보
project_payload ProjectPayloadTD 파싱된 프로젝트 payload raw
audio_blocks AudioBlocksInfoTD sampleblocks 집계 raw

Exports fields

exports.audio_output 필드:

Field Type Meaning
mode "single_file" | "multi_channel_folder" 출력 모드
requested_output_path str 입력된 경로
output_path str 실제 출력 경로
path_was_normalized bool 경로 정규화 여부
channel_count int 출력 채널 수
files list[AudioOutputFileTD] 출력 파일 목록
sample_rate int export 샘플레이트
sample_width_bytes int export 샘플 폭
sampleformat SampleFormatInfoTD export sampleformat
total_written_audio_bytes int 총 출력 바이트 수
note str 복원/정규화/주의 사항

inspect_core() (Raw)

inspect_core()는 low-level payload를 그대로 반환합니다.

  • 용도: 디버깅, parity 검증, 내부 분석
  • 안정 API 용도는 parse() 사용 권장

Compatibility Notes

  • Python 3.11~3.14
  • abi3-py311 build strategy
  • CI validates install + runtime parse on all combinations:
    • Linux/macOS/Windows
    • Python 3.11, 3.12, 3.13, 3.14
  • Release wheels are built for:
    • Linux (ubuntu-latest)
    • Windows (windows-latest)
    • macOS Apple Silicon (macos-15)
    • macOS Intel (macos-15-intel)
  • If a wheel is unavailable for your environment, pip falls back to sdist build and requires a Rust toolchain.

Release

GitHub Actions workflow (.github/workflows/release.yml) runs:

  1. Matrix tests on PRs
  2. Wheel/sdist build on version tags (v*)
  3. Publish dist/* to GitHub Release assets
  4. Publish dist/* to GitHub Packages (GHCR OCI artifact)
  5. Optional PyPI publish (only when UV_PUBLISH_TOKEN secret is set)

PyPI Token Setup

  1. Create a PyPI API token (__token__) on PyPI account settings.
  2. In GitHub repo settings, add:
    • Settings > Secrets and variables > Actions > New repository secret
    • Name: UV_PUBLISH_TOKEN
    • Value: pypi-... token string
  3. Push a release tag (vX.Y.Z). The publish-pypi job uploads dist/* via:
    • uv publish --trusted-publishing never dist/*

GitHub Distribution

  • Release assets: https://github.com/<owner>/<repo>/releases/tag/vX.Y.Z
  • GitHub Packages (GHCR): ghcr.io/<owner>/aup-parser:vX.Y.Z and ghcr.io/<owner>/aup-parser:X.Y.Z
  • GHCR pull example:
    • oras pull ghcr.io/<owner>/aup-parser:vX.Y.Z
    • pulled wheel/sdist files can then be installed with pip install <wheel-file>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aup_parser-1.0.4.tar.gz (39.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

aup_parser-1.0.4-cp311-abi3-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.11+Windows x86-64

aup_parser-1.0.4-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64

aup_parser-1.0.4-cp311-abi3-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

aup_parser-1.0.4-cp311-abi3-macosx_10_12_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

Details for the file aup_parser-1.0.4.tar.gz.

File metadata

  • Download URL: aup_parser-1.0.4.tar.gz
  • Upload date:
  • Size: 39.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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}

File hashes

Hashes for aup_parser-1.0.4.tar.gz
Algorithm Hash digest
SHA256 63423f192a7a9acae939a84925a192ec256774c8766cde0418701de91f5fa8b8
MD5 481e5c76e549c9be32d9f40e04ed3faf
BLAKE2b-256 ebda5fc1664cd1a8495fc84484429a5f1fad2927e1e36c4726598a3db5c89dec

See more details on using hashes here.

File details

Details for the file aup_parser-1.0.4-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: aup_parser-1.0.4-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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}

File hashes

Hashes for aup_parser-1.0.4-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 420cc6cc0212254ad6f0ae7e2659831b1b79178384b80b56562e87d699a02f32
MD5 86f1f9bcc53ec15a52bb83de74b1fc9f
BLAKE2b-256 64ae7f199025dc565e8f14f0952bb46fb5b6968ee9607ccf61ddb2a77d8eac92

See more details on using hashes here.

File details

Details for the file aup_parser-1.0.4-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: aup_parser-1.0.4-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.11+, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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}

File hashes

Hashes for aup_parser-1.0.4-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e3dadb545f796950757dfa254f714e01879795bc4388c5d3b82efe869c05ba78
MD5 786a2bf20947a7ce71f4dc19a847cb2b
BLAKE2b-256 bad16795ca9671b52c478aaf1db38fe5215f9e343fa05bc2e1e6add073971c7f

See more details on using hashes here.

File details

Details for the file aup_parser-1.0.4-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: aup_parser-1.0.4-cp311-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.11+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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}

File hashes

Hashes for aup_parser-1.0.4-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 585c38afcc2fa75d47b224c4fadaebc90d10a2d31ea0aeef737cbe92ed41c859
MD5 7134e787aab686e656b8fe1f9ee1531f
BLAKE2b-256 181bde7fb5e2371346c379b13dcd9f68e860544506e96417b5b58dc60da83cbe

See more details on using hashes here.

File details

Details for the file aup_parser-1.0.4-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: aup_parser-1.0.4-cp311-abi3-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.11+, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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}

File hashes

Hashes for aup_parser-1.0.4-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9f10b98ff14493997568e1dd48622ae90296fe841906abd2d30195e970b6c43b
MD5 1e8cfb1b4478e7cf37bed706fb917de3
BLAKE2b-256 7f89c61fba01ea366525d3584979897408694b88f174e379d5def7211610edc1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page