Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add noise objects to create different type of noise #296

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

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.

None yet

1 participant