audiblelight.micarrays.MicArray#

class audiblelight.micarrays.MicArray(name='', is_spherical=False, channel_layout_type='mono')#

Bases: object

This is the base class for all microphone array types.

Parameters:
  • name (str)

  • is_spherical (bool)

  • channel_layout_type (str)

name#

the name of the array.

Type:

str

is_spherical#

whether the array is spherical. If False, positions_spherical will be None.

Type:

bool

channel_layout_type#

the expected channel layout for each capsule. If “mono” (default), one channel will be created for every capsule. If “foa”, four channels will be created per capsule.

Type:

str

Properties:
coordinates_polar (np.array): the positions of the capsules on the array, given as azimuth, elevation, radius.

Azimuth is measured counter-clockwise in degrees between 0 and 360, where 0 == the front of the microphone. Elevation is measured between -90 and 90 degrees, where 0 == “straight ahead”, 90 == “up”, -90 == “down”. Radius is measured in meters away from the center of the array. Note that, when is_spherical is False, this property will be None.

coordinates_cartesian (np.array): the positions of the capsules in Cartesian (XYZ) coordinates, with distance

measured using meters away from the center of the array

coordinates_absolute (np.array): the absolute position of all capsules based on a provided center. n_capsules (int): number of capsules in the array capsule_names (list[str]): the names of the microphone capsules

__init__(name='', is_spherical=False, channel_layout_type='mono')#
Parameters:
  • name (str)

  • is_spherical (bool)

  • channel_layout_type (str)

Return type:

None

Methods

__init__([name, is_spherical, ...])

from_dict(input_dict)

Instantiate a MicArray from a dictionary.

set_absolute_coordinates(mic_center)

Calculates absolute position of all microphone capsules based on a provided center.

to_dict()

Returns metadata for this MicArray as a dictionary.

Attributes

capsule_names

channel_layout

Returns the ray-tracing engine ChannelLayout object for this MicArray

channel_layout_type

coordinates_absolute

coordinates_cartesian

coordinates_center

coordinates_polar

irs

is_spherical

n_capsules

n_listeners

Returns the number of listeners this MicArray should be associated with in the engine.

name

__eq__(other)#

Compare two MicArray objects for equality.

Returns:

True if the MicArray objects are identical, False otherwise

Return type:

bool

Parameters:

other (Any)

__len__()#

Return the number of capsules associated with this microphone

Return type:

int

__repr__()#

Return a JSON-formatted string representation of this microphone array

Return type:

str

__str__()#

Return a string representation of this microphone array

Return type:

str

property capsule_names: list[str]#
property channel_layout: ChannelLayout#

Returns the ray-tracing engine ChannelLayout object for this MicArray

channel_layout_type: str = 'mono'#
property coordinates_absolute: ndarray#
property coordinates_cartesian: ndarray#
property coordinates_center: ndarray#
property coordinates_polar: ndarray#
classmethod from_dict(input_dict)#

Instantiate a MicArray from a dictionary.

Parameters:

input_dict (dict[str, Any]) – Dictionary that will be used to instantiate the MicArray.

Returns:

MicArray instance.

irs: ndarray = None#
is_spherical: bool = False#
property n_capsules: int#
property n_listeners: int#

Returns the number of listeners this MicArray should be associated with in the engine.

If channel_layout == foa, we will only have 1 listener, but 4 “capsules” and IRs. Otherwise, if channel_layout == mono, we will have as many listeners as capsules.

name: str = ''#
set_absolute_coordinates(mic_center)#

Calculates absolute position of all microphone capsules based on a provided center.

The center should be in cartesian coordinates with the form (XYZ), with units in meters.

Parameters:

mic_center (ndarray)

Return type:

ndarray

to_dict()#

Returns metadata for this MicArray as a dictionary.

Return type:

dict