问题
I have a oscillator bank made in SuperCollider which receives phases and amplitudes from python via OSC. However the results don't sound correct at all. At first I thought the problem is in my SuperCollider code, but now I'm beginning to doubt my FFT function and normalization, here's my code:
def readNormalize(length, location,sample):
samplerate, data = wavfile.read(location)
a = data.T[0] # first track of audio
c = fft(a[sample:], length)
ownSum = 0;
length = int(length/2)
for i in range(0, length):
ownSum += abs(c[i])
normalizer = 1/ownSum
phases = []
amplitudes = []
for i in range(0,length):
amplitudes.append(abs(c[i])*normalizer)
phases.append(np.angle(c[i]))
return amplitudes, phases
So the function receives location from where to read, length of the FFT to be calculated and from which sample of the wav file to read. My normalization is done by taking the sum of the vectors of the complex numbers, dividing 1 by the sum and then multiplying the vectors with the normalizing value. I'm not sure if it is done correctly, is this the correct way to do it? Only thing I hear in the SuperCollider is this kick drum sound which is not how it should sound at all. Am I missing something important here?
来源:https://stackoverflow.com/questions/42634666/scipy-fft-function-and-normalization-not-providing-correct-results