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

Sensor noise renormalizes the signals #291

Closed
egrinstein opened this issue Nov 24, 2022 · 5 comments
Closed

Sensor noise renormalizes the signals #291

egrinstein opened this issue Nov 24, 2022 · 5 comments

Comments

@egrinstein
Copy link

Hi,

when calling room.simulate(..., snr=VALUE), the following code is called:

elif snr is not None:
            # Normalize all signals so that
            denom = np.std(premix_signals[:, reference_mic, :], axis=1)
            premix_signals /= denom[:, None, None]
            signals = np.sum(premix_signals, axis=0)

            # Compute the variance of the microphone noise
            self.sigma2_awgn = 10 ** (-snr / 10) * S

Which normalizes each source signal by its std. Is this the desired behaviour? If I wanted one source to have a lower volume than another, wouldn't this undo their different volumes? Why is this normalization necessary?

Thank you and sorry for bothering,

Kind regards,

Eric

@fakufaku
Copy link
Collaborator

Hi @egrinstein , I agree. In hindsight this may not be the most desirable behavior, but this is what I implemented.
Maybe the adding the noise should be done in a different function. I don't want to change the behavior here to not break existing code.
As an alternative, it is possible to pass your own mixing function as a callback to simulate.

@egrinstein
Copy link
Author

Hi, sorry for the delay. Thank you for the answer! I'll do that.

@fakufaku
Copy link
Collaborator

fakufaku commented Feb 6, 2023

@egrinstein Thanks for the feedback. I'm working on improving the experience with noise. This is in this pull request (#298) if you are interested.

@egrinstein
Copy link
Author

Thanks for letting me know @fakufaku, it looks like a great addition to Pyroomacoustics. Please let me know if I can help.

@fakufaku
Copy link
Collaborator

fakufaku commented Feb 6, 2023

@egrinstein This is very nice of you to ask! Any help is welcome! Let me know if there is any part you'd like to dig into! If you'd like to discuss this more you can join our discord.

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

No branches or pull requests

2 participants