belangeo / pyo

Python DSP module
GNU Lesser General Public License v3.0
1.31k stars 131 forks source link

pa_list_devices() return instead of print #228

Closed dcardonab closed 2 years ago

dcardonab commented 2 years ago

Hi! First of all, thank you for Pyo, it's awesome and I have been having a blast learning how to use it.

I do have one quick question. Is it possible to get the list that is printed out when running pa_list_devices() returned onto a variable? This is so that I can iterate through it looking for a substring to automate connecting to a specific device. When I try any kind of assignment, the variable remains empty (i.e., available_devices = pa_list_devices()), and according to the Ajax Sound Studio documentation, the function "Prints a list of all devices found by Portaudio".

Thanks in advance!

belangeo commented 2 years ago

Hi David,

You can use pa_get_input_devices() and pa_get_output_devices() to build audio device selectors:

http://ajaxsoundstudio.com/pyodoc/api/functions/audio.html#pa-get-input-devices

Olivier

On Sat, Dec 11, 2021 at 3:01 PM David Cardona @.***> wrote:

Hi! First of all, thank you for Pyo, it's awesome and I have been having a blast learning how to use it.

I do have one quick question. Is it possible to get the list that is printed out when running pa_list_devices() returned onto a variable? This is so that I can iterate through it looking for a substring to automate connecting to a specific device. When I try any kind of assignment, the variable remains empty (i.e., available_devices = pa_list_devices()), and according to the Ajax Sound Studio documentation, the function "Prints a list of all devices found by Portaudio".

Thanks in advance!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/belangeo/pyo/issues/228, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXKJTD6KVNX3SAJPXQNOX3UQOUZXANCNFSM5J3LUYGQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

dcardonab commented 2 years ago

Thank you very much! Also, thanks for the prompt answer. This is exactly what I needed. :)

~David