signal-processing

How do I do convolution in F#?

雨燕双飞 提交于 2019-12-10 16:13:38
问题 I would like convolve a discrete signal with a discrete filter. The signal and filter is sequences of float in F#. The only way I can figure out how to do it is with two nested for loops and a mutable array to store the result, but it does not feel very functional. Here is how I would do it non-functional: conv = double[len(signal) + len(filter) - 1] for i = 1 to len(signal) for j = 1 to len(filter) conv[i + j] = conv[i + j] + signal(i) * filter(len(filter) - j) 回答1: Try this function: let

How can I extract peak values from auto-correlated data in MATLAB?

落花浮王杯 提交于 2019-12-10 16:02:47
问题 I have information (20,000 frames of data) about an audio track that I have auto-correlated using: [r,lags] = xcorr(XX,XX,'biased'); And it looks like this: Which hopefully is so far so good. Ideally I would like to be able to take the frame number that corresponds to the highest part of the second peak. I've read around and tried a load of different methods but I just can't seem to get it to retrieve the information for me. Would anybody be able to shed some light on what I have to do? Many

KISS FFT output with or without windowing

孤街醉人 提交于 2019-12-10 15:50:31
问题 I am currently trying to implement fft into avr32 micro controllers for signal processing purposes using kiss fft. And having a strange problem with my output. Basically, I am passing ADC samples (testing with function generator) into fft (real input, 256 n size) and retrieved output makes sense to me. However, if I apply Hamming window to ADC samples and then pass these to FFT, the frequency bin of the peak magnitude is wrong (and different from previous result without windowing). ADC

Undefined reference with extern C

蓝咒 提交于 2019-12-10 14:59:47
问题 I am trying to compile a program with Netbeans (g++) that inlcudes Aquila, an open source libary. I followed the installation instructions. But when trying to compile a small test program, I get this error In function `Aquila::OouraFft::fft(double const*)':OouraFft.cpp:(.text+0x24f): undefined reference to `cdft' OouraFft.h: #include "Fft.h" extern "C" { void cdft(int, int, double *, int *, double *); //prototypes of offending function void rdft(int, int, double *, int *, double *); //second

the Length of signal in calculating FFT

早过忘川 提交于 2019-12-10 14:38:33
问题 I want to ask some questions related to the last question of mine so I don't want to post in another thread. My question contains a code, I therefore can't post it as a comment. So I have to edit my old question into a new one. Please take a look and help. Thank you. I'm new to FFT and DSP and I want to ask you some questions about calculating FFT in Matlab. The following code is from Matlab help, I just removed the noise. Can I choose the length of signal L different from NFFT? I'm not sure

Filter design and frequency extraction in Python

家住魔仙堡 提交于 2019-12-10 13:26:26
问题 I'm working on a project to find the instantaneous frequency of a multicomponent audio signal in Python. I am currently using a Butterworth bandpass filter combined with scipy.signal.lfilter to extract around my desired frequency region. I then use the analytic signal (from scipy.signal.hilbert ) to get the instantaneous phase, which can be unwrapped to give frequency. As a relative novice to signal processing, I have two main questions: I have read that in many applications, it is preferable

NAudio pitch shifting

不打扰是莪最后的温柔 提交于 2019-12-10 12:36:04
问题 I am using the NAudio DLL and I am looking for example code for pitch shifting sound. 回答1: There is an example of using NAudio for pitch shifting in the open source Skype Voice Changer project. See my article on Coding4Fun for more information on the project. The pitch shifter code itself is found in the SuperPitch class. 来源: https://stackoverflow.com/questions/5843413/naudio-pitch-shifting

How to find correlation between two sine waves for specific intervals and save the value in an array?

喜欢而已 提交于 2019-12-10 12:06:51
问题 I have created two sine wave each with a different frequency. Time period for both waves is 2sec or 2000msecs. Code works well when i find correlation value for whole time period. Buth i want to get correlation values after every 200msec interval. That means i need an array that can store 10 correlation values for the whole 2000msecs. Here's the code how am i calculating correlation for time period of 2000msecs. delta=0.005; %200 hz Fs samples=200; t=0:delta:delta*(samples-1); % Time Samples

How can i calculate the peak using kissFFT?

时光毁灭记忆、已成空白 提交于 2019-12-10 11:44:59
问题 I want to apply FFT on the real audio device and calculate the peak from it here is my code.. N=8192 kiss_fft_cpx out[N/2 +1]; int len = fft->N / 2 + 1; kiss_fft_scalar* samples = &samples2[0]; //inputs from the mic kiss_fftr(fft->config, samples, out); for (int i = 0; i < len; i++) { float re = scale(out[i].r) * N; float im = scale(out[i].i) * N; if (i > 0) spectrum[i] = sqrtf(re * re + im * im) / (N / 2); else spectrum[i] = sqrtf(re * re + im * im) / N; } Now i calculate the pick using code

Explanation of Interpolate Hermite method

前提是你 提交于 2019-12-10 10:35:42
问题 I've currently got this bounty running on how to resample audio data with the intention of increasing the pitch. Many solutions have been made and I have to admit I'm feeling a bit overwhelmed by the choices and information. I was directed to this solution and found this chunk of code: public static float InterpolateCubic(float x0, float x1, float x2, float x3, float t) { float a0, a1, a2, a3; a0 = x3 - x2 - x0 + x1; a1 = x0 - x1 - a0; a2 = x2 - x0; a3 = x1; return (a0 * (t * t * t)) + (a1 *