Audio Device

class AudioDevice(playback_device, record_device, playback_channels=None, record_channels=None, sampling_rate=48000, **kwargs)[source]

Bases: PhysicalDevice[PhysicalDeviceState], Serializable

HermesPy binding to an arbitrary audio device. Let’s rock!

Parameters:
  • playback_device (int) – Device over which audio streams are to be transmitted.

  • record_device (int) – Device over which audio streams are to be received.

  • playback_channels (Union[np.ndarray, Iterable], optional) – List of audio channels for signal transmission. By default, the first channel is selected.

  • record_channels (Union[np.ndarray, Iterable], optional) – List of audio channels for signal reception. By default, the first channel is selected.

  • sampling_rate (float, optional) – Configured sampling rate. 48 kHz by default.

state()[source]

Query the immutable physical state of the device.

Returns: The physical device state.

Return type:

PhysicalDeviceState

trigger()[source]

Trigger the device.

Return type:

None

property antennas: AudioDeviceAntennas

Model of the device’s antenna array.

property carrier_frequency: float

Central frequency of the device’s emissions in the RF-band.

Returns:

Carrier frequency in Hz.

Return type:

frequency (float)

Raises:

ValueError – On negative carrier frequencies.

property max_sampling_rate: float

Maximal device sampling rate.

Returns: The samplin rate in Hz.

property playback_channels: Sequence[int]

Audio channels for signal transmission.

Returns: Sequence of audio channel indices.

Raises:

ValueError – On arguments not representing vectors.

property playback_device: int

Device over which audio streams are to be transmitted.

Returns: Device identifier.

Raises:

ValueError – For negative identifiers.

property record_channels: Sequence[int]

Audio channels for signal reception.

Returns: Sequence of audio channel indices.

Raises:

ValueError – On arguments not representing vectors.

property record_device: int

Device over which audio streams are to be received.

Returns: Device identifier.

Raises:

ValueError – For negative identifiers.

property sampling_rate: float

Sampling rate at which the device’s analog-to-digital converters operate.

Returns:

Sampling rate in Hz.

Return type:

sampling_rate (float)

Raises:

ValueError – If the sampling rate is not greater than zero.