AudioBackend#

class csoundengine.csoundlib.AudioBackend(name, alwaysAvailable=False, needsRealtime=False, platforms=('linux', 'darwin', 'win32'), hasSystemSr=False, longname='', defaultBufferSize=1024, defaultNumBuffers=2, audioDeviceRegex='')[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

Attributes Summary

alwaysAvailable

audioDeviceRegex

defaultBufferSize

defaultNumBuffers

hasSystemSr

longname

needsRealtime

platforms

Methods Summary

audioDevices()

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()

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

alwaysAvailable: bool = False#
audioDeviceRegex: str = ''#
defaultBufferSize: int = 1024#
defaultNumBuffers: int = 2#
hasSystemSr: bool = False#
longname: str = ''#
needsRealtime: bool = False#
platforms: tuple[str, ...] = ('linux', 'darwin', 'win32')#

Methods Documentation

audioDevices()[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()[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