SoundDeviceSamplesGenerator#

class acoular.sdinput.SoundDeviceSamplesGenerator(*args, **kwargs)

Bases: SamplesGenerator

Controller for sound card hardware using sounddevice library.

Uses the device with index device to read samples from input stream, generates output stream via the generator result().

device

input device index, refers to sounddevice list

num_channels

Number of input channels, maximum depends on device

num_samples

Number of signal samples

collect_samples

Indicates if samples are collected, helper trait to break result loop

sample_freq

Sampling frequency of the signal, changes with sinusdevices

precision

Datatype (resolution) of the signal, used as dtype in a sd Stream object

overflow

Indicates that the sounddevice buffer has overflown

running

Indicates that the stream is collecting samples

stream

The sounddevice InputStream object for inspection

digest

A unique identifier for the generator, based on its properties. (read-only)

device_properties()

Display the properties of the sounddevice input device.

Returns:
Dictionary of device properties according to sounddevice
result(num)

Python generator that yields the output block-wise.

Use at least a block-size of one ring cache block.

Parameters:
numinteger

This parameter defines the size of the blocks to be yielded (i.e. the number of samples per block).

Returns:
Samples in blocks of shape (num, num_channels).

The last block may be shorter than num.