Questions tagged [fft]

FFT is short for fast Fourier transform, any of a set of algorithms for quickly computing the discrete Fourier transform (DFT).

The FFT finds a lot of application in data analysis, particularly time-series and image data, and particularly when the data has a periodic nature, or at least a periodic component. The FFT also finds application in digital filtering. There are many FFT algorithms; they all calculate the Discrete Fourier Transform in O(n log n) operations, while the naive DFT implementation is O(n^2).

Mathematically, the Fourier Transform fits a set of sinusoids to the input data - revealing relative strengths of periodic components of the signal. The fit is optimal in a least-squared error sense. In the case of the Discrete Fourier Transform, the sinusoids are periodically related.

Related topics include DFT, signal processing, convolution, and window functions.

More information on FFT can be found in the Wikipedia article on FFT.

5308 questions
2
votes
1 answer

How to syncronize audio with the power spectrum and choose frame length N (to do fft)?

I am doing a music visualizer program in C++. It gives the frequency spectrum of the audio input. I used Aquila-dsp for getting audio samples, Kiss-fft for doing FFT, and SMFL to play the audio. The input is in (.wav) format. OpenGL is used to plot…
Indra
  • 1,308
  • 3
  • 18
  • 24
2
votes
1 answer

What is the best way to implement STFT (Short-time Fourier transform) in Julia

So, I'm wondering how to implement a STFT in Julia, possibly using a Hamming window. I can't find anything on the internet. What is the best way to do it? I'd prefer not to use Python libraries, but pure native Julia if possible. Maybe it's a…
2
votes
2 answers

why image is rotated when i get Fourier transform of image in matlab

I process image using MatLab. I do the following steps on an image: I make an image read. I take the Fourier of image. I take the real of Fourier transformed image. While performing above steps I got a double rotated image in result. I don't know…
Sipa
  • 383
  • 1
  • 13
2
votes
1 answer

FT and Cosine Transform of a symmetric function are different between scipy and numpy

Technically FT of a symmetric function yields all real values. It means the cos transform of the function and FT of the function should give the same values. When I test compute FT of an array (scipy.fftpack.fft(b)) and DCT (scipy.fftpack.dct(b)), I…
PythonNoob
  • 139
  • 2
  • 7
2
votes
2 answers

Recognizing notes within recorded sound - Part 2 - Python

this is a continuation of this question here. This is the code I used in order to get the samples: spf = wave.open(speech,'r') sound_info = spf.readframes(-1) sound_info = fromstring(sound_info, 'Int16') The length of sound_info is 194560, which…
RadiantHex
  • 24,907
  • 47
  • 148
  • 244
2
votes
0 answers

Ifft and fft for sparse vectors

I am trying to optimize some code for performance and i notice that i am forced to make a conversion from sparse to full vectors since the built-in ifft and fft functions do not support the sparse matrix type. My signal is however sparse and I want…
2
votes
1 answer

Shift frequency (using FFT) on integer samples of wav file

I want to make a frequency shift on a .wav file. The problem I have is that the FFT uses complex numbers, and the .wav file has integer values. So I want to make a frequency shift and that means that I have to make a direct transform and an inverse…
2
votes
1 answer

GSL Fast-Fourier Transform - Non-zero Imaginary for Transformed Gaussian?

As an extension to this question that I asked. The Fourier transform of a real Gaussian is a real Gaussian. Now of course a DFT of a set of points that only resemble a Gaussian will not always be a perfect Gaussian, but it should certainly be close.…
Arturo don Juan
  • 249
  • 2
  • 8
2
votes
1 answer

FFT and IFFT with FFTW

I am trying to do ifft and fft on a floating point array. However the outcome is the same for both. Do you have any idea? Why are results the same, even though I use FFTW_FORWARD for one and FFTW_BACKWARD for another one? int N=16; fftwf_complex…
2
votes
2 answers

Matlab Power Spectrum Plot

I want to make a plot of the power spectrum of a particular .wav sound file, over the frequency range from -2000 to +2000 Hz. Attempt: This is my code so far: [s, Fs] = wavread('chord.wav'); Hs=spectrum.periodogram; psd(Hs,s,'Fs',Fs) I tried using…
Merin
  • 55
  • 8
2
votes
0 answers

Wrong result when using kiss_fftnd on 3D matrix?

I'm trying to use Kiss FFT on some 3D matrices, but my results do not match those I get when using Matlab. I was wondering if anyone could help me determine if I'm using the library wrong. If doing fftn on the following 2x3x2 matrix in Matlab A2…
larsjr
  • 665
  • 7
  • 17
2
votes
0 answers

scipy.ndimage.fourier_filter seems to work only for vector with index 0,0,: in array

I'm trying to implement a moving average on the 3rd axis of a 3D array. As the moving window might be quite large, I wanted to do it in the Fourier domain to have decent speed. But it seems it works only for the vector in arr[0,0,:]. Here is a…
Ondřej Grover
  • 719
  • 1
  • 5
  • 13
2
votes
0 answers

Face detection in python using fast convolution

I have to program basic face detection using the fast convolution method for calculating correlation. So far I have this code: def template_matching_fast_convolution(face_data, template_data): #convert to greyscale face_grey =…
svdotbe
  • 168
  • 1
  • 3
  • 16
2
votes
1 answer

Ringing artifacts on a audio signal shown on osciloscope

I generated a squere wave signal and put it into a wave file, using this code: import sys, os, wave, random, struct noise_output = wave.open('noise.wav', 'w') noise_output.setparams((1, 2, 1000, 0, 'NONE', 'not compressed')) SAMPLE_LEN = 1000 for…
notkov
  • 59
  • 6
2
votes
2 answers

How can I plot a spectrogram of a signal by computing the power spectrum on binned windows?

Here I can generate a signal: import numpy as np from matplotlib import pyplot as plt from numpy.lib import stride_tricks import seaborn as sns sns.set(style = "darkgrid" ) fs = 48000.0 t = np.arange(0, 10, 1.0/fs) # 0 to 10 sec at 48k samples per…
user391339
  • 8,355
  • 13
  • 58
  • 71