Skip to content

Conversation

@fakufaku
Copy link
Collaborator

@fakufaku fakufaku commented Dec 14, 2022

The idea is to have a simple interface to define background noise. We follow the API of SoundSource and MicrophoneArray where objects are added to the room via the add method.

We add an abastrct object type Noise with a unified interface for all types of noise onto the microphone signals after the propagation has been simulated.

Here is an example of the type of code we want to have

room = ShoeBox(...)
room.add_source(...)
room.add_microphone(...)
room.add(WhiteNoise(snr=10.0))

noisy_mix, premix, noise = room.simulate(full_output=True)

# noisy_mix == premix.sum(axis=0) + noise with SNR = 10 dB
assert np.allclose(noisy_mix, premix.sum(axis=0) + noise)

The current implementation (for white noise only) is an snr parameter to the simulate method.
The implementation is also not very good and has unrequested scaling of the source signals.
Better to have some modular implementation that is extensible by sub-classing the Noise class.
For that, we will need to change slightly the interface

TODO

  • Noise abstract class interface
  • White noise
  • Diffuse noise spherical
  • Diffuse noise cylindrical
  • Warning/error when diffuse noise is used with directional microphones
  • Wind noise
  • Modify simulate method (arguments, return values)
  • Add deprecation warnings for the current parameters of simulate method

Checks

I am still working on this and will update the status

  • 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 😃

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.

2 participants