문제

Can you please explain or point the right way to think about how to implement two sound effects on the wav file.

So I read wav file and convert it to int values (in numpy array)

array([59383, 58290, 60629, ..., 52606, 51982, 56274], dtype=uint16)

First, I am not sure I am clear about what these values in array really represent? Is it right that every value is one of 65535 ( unsigned int16 ) magnitude levels that analog output device will produce in some moment in time ?

In theory chorus effect could be achieved by following steps:

  1. Make copy of original array
  2. weaken this copied array ( multiplying by some value < 1 )
  3. and add this copied array to original one

In practice I don't know how to add them correctly. Should I simply add values one by one, make convolution of two arrays or interleave original array and it's modified copy. Also chorus effect should have arbitrary time delay and i don't know how can i accomplish this.

How could I implement that randomness of data I am about to add ?

도움이 되었습니까?

해결책

You basically have the right ideas. Here are a few points:

1) The wave file is linear signal vs time, so your understanding of it is correct. (Many audio things are logarithmic, so it not unreasonable to think it might be non-linear -- eg, LPs are encoded in a nonlinear way.)

2) If you're going to do math, first convert to float or int32 so you don't overrun the limits of int16.

3) To offset in time, use numpy slicing. That is, something like new = old[1000:]+old[:-1000]. Note that you need to add sections of the same length together, so if you add a time shift, you can't add it to the full array because the timeshift will be shorter.

4) As for adding with "random time" you can to that with the above for a single random time. To make the time vary continuously throughout the addition, you need to warp your original signal and that will be more complicated.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top