Add AC3 RF audio decoding via ac3rf Python extension#1034
Merged
Conversation
Remove ac3_pipe from utils.py (referenced sox/ld-ac3-demodulate/ld-ac3-decode which no longer exist) and the unused bandpass filter setup in RFDecode. Replace AC3filter with AC3demodulate, which uses the ac3rf Python extension (built from ac3rf-decode with BUILD_PYTHON=ON) to demodulate raw ADC samples directly into QPSK symbols. Output goes to a .ac3sym file, analogous to .efm containing EFM T-values. Per-field symbol counts are recorded in the field_record table (as ac3_symbols) for use by downstream decoders (decode-orc). Overlap deduplication prevents re-processing samples shared between consecutive fields.
Add ldaudio (contains ac3rf-decode) and nanobind-src as flake inputs. Build ac3rf as a Python extension module (BUILD_PYTHON=ON) using CMake with nanobind supplied via FETCHCONTENT_SOURCE_DIR so the Nix sandbox can build without network access. The extension is added to propagatedBuildInputs so it is automatically on PYTHONPATH for nix run and nix develop. ldaudio is publicly readable over HTTPS so no special access is needed.
Owner
|
Sorry I didn't notice this for so long! |
Contributor
Author
|
No problem! Glad you merged it and hope it works! |
simoninns
added a commit
that referenced
this pull request
May 24, 2026
Revert "Merge pull request #1034 from staffanu/ac3rf-decode"
Collaborator
|
This PR caused CI/CD failure and had to be reverted - it will need to be resubmitted against the current commit for inclusion (I put the cause in the notes of the PR to revert). On a related note, this PR was pulling in a nix build from a remote repo (a nix submodule) which had a different nix package base (unstable rather than 25.11) - The architecture of this would be a lot better if it followed the EFM implementation and kept the demod within ld-decode's python base rather than coupling it externally. @happycube 's call really - but I don't think the AC3 demod in a remote flake is a strong approach imho |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LaserDisc discs containing Dolby AC3 audio encode the audio as a QPSK-modulated
signal at 2.88 MHz on the video carrier. This PR adds support for demodulating
that signal and writing the raw QPSK symbols to an
.ac3symfile, analogous tohow EFM T-values are written to
.efm.ac3_pipe,AC3filter) which referencedld-ac3-demodulate/ld-ac3-decodeexecutables that no longer existAC3demodulate()using theac3rfPython extension(built from ldaudio/ac3rf-decode,
publicly readable over HTTPS)
--ac3is passed, ld-decode writes a.ac3symfile containing raw QPSKdibits (1 byte/symbol) and records the per-field symbol count in the
.tbcDBas
ac3_symbolsac3rfPython extension from a pinned commit of theldaudio repo (which pulls in the
firpmsubmodule via?submodules=1);nanobindis pre-fetched as a flake input so the build requires no networkaccess inside the Nix sandbox
The
.ac3symoutput is intended to be consumed by a downstream decoder toproduce a final
.ac3bitstream. The per-field symbol counts stored in the DBallow the downstream tool to reconstruct per-field byte offsets into the file.