AKA digital signal processing (DSP). A signal is an information-carrying wave, but in the digital sense, a 'signal' refers to either received or transmitted streams/blocks of data, commonly representing real-world quantities such as audio levels, luminosity, pressure etc over time or distance. '...
4
votes
2answers
54 views
Temporal kernel filtering on video frames coming in a loop
I have a video which I read in a loop frame by frame. For every frame, I want to do temporal kernel filtering, the coefficients of which come from the input variable model (a dictionary). The temporal ...
1
vote
1answer
60 views
Factory to create Finite Impulse Response filters in C++
I've recently begun a project in digital signal processing and am using C++ as the programming language. In this project, I have implemented several finite impulse response (FIR) filters. Many of ...
5
votes
0answers
85 views
Neuroscientific testing
I have written the code below for the following experiment:
Subjects get simultaneous stimulation of left and right thumb and have to tell which one was stimulated "stronger" (with higher intensity, ...
1
vote
2answers
124 views
Perlin Noise Generator
I'm porting a 2-D Terrain Generator from Python to C++ as Python is too slow due to the number of features that have been added.
I'm new to C++ and would like to know of any criticisms that you can ...
0
votes
0answers
10 views
Audio Feature Extraction
Playing around with Matlab and making my own speech recognition system. I wasn't sure as to whether the vectorisation I have done is a good idea or not.
Any pointers would be greatly appreciated
<...
2
votes
1answer
34 views
Find signal's maximum peak in window
I have a 9-dimensional signal (as a csv from this Gist) that looks like this:
A signal peaks every 30 steps. I want to get the maximum values of the peaks in that ...
4
votes
1answer
65 views
Wavelet decomposition of images
I am working on wavelet decomposition and found a formula for it and wrote it by myself for computation.
The formula is:
$$I_{LH}(i,j) = \sum_{p=1}^{N_L} \sum_{q=1}^{N_H}\ L(p)\ H(q)\ I(i+p, j+q)$$
...
3
votes
2answers
272 views
Optimizing C++ equivalent of Matlab `filter` function
Minimum working example below. The Matlab filter function filters the input data x using a rational transfer function defined by the numerator and denominator ...
2
votes
1answer
64 views
Generate a random discrete signal
I currently have this code to generate a discrete signal with random amplitudes, but a fixed frequency:
...
3
votes
1answer
90 views
FFT Convolution
I have written the following routines to convolve two images in the frequency domain which are represented as 2d Complex arrays.
How can I optimize my routines for better performance?
...
7
votes
2answers
78 views
20+ functions for generating different waveforms
I added a guard clause to the functions in scipy.signal.windows, but the way they are currently written means the same 11 lines are now repeated in every function.
...
2
votes
1answer
79 views
Encoding a list of frequencies as WAV audio
This code gets a list of signals with predefined frequency from struc.num
I need to encode it to wave format, so i use this code. This works, but i dont sure it is a correct decision to encode like ...
0
votes
1answer
126 views
Iterative algorithm to convert a signal to Fourier series
I want to show you an iterative algorithm to convert a signal to a Fourier series. When I ran unit tests I gaven following results:
one iteration: 1 sec, passed;
ten iterations: 3 sec, passed.
I use ...
6
votes
2answers
382 views
Averaging a signal to remove noise with Python
I am working on a small project in the lab with an Arduino Mega 2560 board. I want to average the signal (voltage) of the positive-slope portion (rise) of a triangle wave to try to remove as much ...
1
vote
3answers
1k views
Recursively Save Python Dictionaries to HDF5 Files Using h5py
I have a bunch of custom classes for which I've implemented a method of saving files in HDF5 format using the h5py module.
A bit of background: I've accomplished ...
10
votes
1answer
574 views
Simple Phase Locked Loop
Here is a simple Phase Locked Loop, which is a circuit used in radio communications for synchronisation between transmitter and receiver.
The loop works by calculating the (phase) difference between ...
3
votes
0answers
178 views
Reading cell array of vectors with h5py
I have a data stored in .mat files, each .mat contains a cell array of vectors of length ~70. I'm trying to read these .mat files in to Python with h5py, but reading just 1000 cells takes about 7 ...
0
votes
0answers
122 views
Computing the curvature of a 2D image
I have some MATLAB code that computes the curvature of a 2d image. It computes it iteratively using forward and backward differences. Could you offer some tips for how I can optimize this code?
...
5
votes
1answer
180 views
Bode plot filters implemented in JavaScript
The following code is my attempt to create an interactive bodeplot. I used JavaScript using d3.js, jQuery Mobile and math.js. The bode plot shows a lead lag filter in continuous time and several ...
2
votes
1answer
212 views
Least Mean Square channel equalizer
I've written (and tested) a simple least mean square adaptive filter . The steps of the algorithm are:
...
1
vote
2answers
175 views
Calculating the energy of a signal
I have a program to read signal data from 120 files in a folder and performing the energy of the signal.
It works correctly, but execution time is more than 20 mins, so there may be a problem with ...
1
vote
0answers
193 views
Linear interpolation Matlab to C++
I don't have a strong mathematics/Matlab background. I would like to convert this Black level correction function from Matlab to C++. Please comment about on the code style and correctness of my ...
10
votes
3answers
443 views
Speeding up spectrum analysis
I'm trying to speed up this code that loops over an entire spectrum range. It's using a Raspberry Pi, and a rtl-sdr dongle that covers up to around 1.7 GHz. My goal is to be sweep over that spectrum ...
5
votes
1answer
204 views
Comparing FFTs to deduplicate IVR recordings
I've got a Python script that traverses two file trees, checking all .wav files for duplication.
I'm still an undergrad, and have never worked with audio before. I'm not entirely sure this is going ...
2
votes
0answers
827 views
fftshift implementation for OpenCV
I'm trying to implement fftshift from matlab for OpenCV. Can you please review the correctness of my algorithm? Have I missed something? Also, is there a better and faster way to do it?
...
6
votes
1answer
663 views
6
votes
1answer
701 views
Beat detection algorithm implementation
What is the quality of the code I've written? Is it easy to read or is it a low-quality piece of code? Also, is there any way I can improve the algorithm itself (beside changing C parameters)?
...
2
votes
0answers
179 views
Smoothing matrix for visual representation
I recently started playing around with R and am currently trying to plot GPS data points onto a perspective plot. I have a script that works and I get my desired results out of it and it works ok for ...
2
votes
0answers
68 views
One-dimensional convolution using Data.Vector
As part of some code I've written, I needed to perform a 1-D convolution. This convolution ends up happening quite often, so I wanted to optimise it (in some way other than using a FFT, though I could ...
12
votes
2answers
394 views
Find binary sequences with low peak sidelobe level of autocorrelation function
I would like to find all binary sequences from the specified range, which has low peak sidelobe level of its autocorrelation function.
Here is the solution (this is simplified version of the real ...
3
votes
1answer
696 views
Python implementation of multidimensional power spectral density with Welch method
I have done my best to write Welch method implementation for python for multidimensional time series and still in the case of one dimensional time series I am getting inconsistent response compared to ...
6
votes
2answers
136 views
Performance of speech enhancement code for Android app
I wrote a speech enhancement code for an Android App. The algorithm runs on 256 size frames of voice samples. On my PC the code runs per about 5ms per frame, while on my Nexsus 5 it more like 50ms per ...
2
votes
0answers
191 views
Cythonized version of FDCT (fast discrete cosine transform) function, ported from Java
This is my Cython code for an FDCT function (invoked here):
...
5
votes
2answers
150 views
FIR filters in C
I wrote 2 filters in C for the Altera DE2 Nios II FPGA, one floating-point and one fixed-point. I've verified that they perform correctly and now I wonder if you can give examples for improvement or ...
3
votes
1answer
195 views
Calculate FFT from windowed time-based signal
I have a time-based signal (Raw signal) sampled at 6 MHz and need to analyze it in freq. domain.
I'm learning DSP and this is very first time I work with DSP. Could you please help to check if this ...
3
votes
1answer
193 views
Reading a data file for performing a FFT
I'm a bit concerned about function usage. There are so many different libraries/possible ways to do something that I'm not sure if the way I'm working at the moment is reasonable, or what I could ...
4
votes
1answer
368 views
Onset detection using FFT
I am using this onset source code and this fft file to try to perform onset detection. Currently the code is working, but as my DSP and C skills are subpar I could use some advice on how to improve it....
7
votes
1answer
235 views
Computing a Discrete Cosine Transform matrix
I'm learning Haskell and I needed to work with discrete cosine transform matrices, so I made a program that generates text (usable in WolframAlpha) containing the generated matrix.
The elements of ...
3
votes
1answer
95 views
Zero crossings from a 1D signal
I'm trying to get the peaks/zero crossings from a basic 1D signal and am not sure if my naive/basic approach is correct:
...
2
votes
1answer
664 views
Fourier transformation for review
Could someone be kind enough to review the Fourier transformation below please? I'm especially interested in going about unit testing the code (I don't really know where to begin, beyond applying the ...
2
votes
1answer
11k views
Matlab code demonstrating use of fft (Fast Fourier Transform)
I posted the following Matlab script in response to a question on Signal Processing. Here is the questions with my answer.
I am looking for comments on how to make this code more instructive for the ...