signal-processing

R equivalent of MATLAB's filter function

自古美人都是妖i 提交于 2019-12-04 07:36:42
I'm adapting MATLAB code to R and trying to generate a waveform using ARMA formula. Is there a simple R equivalent function for MATLAB's filter to take AR/MA coefficients to build a waveform? npts = 100; a = [1 0.6]; % AR coeffs b = [1 0.25 3]; % MA coeffs e = randn(npts,1); % generate gaussian white noise waveform = filter(b,a,e); % generate waveform Hmm can't you achieve that with filter function in the package signal ? require(signal) a = c(1,0.6) b = c(1,0.25,3) e = rnorm(100) waveform = filter(b,a,e) Yeah, you can do this usring arima.sim , e.g. arima.sim(npts, model=list(ar=a, ma=b),

Detecting patterns in waves

淺唱寂寞╮ 提交于 2019-12-04 07:21:58
问题 I'm trying to read a image from a electrocardiography and detect each one of the main waves in it (P wave, QRS complex and T wave). Now I can read the image and get a vector like (4.2; 4.4; 4.9; 4.7; ...) representative of the values in the electrocardiography, what is half of the problem. I need a algorithm that can walk through this vector and detect when each of this waves start and end. Here is a example of one of its graphs: Would be easy if they always had the same size, but it's not

how to use Band Pass filter(18Khz to 22Khz) in Android

一世执手 提交于 2019-12-04 06:53:39
I need to use Band Pass Filter to filter my real time recording audio. The Range is about 18Khz to 22Khz. I've seen many examples,unfortunatly they are used to detect frequency of audio....Since i'm new to DSP,please ellobrate your answer.... 来源: https://stackoverflow.com/questions/21456630/how-to-use-band-pass-filter18khz-to-22khz-in-android

finding the best/ scale/shift between two vectors

不问归期 提交于 2019-12-04 06:15:23
I have two vectors that represents a function f(x), and another vector f(a x+b) i.e. a scaled and shifted version of f(x). I would like to find the best scale and shift factors. *best - by means of least squares error , maximum likelihood, etc. any ideas? for example: f1 = [0;0.450541598502498;0.0838213779969326;0.228976968716819;0.91333736150167;0.152378018969223;0.825816977489547;0.538342435260057;0.996134716626885;0.0781755287531837;0.442678269775446;0]; f2 = [-0.029171964726699;-0.0278570165494982;0.0331454732535324;0.187656956432487;0.358856370923984;0.449974662483267;0.391341738643094;0

Units of frequency when using FFT in NumPy

别等时光非礼了梦想. 提交于 2019-12-04 04:25:06
I am using the FFT function in NumPy to do some signal processing. I have array called signal which has one data point for each hour and has a total of 576 data points. I use the following code on signal to look at its fourier transform. t = len(signal) ft = fft(signal,n=t) mgft=abs(ft) plot(mgft[0:t/2+1]) I see two peaks but I am unsure as to what the units of the x axis are i.e., how they map onto hours? Any help would be appreciated. Given sampling rate FSample and transform blocksize N , you can calculate the frequency resolution deltaF , sampling interval deltaT , and total capture time

Calculating the Power spectral density

谁都会走 提交于 2019-12-04 04:23:45
问题 I am trying to get the PSD of a real data set by making use of fftw3 library To test I wrote a small program as shown below ,that generates the a signal which follows sinusoidal function #include <stdio.h> #include <math.h> #define PI 3.14 int main (){ double value= 0.0; float frequency = 5; int i = 0 ; double time = 0.0; FILE* outputFile = NULL; outputFile = fopen("sinvalues","wb+"); if(outputFile==NULL){ printf(" couldn't open the file \n"); return -1; } for (i = 0; i<=5000;i++){ value =

Reverse Spectrogram A La Aphex Twin in MATLAB

扶醉桌前 提交于 2019-12-04 04:18:16
I'm trying to convert an image into an audio signal in MATLAB by treating it as a spectrogram as in Aphex Twin's song on Windowlicker . Unfortunately, I'm having trouble getting a result. Here it what I have at the moment: function signal = imagetosignal(path, format) % Read in the image and make it symmetric. image = imread(path, format); image = [image; flipud(image)]; [row, column] = size(image); signal = []; % Take the ifft of each column of pixels and piece together the real-valued results. for i = 1 : column spectrogramWindow = image(:, i); R = abs(ifft(spectrogramWindow)); % Take only

Voice Detection in C#

穿精又带淫゛_ 提交于 2019-12-04 03:34:00
I'm looking for a simple C# real-time voice detection library. The input should be an audio stream, and the output should be "human voice" or "not a human voice". I have no knowledge in speech recognition or signal processing, and I'll appreciate any kind of assistance. Kevin Junghans Take a look at the answer for " Detecting audio silence in WAV files using C# ". I am assuming the input is a WAV file. If not please provide the format of the audio stream, or if you are intending on taking input from the microphone directly. If you can measure the amount of silence in an audio stream and you

What is the simplest way to continuously sample from the line-in using C#

不想你离开。 提交于 2019-12-04 03:25:22
I want to continuously sample from my PC's audio line in using C# (then process that data). What is the best way to do the sampling? You can do some (basic) audio capture using the open source NAudio .NET Audio Library. Have a look at the NAudioDemo project to see a simple example of recording to a WAV file using the WaveIn functions. NAudio also now includes the ability to capture audio using WASAPI (Windows Vista and above) and ASIO (if your soundcard has an ASIO driver). There is the Alvas Audio library as well, not free, has a nagging screen if you don't pay, but works beautifully. And the

Renderscript fails on GPU enabled driver if USAGE_SHARED

对着背影说爱祢 提交于 2019-12-04 03:21:41
问题 We are using renderscript for audio dsp processing. It is simple and improves performance significantly for our use-case. But we run into an annoying issue with USAGE_SHARED on devices that have custom driver with GPU execution enabled. As you may know, USAGE_SHARED flag makes the renderscript allocation to reuse the given memory without having to create a copy of it. As a consequence, it not only saves memory, in our case, improves performance to desired level. The following code with USAGE