I'm using the Python scipy library to get the data of a particular .wav file into array format. Now, I'd like to find the Discrete Fourier Transform of that signal. The formula for the DFT is,

$X_k = \sum_{n=0}^{N-1}x_{n}e^{-2\pi ink/N}$ for a signal $x(t)$ of length $N$.

The data returned from the wavfile.read function, however, appears as a multi-dimensional array; it begins: array([[0, 0], [0, 0], [0, 0], ..., [0, 0], [0, 0], [0, 0]], dtype=int16). I've seen the formula for the 2D Discrete Fourier Transform, but I was under the impression that this was used for image processing. How would I go about finding the DFT of an audio signal represented by a multi-dimensional array?

  • $\begingroup$ it really has to do with why you have a multidimensional data file. it is most likely that you have multiple channels, perhaps stereo channels and for that, you would probably just want to do spectral analysis on each channel separately. There are problems in beamforming where multidimensional analysis is done $\endgroup$ – user28715 Jul 7 '19 at 22:25

It looks like you are reading a stereo file, so you have a left and a right channel. You can do a DFT on the left or a DFT of the right or the mono or all of the above. It really depends on your specific application and requirements.

| improve this answer | |
  • $\begingroup$ You were absolutely right –– thank you! $\endgroup$ – Luke Poeppel Jul 8 '19 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.