Skip to main content
27 votes

How can I work on DSP using C/C++?

MATLAB is a desktop computing environment, that's designed to make it easy to do math in batches. And if you were to have access to the MATLAB source code, you'd find that as you dig down into it, ...
TimWescott's user avatar
  • 12.9k
18 votes

How can I work on DSP using C/C++?

C/C++ is the standard language for real time and embedded signal processing. MATLAB is in most cases way too memory hungry and way too slow. There is a lot of signal processing happening in, for ...
Hilmar's user avatar
  • 45.7k
17 votes

Fastest implementation of fft in C++?

I was also searching for fast FFT library to be used from C++. Let me share what I think the situation is in 2019. FFTW is the most popular FFT library. It has plenty of features and it's often used ...
marcin's user avatar
  • 271
11 votes

Signal processing in Python vs C++ (band-pass filter)

Not really an answer but too long for a comment. Standard software development and debug techniques should solve this Don't use code on real data before it has passed all unit tests First write the ...
Hilmar's user avatar
  • 45.7k
8 votes

How can I work on DSP using C/C++?

I come from the game development world, and I knew C/C++ programming way before I did my first signal processing program (in the context of audio filters for games), so I hope I can give you another ...
Panda Pajama's user avatar
7 votes
Accepted

Recommended C/C++ General Purpose DSP Libraries

Maybe a bit late, but since others might land here like me. The following are good signal processing libraries/frameworks: * https://www.gnuradio.org/ - lots of classic signal processing + ...
Angrond's user avatar
  • 86
7 votes

How can I work on DSP using C/C++?

I find it borderline misleading to even call MATLAB a programming language. –Well, it is a Turing complete language... but so is Brainfuck (BF). You can theoretically write any software in it (given ...
leftaroundabout's user avatar
4 votes
Accepted

What exactly is "sparse representation"?

Take a sine-like signal $s$. In the appropriate Fourier $\mathcal{F}$ domain, it is represented by two "peaks", the other coefficients being zero. Fourier is a sparse representation for sines or close-...
Laurent Duval's user avatar
4 votes

Power spectrum of a pure sine problems

Since FFT treats the signal as if it is periodic you need either to apply a window function (for example hanning) on your signal or make it coherent. In the image3 ...
Claes Rolen's user avatar
4 votes

Find smoothed first derivative from signal with noisy slope

I think least squares is going to be the best approach, and that's not going to be that computationally expensive (I think! Please correct me if I'm wrong). The gradient can be estimated from a ...
Peter K.'s user avatar
  • 25.9k
4 votes

How can I work on DSP using C/C++?

In addition to the several answers already given here, I just want to link this superb answer from @Fat32. My focus is on MATLAB and the bad rap often directed at it (I am not one of them). As it has ...
Gilles's user avatar
  • 3,406
3 votes

How can i measure soundcard latency?

Here are some approaches to consider: FMCW: Transmit a "chirp" signal where the frequency transmitted is slowly ramped from a low frequency to a high frequency (repeatably as a sawtooth or ramp ...
Dan Boschen's user avatar
  • 52.4k
3 votes
Accepted

DSP using audio IO from PC using C++

The best performance you will be able to squeeze out of a PC is with an audio interface that supports ASIO. To be able to get near 10ms of total delay (input and output) you will also need a very ...
A_A's user avatar
  • 10.7k
3 votes
Accepted

What did I do wrong with this simple filter build?

Your analog transfer function looks OK. For the sake of clarity - and to reduce the chance of making errors - I'd just rewrite it as $$H_a(s)=G\cdot\frac{s^2+as + b}{s^2+cs + d}\tag{1}$$ with $$\...
Matt L.'s user avatar
  • 90.5k
3 votes

Sampling a low-frequency sound doesn't work at some sampling rates

Could be a few things You may be borderline clipping. Your sine wave has an amplitude of 1, which is just at the edge of clipping (depending on how its rendered). Try it with an amplitude of 0.5 Your ...
Hilmar's user avatar
  • 45.7k
3 votes

How can I work on DSP using C/C++?

First of all, as others mentionned you should learn about embedded programming, real-time programming and C/C++ That being said, there are ways to minimize the Matlab to C/C++ conversion. First method,...
Ben's user avatar
  • 3,777
3 votes
Accepted

True Peak detection II

I think you are suffering needlessly here. This is a well known problem with an equally well known solution. Below is the code for up sampling by 4 with a 32 tap FIR filter. The error for the worst ...
Hilmar's user avatar
  • 45.7k
2 votes

Recommended C/C++ General Purpose DSP Libraries

I was looking for a way of converting MATLAB code to C/C++ that I found Armadillo: http://arma.sourceforge.net/license.html. It's a C++ library covering various categories such as signal and image ...
Alireza's user avatar
  • 21
2 votes

Recommended C/C++ General Purpose DSP Libraries

I have used Matlab Coder/Embedded Coder/Simulink Coder toolboxes from Mathworks to convert Matlab/Simulink to C/C++. They work well. The code is easy to read and you can navigate from C/C++ to Matlab ...
Ben's user avatar
  • 3,777
2 votes
Accepted

Basic FIR Filtering with audio buffer in C++

Your implementation of the delay line is flawed. It's just copying the second last sample over each element. Try this instead: ...
Peter K.'s user avatar
  • 25.9k
2 votes

Aquila DSP C++ Library - Wave file FFT analog frequency off by factor of 4?

An alternative to other answers (that sugguest you're passing real-values to complex-fft). One common mistake that results in exactly this error is an incorrect sampling rate parameter. It would ...
jmaturner's user avatar
2 votes

Parameters of Gaussian Kernel in the Context of Image Convolution

When dealing with Gaussian Blur in the Image Processing context the following holds: The Standard Deviation, $ \sigma $, is sometimes called radius. I think this ...
Royi's user avatar
  • 19.9k
2 votes
Accepted

A PID that can handle 2 inputs for my application

If you require two outputs, which belong to a movement in x and the other in y direction, you could start with the assumption, that both movements are independent an simply implement two PID ...
user6522399's user avatar
2 votes

Block normalization of histogram of oriented gradient

I stucked at this question too, because overlapped blocks will be divided twice, right? and so I found these : 1 http://www.geocities.ws/talh_davidc/#cst_extract 2 https://stackoverflow.com/...
itonia.x.i's user avatar
2 votes
Accepted

C++ based FIR filter design using GNU Octave remez function

After some debugging and remez.cc source code investigation, I found the correct way to use the backend C++ implementation for Octave's remez function. Thanks to @SleuthEye the latest version of ...
yc2986's user avatar
  • 133
2 votes
Accepted

Why Is Non Linear Least Squares Method from MATLAB and Alglib Gives Different Results on the Same Data?

When you solve Non Linear Least Squares problem of a non convex cost function the end solution (Which is guaranteed to be a Local Minimum) will depend on: Method of Minimization. Method Parameters. ...
Royi's user avatar
  • 19.9k
2 votes
Accepted

Signal in frequency domain with OpenCV dft

Your sine wave should use 2pi instead of frame rate. Also, your frequency data should have window size/2 points and go from 0 to frame rate/2, not frame rate.
Dan Szabo's user avatar
  • 1,038
2 votes

Biquad high-pass filter not working as expected

There is (at least) one error in your routine. It concerns the definition of alpha. The correct formula is $$\alpha=\frac{\sin(\omega_0)}{2Q}$$ However, you ...
Matt L.'s user avatar
  • 90.5k
2 votes
Accepted

I wish to create a GNU Radio program in C++ that doesn't need GRC or Python, is there a reference or template for this?

you can create flowgraph in c++ like gqrx and i think GNU Radio Manual and C++ API Reference documents will help you. This is gnuradio c++ document for top_block if you could not use it let me know to ...
FONQRI's user avatar
  • 136

Only top scored, non community-wiki answers of a minimum length are eligible