I have an RIR vector $h[n]$ with $N$ samples and an audio source $x[n]$ with $M$ samples. I wish to simulate a 5 seconds audio segment with $x[n]$ randomly located within (timewise).
conv(x,h) I am getting a result with vales in the range $[-0.3852,0.3242]$.
np.convolve(x,h) I get a result with vales in the range $[-12621.9,10624.08]$, which also sounds bad on the headset (I am assuming due to cutoffs).
I do not know where is the difference comming from, as both $h$ and $x$ are the same before the convolution. Normalizing the output of the python version by:
fixes the values. This is true for normalizing by either
Now I am confused about the best method of action.
- For a 5-second segment recording, do I have to generate a 5 - second length $h$?
- Is it best to first pad both $h$ and $x$ with zeros and then convolve or should I convolve and than allocate randomly within a 5 seconds zeros vector?
- Is it at all reasonable to normalize here?
- with respect to the former 3 questions, do I normalize by
len(h)or the number of samples within a 5 seconds segment?
I am aware that there may be more than one correct answer. I am looking for the pros and cons of each course of action and what is the best way to achieve my target.