Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for more than two channels #97

Open
piotr-czarnecki opened this issue Apr 11, 2022 · 7 comments
Open

support for more than two channels #97

piotr-czarnecki opened this issue Apr 11, 2022 · 7 comments

Comments

@piotr-czarnecki
Copy link

piotr-czarnecki commented Apr 11, 2022

hi,
is it a way to add support for more than two channels. I am working with VSTs for ambisonic (at least 4 input/output channels, up to 64).

from pedalboard import Pedalboard, load_plugin
from pedalboard.io import AudioFile
import numpy as np

se = load_plugin("/.vst3/IEM/MultiEncoder.vst3") # vst3 plugins from https://plugins.iem.at/
se.ambisonics_order = '1st' # means 4 channels required for output
se.number_of_input_channels = 4  # as input pligin takes 4 audio tracks, and return 4 output channels - ambisonic actually

audio4 = np.zeros((4, 10000))
board = Pedalboard([se])
effected = board(audio4, 48100)

The error I got is:

RuntimeError: More than two channels received!

ps. plugin I use actually works fine with the reaper DAW (https://www.reaper.fm/) on my side.

@piotr-czarnecki
Copy link
Author

is it a way that this VST plugin just does not cooperate well with pedalboard, or pedaboard does not support for more than two channels?

@psobot
Copy link
Member

psobot commented Apr 11, 2022

Hi! Pedalboard currently doesn't support more than two channels (although this could be changed by changing/removing these two lines of code).

You mention that these plugins support up to 64 channels; would that be a good maximum? (I think a maximum would still be needed, as Pedalboard uses heuristics to guess which dimension of the input array is the channels and which is the samples.)

@piotr-czarnecki
Copy link
Author

in practical ambisonics, 64 seems the upper limit, e.g. in the Reaper (https://www.reaper.fm/) the common used DAW for mixing audio supporting also ambisonics, 64 channels is the limit, also this corresponds to 7th order ambisonic - implemented as max order in widely used ambisonics plugins: IEM (https://plugins.iem.at/), also SPARTA (https://leomccormack.github.io/sparta-site/).

@piotr-czarnecki
Copy link
Author

piotr-czarnecki commented Apr 12, 2022

do you suggest that if I modify those two lines of code and rebuild, than all will just work?
how input/output number of channels will be set? would not that be a problem?

is there some installation guide how to use pedalboard directly from source?

@psobot
Copy link
Member

psobot commented Apr 12, 2022

It might, yes! The tests are pretty comprehensive, so you should also be able to run tox to find out if your changes broke anything.

The number of input/output channels is currently set by looking at the shape of the input array, picking the smaller of the two dimensions, and assuming that the smaller dimension is the number of channels.

See CONTRIBUTING.md for build instructions on macOS or Linux. (I've heard anecdotally that the ccache example command doesn't work on Linux, but you should be able to compile without ccache, just a bit more slowly.) If this does work, feel free to open a pull request and I'd be happy to review and merge the code.

@auroracramer
Copy link

auroracramer commented Jun 30, 2022

Just for anyone else interested in this, confirming I was able to build pedalboard on Ubuntu 18.04 LTS with the proposed changes, pass the tox tests (after modifying the test for LAME to be Python 3 compatible and fixs to pass the flake8 lint tests), and successfully load and use the IEM plugins.

kleblackford added a commit to kleblackford/pedalboard that referenced this issue Jul 10, 2023
Implementation of the changes described in spotify#97.
@adrianSRoman
Copy link

Hi all,

I was reading this thread for a similar issue I have while trying to run the SPARTA VST suite: https://leomccormack.github.io/sparta-site/

I removed the two lines of code mentioned by @psobot, but it looks like for "external" plugins the code that handles the VST loading only support 2 channels input and 2 channels output. See

throw std::invalid_argument(

I would greatly appreciate it if anyone has any suggestions or fixes on this.

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

No branches or pull requests

4 participants