Adds a microphone array (i.e. several microphones) in the room. Parameters ---------- mic_array: array_like or ndarray or MicrophoneArray object The array can be provided as an array of size ``(dim, n_mics)``, where ``dim`` is the dimension o
(self, mic_array, directivity=None)
| 2003 | return self.add(MicrophoneArray(loc, fs, directivity)) |
| 2004 | |
| 2005 | def add_microphone_array(self, mic_array, directivity=None): |
| 2006 | """ |
| 2007 | Adds a microphone array (i.e. several microphones) in the room. |
| 2008 | |
| 2009 | Parameters |
| 2010 | ---------- |
| 2011 | mic_array: array_like or ndarray or MicrophoneArray object |
| 2012 | The array can be provided as an array of size ``(dim, n_mics)``, |
| 2013 | where ``dim`` is the dimension of the room and ``n_mics`` is the |
| 2014 | number of microphones in the array. |
| 2015 | |
| 2016 | As an alternative, a |
| 2017 | :py:obj:`~pyroomacoustics.beamforming.MicrophoneArray` can be |
| 2018 | provided. |
| 2019 | directivity: list of Directivity objects, optional |
| 2020 | If ``mic_array`` is provided as a numpy array, an optional |
| 2021 | :py:obj:`~pyroomacoustics.directivities.Directivity` object or |
| 2022 | list thereof can be provided. |
| 2023 | If ``mic_array`` is a MicrophoneArray object, passing an argument here |
| 2024 | will result in an error. |
| 2025 | |
| 2026 | Returns |
| 2027 | ------- |
| 2028 | :py:obj:`~pyroomacoustics.room.Room` |
| 2029 | The room is returned for further tweaking. |
| 2030 | """ |
| 2031 | |
| 2032 | if self.simulator_state["rt_needed"] and directivity is not None: |
| 2033 | raise NotImplementedError("Directivity not supported with ray tracing.") |
| 2034 | |
| 2035 | if self.dim != 3 and directivity is not None: |
| 2036 | raise NotImplementedError("Directivity is only supported for 3D rooms.") |
| 2037 | |
| 2038 | if not isinstance(mic_array, MicrophoneArray): |
| 2039 | # if the type is not a microphone array, try to parse a numpy array |
| 2040 | mic_array = MicrophoneArray(mic_array, self.fs, directivity) |
| 2041 | else: |
| 2042 | # if the type is microphone array |
| 2043 | if directivity is not None: |
| 2044 | raise ValueError( |
| 2045 | "When providing a MicrophoneArray object, the directivities should " |
| 2046 | "be provided in the object, not via the `directivity` parameter " |
| 2047 | "of this method." |
| 2048 | ) |
| 2049 | |
| 2050 | if self.simulator_state["rt_needed"] and mic_array.is_directive: |
| 2051 | raise NotImplementedError("Directivity not supported with ray tracing.") |
| 2052 | |
| 2053 | return self.add(mic_array) |
| 2054 | |
| 2055 | def add_source(self, position, signal=None, delay=0, directivity=None): |
| 2056 | """ |