fft

numpy fft is fast for lengths that are products of small primes, but how small?

耗尽温柔 提交于 2020-01-15 03:50:11
问题 I've seen several examples showing that if the input length is a product of 2,3,5,7 etc. then numpy's fft implementation is fast. But what is the largest prime number that is still considered "small" here? 回答1: Note that scipy's FFT has radices of 2, 3, 4, and 5 (reference) . I assume numpy may have a similar implementation, which would make 5 the largest efficient prime factor in FFT lengths. Empirically, the largest prime I'd consider "small" for the purpose of FFT performance is 11. But

Two dimensional FFT using python results in slightly shifted frequency

╄→гoц情女王★ 提交于 2020-01-15 03:14:47
问题 I know there have been several questions about using the Fast Fourier Transform (FFT) method in python, but unfortunately none of them could help me with my problem: I want to use python to calculate the Fast Fourier Transform of a given two dimensional signal f, i.e. f(x,y). Pythons documentation helps a lot, solving a few issues, which the FFT brings with it, but i still end up with a slightly shifted frequency compared to the frequency i expect it to show. Here is my python code: from

How to play and read .caf PCM audio file

大憨熊 提交于 2020-01-15 03:06:29
问题 I have an app that selects a song from the iPod Library then copies that song into the app's directory as a '.caf' file. I now need to play and at the same time read that file into Apples FFT from the Accelerate framework so I can visualize the data like a spectrogram. Here is the code for the FFT: void FFTAccelerate::doFFTReal(float samples[], float amp[], int numSamples) { int i; vDSP_Length log2n = log2f(numSamples); //Convert float array of reals samples to COMPLEX_SPLIT array A vDSP_ctoz

How to play and read .caf PCM audio file

大兔子大兔子 提交于 2020-01-15 03:06:10
问题 I have an app that selects a song from the iPod Library then copies that song into the app's directory as a '.caf' file. I now need to play and at the same time read that file into Apples FFT from the Accelerate framework so I can visualize the data like a spectrogram. Here is the code for the FFT: void FFTAccelerate::doFFTReal(float samples[], float amp[], int numSamples) { int i; vDSP_Length log2n = log2f(numSamples); //Convert float array of reals samples to COMPLEX_SPLIT array A vDSP_ctoz

increase / decrease the frequency of a signal using fft and ifft in matlab / octave

早过忘川 提交于 2020-01-14 05:54:48
问题 I'm trying to increase / decrease the frequency of a signal using fft and ifft. The first plot is 1hz and the second plot is 2hz which I'm trying to get by altering the fft and ifft values . I can go between the frequency domain and time domain but how can I increase or decrease the frequency of the signal using fft / ifft? Note: Yes I know I could change the frequency by changing the frequency value of the equation but I'm just using that as a test signal. The signals I will be using won't

CUDA Inverse FFT Bug

末鹿安然 提交于 2020-01-14 05:40:20
问题 I have the following code that has bug when doing the inverse FFT. The forward FFT works as I printed the output and verified it. But the inverse does not seem to. Any ideas? Does it look like I have missed a concept? Code - http://pastebin.com/iZYtdcqR EDIT - I have essentially rewritten the code that comes with the CUDA toolkit samples. I am trying to perform a convolution using FFT but with a modified algorithm (DIF actually.) EDIT2 - dding code to the question. #include <stdio.h> #include

fft: why my main peak is lower than the side peak?

廉价感情. 提交于 2020-01-14 04:36:25
问题 The original data is on the google drive. It is a two columns data, t and x. I did the following discrete fft transform. I don't quite understand that the main peak(sharp one) has a lower height than the side one. The second the subplot shows that it is indeed that the sharp peak(most close to 2.0) is the main frequency. The code and the figure is as follows: import numpy as np import math import matplotlib.pyplot as plt from scipy.fftpack import fft,fftfreq freqUnit=0.012/(2*np.pi) data = np

make a mask for each well in a grid

亡梦爱人 提交于 2020-01-14 03:32:27
问题 I have a grid of wells in an image and I'm trying to analyze this in Matlab. I want to create a box around each well to use as a mask. The way I am trying to go about this is to find the offset vectors from the X and Y normal and then use that to make a grid since I know the size of the wells. I can mask out some of the wells but not all of them---but this doesn't matter since I know that there is a well in every position (see here). I can use regionprops to get the centers but I can't figure

DSP libraries - RFFT - strange results

自闭症网瘾萝莉.ら 提交于 2020-01-13 20:23:30
问题 Recently I've been trying to do FFT calculations on my STM32F4-Discovery evaluation board then send it to PC. I have looked into my problem - I think that I'm doing something wrong with FFT functions provided by manufacturer. I'm using CMSIS-DSP libraries. For now I've have been generating samples with code (if that works correct I'll do sampling by microphone). I'm using arm_rfft_fast_f32 as my data are going to be floats in the future, but results I get in my output array are insane (I

How to get Bass, Mid, Treble data from FFT

纵饮孤独 提交于 2020-01-13 19:20:08
问题 I'm new to this whole audio processing area and I'm wondering how to extract Bass, Mid and treble from an FFT output. I'm currently using this to get the data: https://stackoverflow.com/a/20414331/2714577 which uses Naudio. But I'm using a fftlength of 1024 (require speed). I'm trying to get these 3 sections in a format such as 0-255 for colour purposes. I currently have this: double[] data = new double[512]; void FftCalculated(object sender, FftEventArgs e) { for (int j = 0; j < e.Result