Search Results

Search found 98 results on 4 pages for 'fft'.

Page 1/4 | 1 2 3 4  | Next Page >

  • Do you know a good and efficient FFT?

    - by yan bellavance
    Hi, I am trying to find a very fast and efficient Fourier transform (FFT). Does anyone know of any good ones. I need to run it on the iPhone so it must not be intensive. Instead, maybe you know of one that is wavelet like, i need frequency resolution but only a narrow band (vocal audio range up to 10khz max...even 10Khz might be too high). Im thinking also of truncating this FFT to keep the frequency resolution while eliminating the unwanted frequency band. This is for an iphone ...I have taken a look at the FFT in Aurio touch but it seems this is an int FFT but my app uses floats.....would it give a big performance increase to try and adapt program to an int FFT or not(which i really dont feel like doing...plus aurio touch uses a radix 2 FFT which is not that great).

    Read the article

  • FFT and IFFT on 3D matrix (Matlab)

    - by SteffenDM
    I have a movie with 70 grayscale frames in MATLAB. I have put them in a 3-D matrix, so the dimensions are X, Y and time. I want to determine the frequencies in the time dimension, so I have to calculate the FFT for every point in the 3rd dimension. This is not a problem but I have to return the images to the original form with ifft. In a normal situation this would be true: X = ifft(fft(X)), but this is not the case it seems in MATLAB when you work with multidimensional data. This is the code I use: for i = 1:length y(:, :, i) = [img1{i, level}]; %# take each picture from an cell array and put it end %# and put it in 3D array y2 = ifft(fft(y, NFFT,3), NFFT, 3); %# NFFT = 128, the 3 is the dimension in which i want %# to calculate the FFT and IFFT y is 480x640x70, so there are 70 images of 640x480 pixels. If I use only fft, y2 is 480x640x128 (this is normal because we want 128 points with NFFT). If I use fft and ifft, y2 is 480x640x128 pixels. This is not normal, the 128 should be 70 again. I tried to do it in just one dimension by using 2 for loops and this works fine. The for loops take to much time, though.

    Read the article

  • Getting Frequency Components with FFT

    - by ruhig brauner
    so I was able to solv my last problem but i stubmled upon the next already. So I want to make a simple spectrogram but in oder to do so I want to understand how FFT-libaries work and what they actually calculate and return. (FFT and Signal Processing is the number 1 topic I will get into as soon as I have time but right now, I only have time for some programming exercises in the evening. ;) ) Here I just summarized the most important parts: int framesPerSecond; int samplesPerSecond; int samplesPerCycle; // right now i want to refresh the spectogram every DoubleFFT_1D fft; WAVReader audioIn; double audioL[], audioR[]; double fftL[], fftR[]; ..... framesPerSecond = 30; audioIn= new WAVReader("Strobe.wav"); int samplesPerSecond = (int)audioIn.GetSampleRate(); samplesPerCycle = (int)(audioIn.GetSampleRate()/framesPerSecond); audioL = new double[samplesPerCycle*2]; audioR = new double[samplesPerCycle*2]; fftL = new double[samplesPerCycle]; fftR = new double[samplesPerCycle]; for(int i = 0; i < samplesPerCycle; i++) { // don't even know why,... fftL[i] = 0; fftR[i] = 0; } fft = new DoubleFFT_1D(samplesPerCycle); ..... for(int i = 0; i < samplesPerCycle; i++) { audioIn.GetStereoSamples(temp); audioL[i]=temp[0]; audioR[i]=temp[1]; } fft.realForwardFull(audioL); //still stereo fft.realForwardFull(audioR); System.out.println("Check"); for(int i = 0; i < samplesPerCycle; i++) { //storing the magnitude in the fftL/R arrays fftL[i] = Math.sqrt(audioL[2*i]*audioL[2*i] + audioL[2*i+1]*audioL[2*i+1]); fftR[i] = Math.sqrt(audioR[2*i]*audioR[2*i] + audioR[2*i+1]*audioR[2*i+1]); } So the question is, if I want to know, what frequencys are in the sampled signal, how do I calculate them? (When I want to print the fftL / fftR arrays, I get some exponential formes at both ends of the array.) Thx :)

    Read the article

  • Can FFT length affect filtering accuracy?

    - by Charles
    Hi, I am designing a fractional delay filter, and my lagrange coefficient of order 5 h(n) have 6 taps in time domain. I have tested to convolute the h(n) with x(n) which is 5000 sampled signal using matlab, and the result seems ok. When I tried to use FFT and IFFT method, the output is totally wrong. Actually my FFT is computed with 8192 data in frequency domain, which is the nearest power of 2 for 5000 signal sample. For the IFFT portion, I convert back the 8192 frequency domain data back to 5000 length data in time domain. So, the problem is, why this thing works in convolution, but not in FFT multiplication. Does converting my 6 taps h(n) to 8192 taps in frequency domain causes this problem? Actually I have tried using overlap-save method, which perform the FFT and multiplication with smaller chunks of x(n) and doing it 5 times separately. The result seems slight better than the previous, and at least I can see the waveform pattern, but still slightly distorted. So, any idea where goes wrong, and what is the solution. Thank you.

    Read the article

  • fft understanding

    - by maximus
    Can somebody give a good explanation of FFT image transform How the FFT transformed image and it's Re^2+Im^2 image can be analyzed? I just want to understand something when loiking to the image and it's frequency.

    Read the article

  • Help me understand FFT function (Matlab)

    - by estourodepilha.com
    1) Besides the negative frequencies, which is the minimum frequency provided by the FFT function? Is it zero? 2) If it is zero how do we plot zero on a logarithmic scale? 3) The result is always symmetrical? Or it just appears to be symmetrical? 4) If I use abs(fft(y)) to compare 2 signals, may I lose some accuracy?

    Read the article

  • DSP - Filtering in the frequency domain via FFT

    - by Trap
    I've been playing around a little with the Exocortex implementation of the FFT, but I'm having some problems. Whenever I modify the amplitudes of the frequency bins before calling the iFFT the resulting signal contains some clicks and pops, especially when low frequencies are present in the signal (like drums or basses). However, this does not happen if I attenuate all the bins by the same factor. Let me put an example of the output buffer of a 4-sample FFT: // Bin 0 (DC) FFTOut[0] = 0.0000610351563 FFTOut[1] = 0.0 // Bin 1 FFTOut[2] = 0.000331878662 FFTOut[3] = 0.000629425049 // Bin 2 FFTOut[4] = -0.0000381469727 FFTOut[5] = 0.0 // Bin 3, this is the first and only negative frequency bin. FFTOut[6] = 0.000331878662 FFTOut[7] = -0.000629425049 The output is composed of pairs of floats, each representing the real and imaginay parts of a single bin. So, bin 0 (array indexes 0, 1) would represent the real and imaginary parts of the DC frequency. As you can see, bins 1 and 3 both have the same values, (except for the sign of the Im part), so I guess bin 3 is the first negative frequency, and finally indexes (4, 5) would be the last positive frequency bin. Then to attenuate the frequency bin 1 this is what I do: // Attenuate the 'positive' bin FFTOut[2] *= 0.5; FFTOut[3] *= 0.5; // Attenuate its corresponding negative bin. FFTOut[6] *= 0.5; FFTOut[7] *= 0.5; For the actual tests I'm using a 1024-length FFT and I always provide all the samples so no 0-padding is needed. // Attenuate var halfSize = fftWindowLength / 2; float leftFreq = 0f; float rightFreq = 22050f; for( var c = 1; c < halfSize; c++ ) { var freq = c * (44100d / halfSize); // Calc. positive and negative frequency indexes. var k = c * 2; var nk = (fftWindowLength - c) * 2; // This kind of attenuation corresponds to a high-pass filter. // The attenuation at the transition band is linearly applied, could // this be the cause of the distortion of low frequencies? var attn = (freq < leftFreq) ? 0 : (freq < rightFreq) ? ((freq - leftFreq) / (rightFreq - leftFreq)) : 1; // Attenuate positive and negative bins. mFFTOut[ k ] *= (float)attn; mFFTOut[ k + 1 ] *= (float)attn; mFFTOut[ nk ] *= (float)attn; mFFTOut[ nk + 1 ] *= (float)attn; } Obviously I'm doing something wrong but can't figure out what. I don't want to use the FFT output as a means to generate a set of FIR coefficients since I'm trying to implement a very basic dynamic equalizer. What's the correct way to filter in the frequency domain? what I'm missing? Thanks in advance.

    Read the article

  • Extrapolation using fft in octave

    - by CFP
    Using GNU octave, I'm computing a fft over a piece of signal, then eliminating some frequencies, and finally reconstructing the signal. This give me a nice approximation of the signal ; but it doesn't give me a way to extrapolate the data. Suppose basically that I have plotted three periods and a half of f: x -> sin(x) + 0.5*sin(3*x) + 1.2*sin(5*x) and then added a piece of low amplitude, zero-centered random noise. With fft/ifft, I can easily remove most of the noise ; but then how do I extrapolate 3 more periods of my signal data? (other of course that duplicating the signal). The math way is easy : you have a decomposition of your function as an infinite sum of sines/cosines, and you just need to extract a partial sum and apply it anywhere. But I don't quite get the programmatic way... Thanks!

    Read the article

  • Normalize FFT magnitude to imitate WMP

    - by Bevin
    So, I've been working on a little visualizer for sound files, just for fun. I basically wanted to imitate the "Scope" and "Ocean Mist" visualizers in Windows Media Player. Scope was easy enough, but I'm having problems with Ocean Mist. I'm pretty sure that it is some kind of frequency spectrum, but when I do an FFT on my waveform data, I'm not getting the data that corresponds to what Ocean Mist displays. The spectrum actually looks correct, so I knew there was nothing wrong with the FFT. I'm assuming that the visualizer runs the spectrum through some kind of filter, but I have no idea what it might be. Any ideas?

    Read the article

  • FFT in MATLAB: wrong 0Hz frequency

    - by roujhan
    Hello I want to use fft in MATLAB to analize some exprimental data saved as an excell file. my code: A=xlsread('Book.xls'); G=A'; x=G(2, : ); N=length(x); F=[-N/2:N/2-1]/N; X = abs(fft(x-mean(x),N)) X = fftshift(X); plot(F,X) But it plots a graph with a large 0Hz wrong component, my true frequency is about 395Hz and it is not shown in the plotted graph. Please tell me what is wrong. Any help would be appreciated.

    Read the article

  • VST plugin : using FFT on audio input buffer with arbitrary size, how ?

    - by Led
    I'm getting interested in programming a VST plugin, and I have a basic knowledge of audio dsp's and FFT's. I'd like to use VST.Net, and I'm wondering how to implement an FFT-based effect. The process-code looks like public override void Process(VstAudioBuffer[] inChannels, VstAudioBuffer[] outChannels) If I'm correct, normally the FFT would be applied on the input, some processing would be done on the FFT'd data, and then an inverse-FFT would create the processed soundbuffer. But since the FFT works on a specified buffersize that will most probably be different then the (arbitrary) amount of input/output-samples, how would you handle this ?

    Read the article

  • Calculate area under FFT graph in Matlab

    - by lytheone
    Hiya, Currently I did a FFT of a set of data which gives me a plot with frequency at x axis and amplitude at y axis. I would like to calculate out the area under graph to give me energy. I am not sure how to determinate the area because i am without the equation and also i only want a certain area of the plot rather than whole area under the plot. Is there a way i can do it?

    Read the article

  • Difference in amplitude from the same source using FFT

    - by Anders
    Hi, I have a question regarding use of FFT. Using function getBand(int i) with Minim i can extract the amplitude of a specific frequency and do pretty maps of it. Works great. However, this is a more of a curiosity question. When i look at the values extracted from playing the same song two twice using the same frequency (so the amplitude should be identical) but i get very different values - why is this? 0.0,0.0,0.0,0.0,0.0,0.08706585,0.23708777,0.83046436,0.74603105,0.30447206 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.08706585,0.4790409,0.9608221,0.83046436,0.74603105

    Read the article

  • Matlab fft function

    - by CTZStef
    The code below is from the Matlab 2011a help about fft function. I think there is a problem here : why do they multiply t(1:50) by Fs, and then say it's time in millisecond ? Certainly, it happens to be true in this very particular case, but change the value of Fs to, say, 2000, and it won't work anymore, obviously because of this factor of 2. Right ? Quite misleading, isn't it ? What do I miss ? Fs = 1000; % Sampling frequency T = 1/Fs; % Sample time L = 1000; % Length of signal t = (0:L-1)*T; % Time vector % Sum of a 50 Hz sinusoid and a 120 Hz sinusoid x = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t); y = x + 2*randn(size(t)); % Sinusoids plus noise plot(Fs*t(1:50),y(1:50)) title('Signal Corrupted with Zero-Mean Random Noise') xlabel('time (milliseconds)') Clearer with this : fs = 2000; % Sampling frequency T = 1 / fs; % Sample time L = 1000; % Length of signal t2 = (0:L-1)*T; % Time vector f = 50; % signal frequency s2 = sin(2*pi*f*t2); figure, plot(fs*t2(1:50),s2(1:50)); % NOT good figure, plot(t2(1:50),s2(1:50)); % good

    Read the article

  • c++ FFT Beat detection library?

    - by mokaschitta
    Hi, I am currently looking around for a good allround beat detection library / source code in C++ since I found it really hard to achieve satisfying results with the beat detection code I wrote myself using this tutorial: http://www.gamedev.net/reference/programming/features/beatdetection/ It's especially really hard if you want to make it work with any kind of music so I was wondering if there is something usable out there allready? Thanks!

    Read the article

  • AS3 computeSpectrum fft true

    - by cr1ms0n3cho
    I am just trying to understand what the values sent back from computeSpectrum(bytes,true,0) mean. I have values ranging from 0 to 1 for each float i read from the byte array but does each value represent a range of Hz Thanks!

    Read the article

  • How to compute power spectrum from 2D FFT

    - by user1452954
    I've encounter a problem when doing my lab assignment, not sure how to implement this: Use fft2 on a gray image and to do Fourier transform and then compute the power spectrum. This is my code so far: >> Pc = imread('pckint.jpg'); >> whos Pc; Name Size Bytes Class Attributes Pc 256x256 65536 uint8 >> imshow(Pc); >> result = fft2(Pc); My question is from the result. How to computer power spectrum?

    Read the article

  • VB FFT - stuck understanding relationship of results to frequency

    - by WaveyDavey
    Trying to understand an fft (Fast Fourier Transform) routine I'm using (stealing)(recycling) Input is an array of 512 data points which are a sample waveform. Test data is generated into this array. fft transforms this array into frequency domain. Trying to understand relationship between freq, period, sample rate and position in fft array. I'll illustrate with examples: ======================================== Sample rate is 1000 samples/s. Generate a set of samples at 10Hz. Input array has peak values at arr(28), arr(128), arr(228) ... period = 100 sample points peak value in fft array is at index 6 (excluding a huge value at 0) ======================================== Sample rate is 8000 samples/s Generate set of samples at 440Hz Input array peak values include arr(7), arr(25), arr(43), arr(61) ... period = 18 sample points peak value in fft array is at index 29 (excluding a huge value at 0) ======================================== How do I relate the index of the peak in the fft array to frequency ?

    Read the article

  • Beat detection and FFT

    - by Quincy
    So I am working on a platformer game which includes music with beat detection. I am currently using a simple if the energy that is stored in the history buffer is smaller then the current energy there is a beat. The problem with this is that ofcourse if you use songs like rock songs where you have a pretty steady amplitude this isn't going to work. So I looked further and found algorithms splitting the sound into multiple bands using FFT. I then found this : http://en.literateprograms.org/Cooley-Tukey_FFT_algorithm_(C) The only problem I'm having is that I am quite new to audio and I have no idea how to use that to split the signal up into multiple signals. So my question is : How do you use a FFT to split a signal into multiple bands ? Also for the guys interested, this is my algorithm in c# : // C = threshold, N = size of history buffer / 1024 public void PlaceBeatMarkers(float C, int N) { List<float> instantEnergyList = new List<float>(); short[] samples = soundData.Samples; float timePerSample = 1 / (float)soundData.SampleRate; int sampleIndex = 0; int nextSamples = 1024; // Calculate instant energy for every 1024 samples. while (sampleIndex + nextSamples < samples.Length) { float instantEnergy = 0; for (int i = 0; i < nextSamples; i++) { instantEnergy += Math.Abs((float)samples[sampleIndex + i]); } instantEnergy /= nextSamples; instantEnergyList.Add(instantEnergy); if(sampleIndex + nextSamples >= samples.Length) nextSamples = samples.Length - sampleIndex - 1; sampleIndex += nextSamples; } int index = N; int numInBuffer = index; float historyBuffer = 0; //Fill the history buffer with n * instant energy for (int i = 0; i < index; i++) { historyBuffer += instantEnergyList[i]; } // If instantEnergy / samples in buffer < instantEnergy for the next sample then add beatmarker. while (index + 1 < instantEnergyList.Count) { if(instantEnergyList[index + 1] > (historyBuffer / numInBuffer) * C) beatMarkers.Add((index + 1) * 1024 * timePerSample); historyBuffer -= instantEnergyList[index - numInBuffer]; historyBuffer += instantEnergyList[index + 1]; index++; } }

    Read the article

  • Logarithmic spacing of FFT bins

    - by Mykel Stone
    I'm trying to do the examples within the GameDev.net Beat Detection article ( http://archive.gamedev.net/archive/reference/programming/features/beatdetection/index.html ) I have no issue with performing a FFT and getting the frequency data and doing most of the article. I'm running into trouble though in the section 2.B, Enhancements and beat decision factors. in this section the author gives 3 equations numbered R10-R12 to be used to determine how many bins go into each subband: R10 - Linear increase of the width of the subband with its index R11 - We can choose for example the width of the first subband R12 - The sum of all the widths must not exceed 1024 He says the following in the article: "Once you have equations (R11) and (R12) it is fairly easy to extract 'a' and 'b', and thus to find the law of the 'wi'. This calculus of 'a' and 'b' must be made manually and 'a' and 'b' defined as constants in the source; indeed they do not vary during the song." However, I cannot seem to understand how these values are calculated...I'm probably missing something simple, but learning fourier analysis in a couple of weeks has left me Decimated-in-Mind and I cannot seem to see it.

    Read the article

  • Logarithmic spacing of FFT subbands

    - by Mykel Stone
    I'm trying to do the examples within the GameDev.net Beat Detection article ( http://archive.gamedev.net/archive/reference/programming/features/beatdetection/index.html ) I have no issue with performing a FFT and getting the frequency data and doing most of the article. I'm running into trouble though in the section 2.B, Enhancements and beat decision factors. in this section the author gives 3 equations numbered R10-R12 to be used to determine how many bins go into each subband: R10 - Linear increase of the width of the subband with its index R11 - We can choose for example the width of the first subband R12 - The sum of all the widths must not exceed 1024 He says the following in the article: "Once you have equations (R11) and (R12) it is fairly easy to extract 'a' and 'b', and thus to find the law of the 'wi'. This calculus of 'a' and 'b' must be made manually and 'a' and 'b' defined as constants in the source; indeed they do not vary during the song." However, I cannot seem to understand how these values are calculated...I'm probably missing something simple, but learning fourier analysis in a couple of weeks has left me Decimated-in-Mind and I cannot seem to see it.

    Read the article

  • Why do I get rows of zeros in my 2D fft?

    - by Nicholas Pringle
    I am trying to replicate the results from a paper. "Two-dimensional Fourier Transform (2D-FT) in space and time along sections of constant latitude (east-west) and longitude (north-south) were used to characterize the spectrum of the simulated flux variability south of 40degS." - Lenton et al(2006) The figures published show "the log of the variance of the 2D-FT". I have tried to create an array consisting of the seasonal cycle of similar data as well as the noise. I have defined the noise as the original array minus the signal array. Here is the code that I used to plot the 2D-FT of the signal array averaged in latitude: import numpy as np from numpy import ma from matplotlib import pyplot as plt from Scientific.IO.NetCDF import NetCDFFile ### input directory indir = '/home/nicholas/data/' ### get the flux data which is in ### [time(5day ave for 10 years),latitude,longitude] nc = NetCDFFile(indir + 'CFLX_2000_2009.nc','r') cflux_southern_ocean = nc.variables['Cflx'][:,10:50,:] cflux_southern_ocean = ma.masked_values(cflux_southern_ocean,1e+20) # mask land nc.close() cflux = cflux_southern_ocean*1e08 # change units of data from mmol/m^2/s ### create an array that consists of the seasonal signal fro each pixel year_stack = np.split(cflux, 10, axis=0) year_stack = np.array(year_stack) signal_array = np.tile(np.mean(year_stack, axis=0), (10, 1, 1)) signal_array = ma.masked_where(signal_array > 1e20, signal_array) # need to mask ### average the array over latitude(or longitude) signal_time_lon = ma.mean(signal_array, axis=1) ### do a 2D Fourier Transform of the time/space image ft = np.fft.fft2(signal_time_lon) mgft = np.abs(ft) ps = mgft**2 log_ps = np.log(mgft) log_mgft= np.log(mgft) Every second row of the ft consists completely of zeros. Why is this? Would it be acceptable to add a randomly small number to the signal to avoid this. signal_time_lon = signal_time_lon + np.random.randint(0,9,size=(730, 182))*1e-05 EDIT: Adding images and clarify meaning The output of rfft2 still appears to be a complex array. Using fftshift shifts the edges of the image to the centre; I still have a power spectrum regardless. I expect that the reason that I get rows of zeros is that I have re-created the timeseries for each pixel. The ft[0, 0] pixel contains the mean of the signal. So the ft[1, 0] corresponds to a sinusoid with one cycle over the entire signal in the rows of the starting image. Here are is the starting image using following code: plt.pcolormesh(signal_time_lon); plt.colorbar(); plt.axis('tight') Here is result using following code: ft = np.fft.rfft2(signal_time_lon) mgft = np.abs(ft) ps = mgft**2 log_ps = np.log1p(mgft) plt.pcolormesh(log_ps); plt.colorbar(); plt.axis('tight') It may not be clear in the image but it is only every second row that contains completely zeros. Every tenth pixel (log_ps[10, 0]) is a high value. The other pixels (log_ps[2, 0], log_ps[4, 0] etc) have very low values.

    Read the article

1 2 3 4  | Next Page >