Skip to content

JACK via PortAudio #1

@mgeier

Description

@mgeier

This is a reaction to the statement in the README:

PyAudio offers a binding for the old good PortAudio, it works everywhere but is quite low-level and if you are using Jack can be painful (ok, it is supported, but I was not able to create a client, nor to find working code by someone else).

The problem with PortAudio (at least the version I'm currently using, probably this will be improved in future versions) is that JACK is never the default host API, even if jackd is running (and blocking all other host APIs).

This is inconvenient, but it is still possible to select JACK via its device ID. With PyAudio this can be done with the arguments input_device_index and output_device_index.

I didn't like the API of PyAudio, so I created my own: python-sounddevice (which is based on PySoundCard). Using that, I tried to come up with a way to select JACK's main device, but I must confess that it's still not very nice:

import sounddevice as sd

try:
    device, = (x[0] for x in enumerate(sd.query_devices()) if x[1]['name'] == 'system')
except ValueError:
    device = None

Probably this can be improved once spatialaudio/python-sounddevice#2 is done ...

If you have some other suggestions, I'd be happy to include them in the sounddevice module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions