I asked a question over on stack overflow.
I'm having a slight problem however. As suggested by Paul R I am mirroring my lower $n/2$ bins into the upper $n/2$ bins.
I have a few questions however.
I think thats it for now. Any help would be hugely helpful!!
Edit: Giving you an image of the reflection will be near enough impossible as its very hard to see! Basically I'm sampling at 22 kHz and getting nothing but "noise" above 11 kHz. What "ought" (though obviously I'm doing something wrong) to be above 11 kHz seems to get reflected down from 11 kHz to 0. Its very odd.
As for the image of the stripes they can be seen here
Each stripe, I believe, is 512 samples wide.
231I'm not sure what you're getting at with "reflection" or "striping," but you want to duplicate your data points such that the frequency-domain signal (the input to the IFFT) is conjugate symmetric. That means, for $N$ even:
$$ X[k] = X^*[N-k], k = 1, 2, \ldots, \frac{N}{2}-1 $$
Note that $k$ is zero-based; the first element in the vector is $X[0]$. The above indicates that you do not duplicate the zeroth and $\frac{N}{2}$-th elements in the input vector. This relationship is based on the periodicity of the discrete Fourier transform; the first half of the frequency-domain vector corresponds to "positive" frequencies covering the angular frequency range from $0$ to $\frac{(N-1)\pi}{N}$. The second half covers from $\pi$ to $\frac{(N-1)2\pi}{N}$, which, taking advantage of the $2\pi$ periodicity in the frequency domain, is equivalent to $-\pi$ to $\frac{-2\pi}{N}$. In order for the frequency-domain vector to have conjugate symmetry, then it can be easily shown that the above relationship must be true.
Speaking to your original goal of converting a spectrogram into an audio signal that sounds meaningful, there's no guarantee that what you get out will be in any way pleasing. As was pointed out on Stack Overflow, the spectrogram has no phase information; the method suggested there assumes the phase of each frequency-domain bin is zero (so the conjugate operation shown above is superfluous). While the human ear isn't terribly sensitive to phase distortion in audio, you might have to do something else depending upon exactly what you're hoping to achieve.
Your [0] index is the DC component and should not be mirrored. The reflection point should be (N/2)+1
Let's say you have a 1024 point real sequence. A complex FFT turns that into 1024 complex numbers. However X[0] (DC) and X[512] Nyuist are real and X[1]..X[511] are conjugate symmetric so the whole spectrum can still be represented with 1024 numbers (2 reals and 511 complex). Let's say you have a half sided spectrum X[0]...x[512] and want to create the conjugate symmetric version of it Y[0] ... Y[1023]. Do the following
Y[0] = X[0], Y[1] = X[1] .... Y[512] = X[512];
Y[513] = conjugate(X[511]), Y[514] = conjugate(X[510]) ... Y[1023] = conjugate(X[1])
If you use Matlab you need to add "1" to all indices as Matlab starts counting at 1 (not at 0).
© 2012 - Nathan Osman - [About]