AudioBackend#

class csoundengine.csoundlib.AudioBackend(name, alwaysAvailable=False, needsRealtime=False, platforms=('linux', 'darwin', 'win32'), hasSystemSr=False, longname='', defaultBufferSize=1024, defaultNumBuffers=2, audioDeviceRegex='', acceptsDeviceIndex=True, priority=0)[source]#

Bases: object

Holds information about a csound audio backend

name#

the name of this backend

alwaysAvailable#

is this backend always available?

hasSystemSr#

does this backend have a system samplerate?

needsRealtime#

the backend needs to be run in realtime

platforms#

a list of platform for which this backend is available

longname#

an alternative name for the backend

defaultBufferSize#

the default buffer size for this backend (-b)

defaultNumBuffers#

the number of buffers to fill a block (determines -B)

audioDeviceRegex#

a regex to grep the audio devices from csound’s output

acceptsDeviceIndex#

can this backend accept a device in the form -dac0 or -adc1?

Attributes Summary

Methods Summary

audioDevices()

audioDevicesViaAPI([opcodedir])

Query csound for audio devices for this backend

bufferSizeAndNum()

The buffer size and number of buffers needed for this backend

defaultAudioDevices()

Returns the default audio devices for this backend

getSystemSr([opcodedir])

Get the system samplerate for this backend, if available

isAvailable()

Is this backend available?

searchAudioDevice(pattern, kind)

Search a certain audio device from the devices presented by this backend

Attributes Documentation

acceptsDeviceIndex: bool = True#
alwaysAvailable: bool = False#
audioDeviceRegex: str = ''#
defaultBufferSize: int = 1024#
defaultNumBuffers: int = 2#
hasSystemSr: bool = False#
longname: str = ''#
name: str = <dataclasses._MISSING_TYPE object>#
needsRealtime: bool = False#
platforms: tuple[str, ...] = ('linux', 'darwin', 'win32')#
priority: int = 0#

Methods Documentation

audioDevices()[source]#
Return type:

tuple[list[AudioDevice], list[AudioDevice]]

audioDevicesViaAPI(opcodedir='')[source]#

Query csound for audio devices for this backend

Returns:

list[AudioDevice], outputDevices: list[AudioDevice])

Return type:

a tuple (inputDevices

bufferSizeAndNum()[source]#

The buffer size and number of buffers needed for this backend

Return type:

tuple[int, int]

defaultAudioDevices()[source]#

Returns the default audio devices for this backend

Return type:

tuple[AudioDevice | None, AudioDevice | None]

Returns:

a tuple (inputDevice: AudioDevice, outputDevice: AudioDevice) for this backend

getSystemSr(opcodedir='')[source]#

Get the system samplerate for this backend, if available

We use the default output device.

Return type:

int | None

isAvailable()[source]#

Is this backend available?

Return type:

bool

searchAudioDevice(pattern, kind)[source]#

Search a certain audio device from the devices presented by this backend

Return type:

AudioDevice | None