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

Audio Stream device names are not exposed in documentation and missing device error message is not user friendly. #380

Open
djangohenk opened this issue Nov 4, 2024 · 4 comments

Comments

@djangohenk
Copy link

Hi,

I'm trying to use Pedalboard with a live audio stream, following the example provided in the documentation (version 0.9.16) titled "Running Pedalboard on Live Audio." However, I keep running into issues with specifying input_device_name and output_device_name.

My computer is running Ubuntu 22.04, and I’m using a Focusrite Scarlett 2i2 4th Gen as the USB audio device. When I run $ python3 -m sounddevice, I get the following information for the device:

'5 Scarlett 2i2 4th Gen: USB Audio (hw:3,0), ALSA (4 in, 2 out)'

No matter what I try as the input and output device names, I keep getting an error like:
ValueError: No such device: hw:3,0

Any help would be greatly appreciated.

Kind regards,
Henk

@psobot
Copy link
Member

psobot commented Nov 4, 2024

Hi @djangohenk!

What comes up when you run the following line?

print(AudioStream.input_device_names)

@djangohenk
Copy link
Author

Hi @psobot

This is the output
['JACK Audio Connection Kit', 'HD-Audio Generic; USB Stream Output (1)', 'Logitech BRIO, USB Audio; Direct hardware device without any conversions', 'Logitech BRIO, USB Audio; Direct sample snooping device', 'Logitech BRIO; USB Stream Output', 'HD-Audio Generic, ALC897 Analog; Direct hardware device without any conversions', 'HD-Audio Generic, ALC897 Analog; Direct sample snooping device', 'HD-Audio Generic; USB Stream Output (2)', 'Scarlett 2i2 4th Gen, USB Audio; Direct hardware device without any conversions', 'Scarlett 2i2 4th Gen, USB Audio; Direct sample snooping device', 'Scarlett 2i2 4th Gen; USB Stream Output']

@psobot
Copy link
Member

psobot commented Nov 4, 2024

Looks like you should be able to do:

scarlett = 'Scarlett 2i2 4th Gen, USB Audio; Direct hardware device without any conversions'

with AudioStream(scarlett, scarlett) as stream:
    # do stuff with `stream` here!

Let me know if that doesn't work; the error message could be improved on our end to show potential matches instead of just saying No such device, and it seems like the device name parsing may be broken for device names that contain parentheses or semicolons.

@djangohenk
Copy link
Author

@psobot
That's it!!
I didn't expect that I would have to use such a long string as an ID.
Thank you for your quick help.
Kind regards,
Henk

@psobot psobot changed the title Unable to address USB sound device Audio Stream device names are not exposed in documentation and missing device error message is not user friendly. Nov 6, 2024
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

2 participants