Skip to content

Add MonoToMulti plugin wrapper for per-channel processing#487

Open
codyjhsieh wants to merge 1 commit into
spotify:masterfrom
codyjhsieh:add-mono-to-multi-wrapper
Open

Add MonoToMulti plugin wrapper for per-channel processing#487
codyjhsieh wants to merge 1 commit into
spotify:masterfrom
codyjhsieh:add-mono-to-multi-wrapper

Conversation

@codyjhsieh
Copy link
Copy Markdown

@codyjhsieh codyjhsieh commented May 26, 2026

Problem

Pedalboard has ForceMono<T> for mixing multichannel audio down to mono before processing, but no inverse — a wrapper that takes a mono-only plugin and runs it independently on each channel of a multichannel signal. This was noted as a TODO in FixedBlockSize.h:254, added in #76.

Solution

Add MonoToMulti<T> template in plugin_templates/MonoToMulti.h. It allocates one instance of the wrapped plugin per channel using unique_ptr (plugins are non-copyable due to std::mutex), prepares each with a mono ProcessSpec, and processes each channel through its own instance. Includes a test plugin registered in _internal.

Result

Mono plugins can now be used in stereo or multichannel contexts without cross-channel interference. ForceMono (mixdown) and MonoToMulti (fan-out) are now complementary wrappers. The TODO is resolved.

Problem

Pedalboard has ForceMono for mixing multichannel audio down to mono
before processing, but no inverse — a wrapper that takes a mono-only
plugin and runs it independently on each channel of a multichannel
signal. This was noted as a TODO in FixedBlockSize.h:254.

Solution

Add MonoToMulti<T> template in plugin_templates/MonoToMulti.h. It
allocates one instance of the wrapped plugin per channel using
unique_ptr (plugins are non-copyable due to std::mutex), prepares
each with a mono ProcessSpec, and processes each channel through its
own instance. Includes a test plugin registered in _internal.

Result

Mono plugins can now be used in stereo or multichannel contexts
without cross-channel interference. The TODO is resolved. ForceMono
(mixdown) and MonoToMulti (fan-out) are now complementary wrappers.
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