signalflow icon indicating copy to clipboard operation
signalflow copied to clipboard

Support multiple AudioIn channels, honour input_device_name

Open jarmitage opened this issue 1 year ago • 4 comments

https://github.com/ideoforms/signalflow/blob/af49b099675be2bc8de04815a5416fc3fe3790a8/source/src/node/io/input/abstract.cpp#L10

jarmitage avatar May 23 '24 14:05 jarmitage

Funnily enough, you raised this at the precise moment that I also need this feature so I'm working on this as I speak. Should be done later today!

ideoforms avatar May 23 '24 15:05 ideoforms

OK, I looked at this and unforunately it's a larger refactor than I have time to do right now as i'm on a project deadline. However! You can achieve the same effect with a workaround, which is what I'm doing:

# read the full multichannel input here
all_input_channels = AudioIn(8)
# then use the subscript operator to select individual mono channels
first_channel = all_input_channels[0]
second_channel = all_input_channels[1]

I'll leave this issue open to remind me to fix it properly at some point...

ideoforms avatar May 24 '24 14:05 ideoforms

I can't get all_input_channels = AudioIn(8) to work:

python signalflow-examples/audio-through-example.py
Output device: BlackHole 64ch (44100Hz, buffer size 4096 samples, 24 channels)
Traceback (most recent call last):
  File "../signalflow-examples/audio-through-example.py", line 34, in <module>
    main()
  File "../signalflow-examples/audio-through-example.py", line 21, in main
    audio_in = AudioIn(8)
               ^^^^^^^^^^
signalflow.AudioIOException: AudioIn: Not enough input channels available (requested 8, available 1)
[1]    35077 segmentation fault  python signalflow-examples/audio-through-example.py

jarmitage avatar May 25 '24 15:05 jarmitage

Hmm, this would happen if the audio input device of SignalFlow has fewer than 8 channels. If you set your system's default input device to (say) BlackHole 64ch, this should resolve the issue.

In investigating this, I've also found that input_device_name is not honoured in .signalflow/config (or SIGNALFLOW_INPUT_BUFFER_SIZE), which should be addressed in the same fix as for the wider AudioIn issue.

ideoforms avatar Jun 20 '24 21:06 ideoforms