Skip to content

Conversation

@bogdad
Copy link

@bogdad bogdad commented Jul 21, 2025

Thanks for sending a pull request (PR), we really appreciate that! Before hitting the submit button, we'd be really glad if you could make sure all the following points have been cleared.

Please also refer to the doc on contributing for more details. Even if you can't check all the boxes below, do not hesitate to go ahead with the PR and ask for help there.

  • Are there docstrings ? Do they follow the numpydoc style ?
  • Have you run the tests by doing nosetests or py.test at the root of the repo ?
  • Have you checked that the doc builds properly and that any new file has been added to the repo ? How to do that is covered in the documentation.
  • Is there a unit test for the proposed code modification ? If the PR addresses an issue, the test should make sure the issue is fixed.
  • Last but not least, did you document the proposed change in the CHANGELOG file ? It should go under "Unreleased".

Happy PR 😃

hey, thank you for pyroomacoutics!

this pull request fixes a small issue i bumped into when trying to use it in my toy example, when i have few microphones and they are added sequentionally at different points in time with the following stacktrace:

2025-07-21 11:47:12,185 - simulator.virtual_speaker - ERROR - Error processing audio chunk: 'MicrophoneArray' object has no attribute 'shape'
2025-07-21 11:47:12,185 - simulator.virtual_speaker - ERROR - Full traceback: Traceback (most recent call last):
  File "/.../simulator/virtual_speaker.py", line 117, in _process_audio_chunk
    await self.speaker_server.room_sim.update_simulation()
  File "/.../simulator/room_simulation.py", line 145, in update_simulation
    self.room.add_microphone_array(mic_positions.T)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/.../simulator/venv/lib/python3.13/site-packages/pyroomacoustics/room.py", line 2115, in add_microphone_array
    return self.add(mic_array)
           ~~~~~~~~^^^^^^^^^^^
  File "/.../simulator/venv/lib/python3.13/site-packages/pyroomacoustics/room.py", line 2018, in add
    self.mic_array.append(obj)
    ~~~~~~~~~~~~~~~~~~~~~^^^^^
  File "/.../simulator/venv/lib/python3.13/site-packages/pyroomacoustics/beamforming.py", line 551, in append
    (locs.shape[1], self.signals.shape[1]), dtype=self.signals.dtype
     ^^^^^^^^^^
AttributeError: 'MicrophoneArray' object has no attribute 'shape'

I have not nailed the example yet, maybe the my usage is borked and i should not want to do this, but this still seems like a correct fix.

pyright seems to find this too.
Screenshot 2025-07-21 at 21 55 27

added a test which does fail before and passes after.

thank you again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant