Audio Device Binding#

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 AudioAntenna(pose=None)#

Bases: Antenna

Antenna model for audio devices.

Parameters:

pose (Transformation, optional) – The antenna’s position and orientation with respect to its array.

local_characteristics(azimuth, elevation)#

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 (float) – Considered vertical wave angle in radians \(\theta\).

Return type:

ndarray

Returns:

Two dimensional numpy array denoting the horizontal and vertical ploarization components of the antenna response vector.

class AudioDeviceAntennas(device)#

Bases: AntennaArrayBase

Antenna array information for audio devices.

Parameters:

pose (Transformation, optional) – Transformation of the transformable with respect to its reference frame. By default, no transformation is considered, i.e. Transformation.No()

property num_antennas: int#

Number of antenna elements within this array.

Returns:

Number of antenna elements.

Return type:

int

property antennas: List[Antenna]#

All individual antenna elements within this array.

Returns: List of antennas.

class AudioDevice(playback_device, record_device, playback_channels=None, record_channels=None, sampling_rate=48000, **kwargs)#

Bases: PhysicalDevice, 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.

yaml_tag: Optional[str] = 'AudioDevice'#

YAML serialization tag.

property_blacklist: Set[str] = {'antennas', 'orientation', 'position', 'random_mother', 'topology', 'velocity', 'wavelength'}#

Set of properties to be ignored during serialization.

property playback_device: int#

Device over which audio streams are to be transmitted.

Returns: Device identifier.

Raises:

ValueError – For negative identifiers.

property record_device: int#

Device over which audio streams are to be received.

Returns: Device identifier.

Raises:

ValueError – For negative identifiers.

property playback_channels: Sequence[int]#

Audio channels for signal transmission.

Returns: Sequence of audio channel indices.

Raises:

ValueError – On arguments not representing vectors.

property record_channels: Sequence[int]#

Audio channels for signal reception.

Returns: Sequence of audio channel indices.

Raises:

ValueError – On arguments not representing vectors.

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 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.

property max_sampling_rate: float#

Maximal device sampling rate.

Returns: The samplin rate in Hz.

trigger()#

Trigger the device.

Return type:

None