Skip to content

Add multichannel audio tests and example (stereo, 5.1, 7.1)#150

Open
alexeymohr wants to merge 1 commit into
markreidvfx:mainfrom
alexeymohr:add-multichannel-audio-tests
Open

Add multichannel audio tests and example (stereo, 5.1, 7.1)#150
alexeymohr wants to merge 1 commit into
markreidvfx:mainfrom
alexeymohr:add-multichannel-audio-tests

Conversation

@alexeymohr

Copy link
Copy Markdown

Summary

  • Add tests/test_multichannel.py — write/read round-trip tests for stereo (2ch), 5.1 (6ch), and 7.1 (8ch) multichannel audio tracks using the Audio Channel Combiner OperationGroup pattern
  • Add examples/multichannel_audio.py — standalone example script showing how to create multichannel AAFs that Pro Tools imports as native multichannel tracks
  • No changes to existing library code

Background

Pro Tools represents multichannel audio clips using an "Audio Channel Combiner" OperationGroup (6b46dd7a-132d-4856-ab21-8b751d8462ec). Each multichannel track has one composition slot containing a Sequence of OperationGroups. Each OperationGroup wraps N mono SourceClips (one per channel), and each channel has its own independent mob chain: MasterMob → SourceMob (PCMDescriptor, mono) → SourceMob (TapeDescriptor).

A _TRACK_FORMAT tagged value on the TimelineMobSlot indicates the channel layout:

  • 2 = stereo (2 InputSegments: L, R)
  • 3 = 5.1 surround (6 InputSegments: L, C, R, Ls, Rs, LFE)
  • 4 = 7.1 surround (8 InputSegments: L, C, R, Lss, Rss, Lsr, Rsr, LFE)

This is the same OperationDef, same parameters, and same structure for all three formats — only the number of InputSegments and the _TRACK_FORMAT value differ.

This pattern was discovered by analyzing Pro Tools AAF exports created with "Enforce Media Composer Compatibility" and "Export stereo, 5.1 and 7.1 tracks as multi-channel" enabled.

Notes

  • The OperationDef uses NumberInputs=1 despite having 2, 6, or 8 actual InputSegments. This matches Pro Tools' own exports. The existing test_transitions.py already registers the same AvidParameterByteOrder and AvidEffectID ParameterDefs used here.
  • Tests generate PCM audio in pure Python (no ffmpeg dependency).
  • All generated AAFs have been verified to import correctly in Pro Tools as native multichannel tracks with working audio, handles, and timecode.

Test plan

  • python -m unittest tests.test_multichannel -v — all 4 tests pass
  • Existing tests unaffected (test_tagged_value, test_dictionary still pass)
  • python examples/multichannel_audio.py runs and produces valid AAFs
  • Generated AAFs import into Pro Tools as native stereo, 5.1, and 7.1 tracks

Relates to #145, #102, #93.

🤖 Generated with Claude Code

Add tests and an example demonstrating how to create AAF files with
multichannel audio tracks that Pro Tools recognizes as native stereo,
5.1, and 7.1 tracks.

Pro Tools uses an "Audio Channel Combiner" OperationGroup to represent
multichannel clips. Each channel gets its own mono mob chain
(MasterMob -> SourceMob with PCMDescriptor -> TapeDescriptor SourceMob),
and the OperationGroup wraps N SourceClip inputs together. A
_TRACK_FORMAT tagged value on the TimelineMobSlot indicates the layout
(2=stereo, 3=5.1, 4=7.1).

The pattern was discovered by analyzing Pro Tools AAF exports and has
been verified to round-trip through both pyaaf2 and Pro Tools.

Relates to markreidvfx#145, markreidvfx#102, markreidvfx#93.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant