FAQ Database Discussion Community


FFT coefficients using python

python,signal-processing
I am a newbie in Signal Processing. In here, I want to ask how to get FFT coeffients from FFT from in python. This is the example of my code: from scipy.fftpack import fft # Number of samplepoints N = 600 # sample spacing T = 1.0 / 800.0 x...

Deconvolution of data convolved by a Gaussian response

matlab,filtering,signal-processing,fft
I have a set of experimental data s(t) which consists of a vector (with 81 points as a function of time t). From the physics, this is the result of the convolution of the system response e(t) with a probe p(t), which is a Gaussian (actually a laser pulse). In...

How do I apply the hanning function to my audio sample?

java,signal-processing,fft,audio-fingerprinting,windowing
I am a university student. I am developing a music identification system for my final year project. According to the "Robust Audio Fingerprint Extraction Algorithm Based on 2-D Chroma" research paper, the following functions should need to be included in my system. Capture Audio Signal ----> Framing Window (hanning window)...

Should I put sin or cos to represent a sinusoidal signal?

matlab,signal-processing
We were asked in an exercise to create a sinusoidal signal of 0.8 seconds with an amplitude of 1 and frequency equal to 100 Hz sampled at 1000 Hz, but in the answer I found: A=1;fs=100;fe=1000; te=1/fe; t=0:te:0.8; s=A*cos(2*pi*fs*t); plot(s); And in another exercise: write a script for a sinusoidal...

High Pass Butterworth Filter on images in MATLAB

image,matlab,image-processing,filtering,signal-processing
I need to implement a high pass Butterworth filter in MATLAB for the purposes of image filtering. I have implemented one but it looks like it doesn't work. Here is the code I have written. Can anyone tell me what is wrong? n=1; d=50; A=1.5; im=imread('imagex.jpg'); h=size(im,1); w=size(im,2); [x y]=meshgrid(-floor(w/2):floor(w-1/2),-floor(h/2):floor(h-1/2));...

Implementing findpeaks in for loop matlab

matlab,signal-processing
I have written the following code for calculating the local maximum and its location in for loop but I get an error that I have a dimension mismatch. What am I missing? Here is my code: for col = 1:3000; c1(:,col)=xc(2:end,col); % matrix xc is my matrix, it could be...

How do I write an iterative version of my recursive function?

c,arrays,recursion,signal-processing,interpolation
I have a function that takes a large array of long doubles (65536 elements) and performs a bunch of mathematical operations to each element which ends up with a modified array which is then returned to main. The problem is, it is recursive and with so many elements, the program...

Fast Fourier Transform in Objective-C doesn't work fine

objective-c,signal-processing,fft,accelerate-framework
I have a method in Objective-C that receives an array of doubles and then it uses the Fast Fourier Transform, however the exit of the FFT doesn't match to what I want. Can someone help me, I don't know what I'm doing wrong? This is my method where fftLength is...

C++ FIR noise filter

c++,filtering,signal-processing
I'm digging up some info about filtering the noise out of my IQ data samples in C++. I have learned that this can be done by using a simple filter which calculates the average of last few data samples and applies it to the current sample. Do you have any...

Matlab cconv and circular convolution

matlab,signal-processing
My goal is to use Matlab to verify circular convolution calculations. I try to do this using cconv. However, Matlab does not give the same answer to problems I know the answer for. Why? An example is the circular convolution modulo 4 between [1, 2, 4, 5, 6] and [7,...

Simulink - Finding index of vector element where accumulation crosses a threshold

signal-processing,simulink
I'm looking to improve the delay estimation portion of a Simulink model. The input is an estimated impulse response for the system. I want the index of the first sample of the impulse response where the sum of the absolute values of it and the previous elements exceeeds a certain...

SignalGenerator class at naudio library - duration time play

c#,signal-processing,naudio
I use naudio for generating a tone in a specified frequency like that: private void gen_Sinus(double frequency) { WaveOut _myWaveOut = new WaveOut(); SignalGenerator mySinus = new SignalGenerator(44100, 1);//using NAudio.Wave.SampleProviders; mySinus.Frequency = frequency; mySinus.Type = SignalGeneratorType.Sin; _myWaveOut.Init(mySinus); _myWaveOut.Play(); } I want that when clicking a button it will play that...

Variable dimension array

python,arrays,numpy,multidimensional-array,signal-processing
I'm trying to save some data into python. The data is composed for a series of text delimited files. The problem is that the files have different len() and I do not know the len() before reading. I was trying to know if it possible to save the files in...

Binary classification of sensor data

algorithm,machine-learning,signal-processing,classification,svm
My problem is the following: I need to classify a data stream coming from an sensor. I have managed to get a baseline using the median of a window and I subtract the values from that baseline (I want to avoid negative peaks, so I only use the absolute value...

Why is there a difference in magnitude response between scipy.filtfilt and scipy.lfilter?

python,scipy,signal-processing
I was trying to filter a signal using the scipy module of python and I wanted to see which of lfilter or filtfilt is better. I tried to compare them and I got the following plot from my mwe import numpy as np import scipy.signal as sp import matplotlib.pyplot as...

High Pass filter matlab

matlab,signal-processing,fft
Im working on spectrum analysis of wav file. I have plotting the spectrum of the whole frequency,but how can i plot just the high frequency of my file ? this is the code : [a,fs] = wavread('ori1.wav'); ydft = fft(a); ydft = ydft(1:length(a)/2+1); freq = 0:fs/length(a):fs/2; plot(freq,abs(ydft)); ...

Determine amplitude of low frequency signals using FFT

c#,audio,signal-processing,fft
I am totally new to signal processing and am trying to make a program that shows the amplitude of low frequency signals in a PCM (WAV) file. So far, I've been able to read in the WAV file and populate an array (actually a multi-dimensional array, one for each channel,...

Detect frequencies in a buffer along the time

windows-phone-8,signal-processing,frequency-analysis,goertzel-algorithm
if I record a series of frequencies beeps into a buffer, for example: 15kHz for 50ms, 17k for 50 ms and goes on, is there any way to "go" along the time plain and to decode this freqs(with goertzel or something)? Hey, this is an update, I've added a code...

How to control red noise generator by another one (Rocket engine effect - Subtractive synthesis of sound)

java,audio,signals,signal-processing,wav
I programming some sound effects in Java and exporting them into .wav files. Currently, I am trying to program a rocket engine sound effect. I want to do it in the following way: The sound of a rocket engine may be synthesized with a red noise generator controlled by a...

Dividing matlab plot into grids

matlab,signal-processing,matlab-figure
I have two different functions of time x(t) and y(t). I want to plot x(t) vs y(t) in matlab . The plot needs to be divided into a 40x40 grid stretching from min and max values of signal in each direction. I then need to calculate the number of grid...

How to Add Harmonics to Sine Waves

c++,signal-processing
Without posting the entire header and cpp files I have some code here that generates sine waves: void CAudioGenerate::GenereateSinewave() { if(!GenerateBegin()) return; short audio[2]; for(double time=0.; time < m_duration; time += 1. / m_sampleRate) { audio[0] = short(m_amplitude * sin(time * 2 * M_PI * m_freq1)); audio[1] = short(m_amplitude *...

Racing/ S-R Circuits?

logic,signal-processing,circuit,flip-flop,circuit-diagram
Following truth table resulted from the circuit below. SR(NOR) latch is used. I have tried several times to trace through the circuit to see how truth table values are produced but its not working. Can someone explain to me what is going on ? This circuit was introduced in conjunction...

Goertzel algorithm giving infinite result

ios,c,audio,signal-processing,dft
I have a sinewave at 20hz - 1 amplitude that I have created using Audacity software. It is also only 500ms. I am using following algorithm to detect the frequency. All I want to detect if tone amplitude passes a threshold and gives me positive result at 20 hz frequency...

Convolution of signals using VHDL

signals,signal-processing,vhdl,modelsim
I have been working on implementing convolution operation using VHDL in MultiSim Student PE Edition. The following code compiles successfully, however When I click Simulate i am getting the following error: # vsim # Start time: 10:32:20 on Apr 26,2015 # Loading std.standard # ** Error: (vsim-13) Recompile work.convolution because...

Efficiently Calculate Frequency Averaged Periodogram Using GPU

performance,matlab,optimization,gpu,signal-processing
In Matlab I am looking for a way to most efficiently calculate a frequency averaged periodogram on a GPU. I understand that the most important thing is to minimise for loops and use the already built in GPU functions. However my code still feels relatively unoptimised and I was wondering...

Matplotlib Magnitude_spectrum Units in Python for Comparing Guitar Strings

python,unit-testing,matplotlib,signal-processing,acoustics
I'm using matplotlib's magnitude_spectrum to compare the tonal characteristics of guitar strings. Magnitude_spectrum shows the y axis as having units of "Magnitude (energy)". I use two different 'processes' to compare the FFT. Process 2 (for lack of a better description) is much easier to interpret- code & graphs below My...

Convert 24 bit signed int signal to 16 bit signed int signal

c++,audio,casting,signal-processing
To put it as simply as I can. I receive data from device and the signal is 24 bit signed int. I want to create 16 bit WAV file. For this purpose I want to keep writing upcoming audio buffer with 256 samples to *.wav file stream. How can I...

Analysis of peaks in MATLAB mesh plot

matlab,image-processing,3d,signal-processing,gaussian
I am carrying out curvature analysis on the image below and need to be able to measure the distance between peaks. Please can someone shed some light on how this is done? I am only interested in the positive portion of the graph and it would useful if the height...

how to plot spectrogram of a specific window in time domain out of the spectrogram of all signal?

matlab,signal-processing,spectrogram
I have produced spectrogram of a signal using matlab like this: [S,F,T,P]=spectrogram(...);%I have used my desired parameters and I have ploted the result :(the spectrogram of whole signal) my question is that now I want to plot a part of this spectrogram which stands for a specific window of my...

approximation of square wave using sinusoidal form

matlab,signal-processing
let us consider following form it is taken from wikipedia source,i have tried to implement in matlab function x_square=square_wave(f); %f-given frequency % let time interval be too big x_square=0; t=0:0.001:10; k=1:length(t); x_square=(sin(2*pi*f*t)+sum(sin(2*pi*(2*k-1)*f*t)./(2*k-1)))*4/pi; end at first time it seems to exactly do as it is given in formula,but it gives me...

How to detect P-R interval from ECG signal? [closed]

matlab,signal-processing
How can I detect P-R interval from an ECG signal using MATLAB ? Can anyone give me code or any steps to determine this ?

circular cross correlation python

python,numpy,matplotlib,scipy,signal-processing
Is it possible to perform circular cross-/auto-correlation on 1D arrays with a numpy/scipy/matplotlib function? I have looked at numpy.correlate() and matplotlib.pyplot.xcorr (based on the numpy function), and both seem to not be able to do circular cross-correlation. To illustrate the difference, I will use the example of an array of...

convert sound to list of phonemes in python

python,signal-processing,voice-recognition,phoneme
How do I convert any sound signal to a list phonemes? I.e the actual methodology and/or code to go from a digital signal to a list of phonemes that the sound recording is made from. eg: lPhonemes = audio_to_phonemes(aSignal) where for example from scipy.io.wavfile import read iSampleRate, aSignal = read(sRecordingDir)...

How to generate pulses at 5khz with 0.01s duration and 0.09s delay?

matlab,signal-processing
I want to generate a continous pulse in Matlab. I would like to generate the signal at 5khz with a duration of 0.01s, then nothing for 0.09s and then starting again. It's kind of a rectangular pulse, except it's in 5khz. I have the following code to output a waveform...

Convolution of two rectangular pulses Python

python,numpy,matplotlib,signal-processing,convolution
I am attempting to find the convolution of two rectangular pulses. No errors are being thrown - and I am getting a suitably shaped waveform output - however, the magnitude of my answer appears to be vastly too large, and I'm also unsure of how to fit a correct x/time...

KISS FFT output with or without windowing

signal-processing,dft,windowing,kissfft
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....

Stereo to Mono wav in Python

python,audio,signal-processing
I am loading a wav with the scipy method wavefile.read() which gives me the samplerate and the audiodata I know that this audio data if stereo is stored as a multi-dimensional array such as audiodata[[left right] [left right] ... [left right]] I am then using this method to create a...

FIR filter understanding matlab

matlab,filter,signal-processing,noise
i'm trying to understand the fir1 filter but i still don't get it. For example here i got an audio signal that i consider noise, i'm passing it through a low pass filter. n = 100000 fs = 11025 handles.noise = wavrecord(n, fs, 'double'); nfilt = fir1(11,0.4); fnoise = filter(nfilt,1,handles.noise);...

Efficiently compute 50Hz content of signal

python,numpy,scipy,signal-processing
Problem statement I have a longish signal (454912 samples) and I'd like to compute an estimate of the amount of 50Hz in it. Speed is more important here than precision. The amount of 50Hz present is expected to fluctuate over time. The value needs to be representative for the entire...

Shifting signals in MATLAB

matlab,signal-processing
I want to implement a system to recognize numbers between 0-9. I have a TemplateSet and a TestSet of recorded audio signals of numbers between 0-9. I have to do cross correlation between all audio files to find the best similarity between them. After that, I should do time shifting...

FPGA: Divide range by fixed number using a look-up table

math,signal-processing,vhdl,fpga,lookup-tables
I have implemented a block in an FPGA which supports hardware multiplication. This block does some division by using hardly any logic elements because it's able to use some internal DSP. This block has to be ported to another design, but here I have 2k less logic elements and no...

Does “16bit integer PCM data” mean it's signed or unsigned?

audio,signal-processing,pcm,fmod
I'm using FMOD to develop an application which would immediately start playing the recording of the next/previous sentence exactly from its beginning in a MP3 file which contains speech, without music, when the user clicked the Next/Prev button. I got the PCM data of a mp3 file by calling Sound::lock,...

Real FFT output

signal-processing,dft,kissfft
I have implemented fft into at32ucb series ucontroller using kiss fft library and currently struggling with the output of the fft. My intention is to analyse sound coming from piezo speaker. Currently, the frequency of the sounder is 420Hz which I successfully got from the fft output (cross checked with...

How to Add external frequency inputs in the analog filter design block simulink in matlab

matlab,filtering,signal-processing,simulink
I want to be able to externally have inputs for the lower passband edge frequency and higher passband edge frequencies for the butterworth filter block in the simulink signal processing toolbox in matlab. How can I achieve this. Currently you'll have to click the block to specify these frequencies and...

MathNet.Filter not filtering data

c#,.net,signal-processing,mathnet
I'm using Math.Net.Numerics to first fill an array with a sine wave, and then using Math.Net.Filtering to create a band pass to filter the data, like so: void Main() { double[] preProcessedData = new double[128]; double[] postProcessedData = new double[128]; //Generate sinewave (350Hz, 250 samples) preProcessedData = MathNet.Numerics.Generate.Sinusoidal(250, 44100, 350,...

Decimate vector in eigen

c++,signal-processing,eigen
I have a float array Eigen::ArrayXf which I need to decimate (i.e. pick 1 out of f.i. 8 samples). Eigen::ArrayXf decimatedSignal = Eigen::Map<Eigen::ArrayXf, 0, Eigen::InnerStride<8> >(signal.data(), length, 1).eval(); which works, with a caveat: I need to know how long length is, and it can be specified too long, leading to...

Why does the frequency spectra change when the sampling frequency is changed?

matlab,signal-processing,fft,frequency,continuous-fourier
Here is my code for generating a triangular waveform in the time domain and for generating its corresponding fourier series/transform (I don't know whether its series or transform because matlab only has fourier transform function but since the signal is periodic, references say that the fourier counterpart must be called...

Understanding normalized frequency in matlab

matlab,signal-processing
I am trying to compare the coherence and Welch transfer function estimate in Matlab of two signals with different lengths but the same sampling rate. When I use mscohere and tfestimate, I get plots versus normalized frequency. Knowing that the upper bound of frequency is the nyquist frequency (half of...

TARSOS DSP for Android: retrieving SpectralPeaks

android,audio,signal-processing,avconv,tarsosdsp
I'm using Tarsos Dsp for android for retrieving spectral peaks from an audiofile. Since version 2, TarsosDSP doesn't use javax which should make everything a lot easier. What is bugging me is that my code is working fine but android is struggling deconding the audiofile: this seems to be made...

Matlab : How to represent a real number as binary

matlab,signal-processing,quantization
How is the Bernoulli Shift Map used to generate the binary sequence? I need to represent the real number as fractions.

Is there a way to filter out frequencies below a certain threshold in a message?

filter,signal-processing
I am writing a program in java and I have a signal that was modulated using FM. If the signal frequency is at 2800Hz it's a '0' and if the frequency is 7200Hz it's a '1'. Is this the right way to modulate it? Also, is there a filter (in...

Daubechies orthogonal wavelet in python

python,signal-processing
I am newbie in Signal Processing, In here I want to ask how to use Daubechies orthogonal wavelet 'db6' to filter a array data, for example like this: x = [1,2,3,4] I have read the documentation in here, but i did not find an idea to do it. ...

Parseval's theorem doesn't work with ifft

python,signal-processing,fft
I have a temporal signal and I calculate its Fourier Transform to get the frequencial signal. According to Parseval's theorem, the two signals have the same energy. I successfully demonstrate it with Python. However, when I calculate the inverse Fourier Transform of the frequencial signal, the energy is no longer...

Applying DataFrame with logic expression to another DataFrame (need Pandas wizards)

python,pandas,expression,signal-processing
I have a DataFrame conditions with a set of conditions that are used like an expression: indicator logic value Discount 'ADR Premium' '<' -0.5 Premium 'ADR Premium' '>' 0.5 Now I have a dataframe indicators with a set of values, in this case there is just one indicator ADR Premium:...

C++ Butterworth Nth order filter design

c++,filtering,signal-processing
I am looking for a function which calculate a Butterworth Nth filter design coefficients like a Matlab function: [bl,al]=butter(but_order,Ws); and [bh,ah]=butter(but_order,2*bandwidth(1)/fs,'high'); I found many examples of calculating 2nd order but not Nth order (for example I work with order 18 ...). - unfortunately I haven't any knowledge about DSP. Do...

Implementing a convolution reverb with rapidly updated impulse responses

javascript,signal-processing,web-audio
i'm doing my master thesis on acoustic raytracing, using WebGL as access point to the GPU horsepower and WebAudio to drive the soundcard. Let's assume, the raytracer is implemented such that it delivers an updated impulse response every frame while a graphics rendering engine runs at 30 frames per second....

DC Term in Python FFT - Amplitude of Constant Term

python,numpy,matplotlib,signal-processing,fft
I've created an FFT class/object that takes signal stored in a 2D array and produces the subsequent FFT of its input, before printing it to a matplotlib graph. After a great deal of reading, I appreciate that due to windowing, the need to have an ideally 2^x number of points...

DC part isolation

matlab,signal-processing,octave
I have a signal consisting of fast oscillating AC part and slowly varying DC part. I need to calcuate its DC part (and envelope, but that's not important now). I could use the STFT, filter and transform it back, but it's a little inefficient cause I am not looking for...

Custom autocorrelation with overlapping sliding window

matlab,signal-processing
I am trying to make a custom autocorrelation function in matlab according to info in the image below: the function works but i get an error that index exceeds matrix dimensions, mathematically it's wright but in programming am i missing something? Here is my code: close all; clear all; clc;...

Quickly Find Non-Zero Intervals

python,optimization,numpy,scipy,signal-processing
I am writing an algorithm to determine the intervals of the "mountains" on a density plot. The plot is taken from the depths from a Kinect if anyone is interested. Here is a quick visual example of what this algorithm finds: (with the small mountains removed): My current algorithm: def...

FFT: find and cut noisy 50Hz in signal

python,signal-processing,fft
I have noisy data (peaks with period 1.8s, 2048 bins per period) for which I want to calculate frequency and delete 50Hz. I'm pretty sure that frequency what I looking for is 50Hz, cause I find it by use originlab. When I try to do the same in python the...

What is frequency-domain entropy in FFT result and how to calculate it?

signal-processing,fft,software-defined-radio
I am a programmer but quit bad on math.. I recently read an article which mentioned frequency-domain entropy,he calculated that thing from a FFT power spectrum but didn't tell me how to do that. I cannot find enough information online to understand what it is . I'm appreciate for any...

Forcing multiple sets of constraints during filter design

matlab,filter,filtering,signal-processing
I am currently using a MATLAB example on generating a Kaiser window finite impulse response (FIR) filter according to pre-determined filter requirements. Kaiser Window Filter Design Design a lowpass filter with passband defined from 0 to 1 kHz and stopband defined from 1500 Hz to 4 kHz. Specify a passband...

Audioread in matlab of wav file and FFT

matlab,audio,signal-processing,fft
I'm working on Matlab, I want to perform FFT on a wav file I previously recorded on Matlab as well. fs = 44100; % Hz t = 0:1/fs:1; % seconds f = 600; % Hz y = sin(2.*pi.*f.*t); audiowrite('600freq.wav',y,fs) This is the way I'm recording in the wav file. Now...

Resampling WasapiLoopbackCapture

c#,signal-processing,naudio,resampling
I'm trying to resample the WasapiLoopbackCapture's output from my soundcards 44100Hz, 16bit, 2 channel waveformat to a 16000Hz, 16bit, 1 channel format for later use in a System.Net.Sockets.NetworkStream (I want to write the converted bytes to the network stream) But I have no idea how to start even! I'm really...

How to check if a neighbourhood of at least five elements of an array satisfies a criterion?

python,numpy,signal-processing
I have a numpy array, and I check for local minima which are lower than a threshold (mean value - 3 * standard deviation). Out of those minima I want to select those which are in the neighbourhood of at least five points which are all below the threshold value....

Python FFT & Magnitude Spectrum of two similar signals have different frequencies

python,signal-processing,fft
My goal is to compare the FFT of similar signals. For some reason, when I take the magnitude spectrum of two signals of the same length, the frequencies are different... I can't do a simple side by side comparison of two signals because of this. Anyone have any tips on...

Transfer function of WaveShaperNode

javascript,audio,signal-processing,web-audio,transfer-function
I'm having trouble understanding how the transfer function for a WaveShaperNode in the Web Audio API works. As I understand, a transfer function is a waveshaper which takes in a signal input x and produces a new signal y. So, y = f(x) I understand that if x equals zero,...

Generate 16 QAM signal

matlab,signal-processing,software-defined-radio
I know the way to generate QPSK signals using the following TxS=round(rand(1,N))*2-1; % QPSK symbols are transmitted symbols TxS=TxS+sqrt(-1)*(round(rand(1,N))*2-1); In the above, the symbols are 2 alphabets +1/-1. But I cannot understand how to generate 16- Quadrature Amplitude Modulation signal for the same alphabet space? Is it possible? Or what...