Audio Device¶

Hermes hardware bindings to audio devices offer the option to benchmark complex-valued communication waveforms over affordable consumer-grade audio hardware. The effective available bandwidth is limited to half of the audio devices sampling rate, which is typically either \(44.1~\\mathrm{kHz}\) or \(48~\\mathrm{kHz}\).
- class AudioDevice(playback_device, record_device, playback_channels=None, record_channels=None, sampling_rate=48000.0, oversampling_factor=2, **kwargs)[source]¶
Bases:
PhysicalDevice[PhysicalDeviceState],SerializableHermesPy 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 (
Sequence[int] |None) – List of audio channels for signal transmission. By default, the first channel is selected.record_channels (
Sequence[int] |None) – List of audio channels for signal reception. By default, the first channel is selected.sampling_rate (
float) – Configured sampling rate. 48 kHz by default.oversampling_factor (
int) – Oversampling factor for the internal signal processing. 1 by default.
- classmethod Deserialize(process)[source]¶
Deserialize an object’s state.
Objects cannot be deserialized directly, instead a
Factorymust be instructed to carry out the deserialization process.- Parameters:
process (
DeserializationProcess) – The current stage of the deserialization process. This object is generated by theFactoryand provides an interface to deserialization methods supporting multiple backends.- Return type:
- Returns:
The deserialized object.
- serialize(process)[source]¶
Serialize this object’s state.
Objects cannot be serialized directly, instead a
Factorymust be instructed to carry out the serialization process.- Parameters:
process (
SerializationProcess) – The current stage of the serialization process. This object is generated by theFactoryand provides an interface to serialization methods supporting multiple backends.- Return type:
- state()[source]¶
Query the immutable physical state of the device.
Returns: The physical device state.
- Return type:
- property antennas: AudioDeviceAntennas[source]¶
Model of the device’s antenna array.
- property carrier_frequency: float[source]¶
Central frequency of the device’s emissions in the RF-band.
Denoted by \(f_c\) with unit \(\left[ f_c \right] = \mathrm{Hz} = \tfrac{1}{\mathrm{s}}\) in the literature.
- Raises:
ValueError – On negative carrier frequencies.
- property max_sampling_rate: float[source]¶
Maximal device sampling rate.
Returns: The samplin rate in Hz.
- property oversampling_factor: int[source]¶
Oversampling factor for the internal signal processing.
- Raises:
ValueError – For values smaller than one.
- property playback_channels: Sequence[int][source]¶
Audio channels for signal transmission.
Returns: Sequence of audio channel indices.
- Raises:
ValueError – On arguments not representing vectors.
- property playback_device: int[source]¶
Device over which audio streams are to be transmitted.
Returns: Device identifier.
- Raises:
ValueError – For negative identifiers.
- property record_channels: Sequence[int][source]¶
Audio channels for signal reception.
Returns: Sequence of audio channel indices.
- Raises:
ValueError – On arguments not representing vectors.
- property record_device: int[source]¶
Device over which audio streams are to be received.
Returns: Device identifier.
- Raises:
ValueError – For negative identifiers.
- property sampling_rate: float[source]¶
Sampling rate at which the device’s analog-to-digital converters operate in Hz.
- Raises:
ValueError – If the sampling rate is not greater than zero.
- class AudioAntenna(mode=AntennaMode.DUPLEX, pose=None)[source]¶
Bases:
AntennaAntenna model for audio devices.
- Parameters:
mode (
AntennaMode) – Antenna’s mode of operation. By default, a full duplex antenna is assumed.pose (
Transformation|None) – The antenna’s position and orientation with respect to its array.
- copy()[source]¶
Create a deep copy of the antenna.
- Return type:
- Returns:
A deep copy of the antenna.
- local_characteristics(azimuth, elevation)[source]¶
Generate a single sample of the antenna’s characteristics.
The polarization is characterized by the angle-dependant field vector
\[\begin{split}\mathbf{F}(\phi, \theta) = \begin{pmatrix} F_{\mathrm{H}}(\phi, \theta) \\ F_{\mathrm{V}}(\phi, \theta) \\ \end{pmatrix}\end{split}\]denoting the horizontal and vertical field components. The directional antenna gain can be computed from the polarization vector magnitude
\[\begin{split}A(\phi, \theta) &= \lVert \mathbf{F}(\phi, \theta) \rVert \\ &= \sqrt{ F_{\mathrm{H}}(\phi, \theta)^2 + F_{\mathrm{V}}(\phi, \theta)^2 }\end{split}\]- Parameters:
azimuth (
float) – Considered horizontal wave angle in radians \(\phi\).elevation – Considered vertical wave angle in radians \(\theta\).
- Return type:
- Returns:
Two dimensional numpy array denoting the horizontal and vertical ploarization components of the antenna response vector.
- class AudioDeviceAntennas(device)[source]¶
Bases:
AntennaArray[AudioAntenna]Antenna array information for audio devices.
- Parameters:
device (
AudioDevice) – The audio device to which the antenna array belongs.
- property antennas: list[AudioAntenna][source]¶
All individual antenna elements within this array.
- property num_transmit_antennas: int[source]¶
Number of transmitting antenna elements within this array.
- property receive_antennas: list[AudioAntenna][source]¶
Receiving antennas within this array.
- property transmit_antennas: list[AudioAntenna][source]¶
Transmitting antennas within this array.