Sensor noise renormalizes the signals
egrinstein opened this issue · comments
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
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.
Hi, sorry for the delay. Thank you for the answer! I'll do that.
@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.
Thanks for letting me know @fakufaku, it looks like a great addition to Pyroomacoustics. Please let me know if I can help.
@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.