# Tag Info

### 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, ...
• 12.9k

### 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 ...
• 47k
Accepted

### How can I generate a sine wave with time varying frequency that is continuous, in C?

Well lets go lol @AnonSubmitter85 give to you a nice answer, but let me show my way to do it in matlab, and this maybe can be very easy to port to C: First I'm creating ...
• 2,048

### How can I generate a sine wave with time varying frequency that is continuous, in C?

It's a little weird to see so many answers but none that presents an actual answer in C or explains how and why to do it. The general idea is to maintain a phase that is incremented by a step size ...
• 198
Accepted

### Cutoff frequency of a first order recursive filter

That formula for the cut-off frequency is a very inaccurate approximation. In this answer I derived the exact relation between the coefficient of a first order recursive averaging filter and its 3-dB ...
• 91.2k
Accepted

### 4th order high-pass filter on a DSP: standard or biquads?

The two solutions in a floating point implementation are assumed to be identical, with the two BiQuads being a factored version of the standard difference equation. The BiQuad is the better way to go ...
• 53.8k

### How can I generate a sine wave with time varying frequency that is continuous, in C?

The easiest way to do this is to note that frequency is by definition the derivative of the phase. Thus, you can define what the frequency of each sample is and then integrate that to get the phase. ...

### 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 ...
• 181
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 + ...
• 86

### How can I generate a sine wave with time varying frequency that is continuous, in C?

In addition to incrementing phase (instead of incrementing time and multiplying by frequency, potentially causing jaggies), also note that the input to your trig function might need to be range ...
• 35.6k

### 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 ...
• 1,269

### IIR Filter Implementation in C results in unstable system response

Using 64-bit floats just papers over an underlying problem. As a polynomial increases in order, the positions of the zeros gets ever more sensitive to the values of the lowest-order terms. Moreover, ...
• 12.9k

### Hilbert Transform in C provides possibly strange results

I am not a signal processing expert, but I have made it a good practice not to mix concepts. There is something called the Hilbert Transform, and there is an analytic signal. Here is what I do to ...
• 61

### Hyperbolic sine "sinh" in fixed-point?

Be careful with that version of the Cookbook. I did not actually write it, although I gave permission to Doug to write it. He has a few typographic errors. The original has been moved. I think ...

### How to set parameters of the PI controller inside the PLL?

Two suggestions to move forward: Reduce $K_i$ to the point of an acceptable overshoot (this will provide the bottom line answer for comparison to the computations. Do system identification (Bode ...
• 53.8k
Accepted

### Implementing a Butterworth Filter Manually in C/C++ via Second Order Sections

c) My code is wrong That one. You have your difference equations backwards. It should be $$y[n] = x[n] + 2x[n-1] + x[n-2] - a_1y[n-1] - a_2y[n-2]$$ You have your "a" and "b" ...
• 47k

### What Approximation Techniques Exist for Computing the Square Root?

One square root expansion that puzzled me in the past is the one for complex magnitude (or diagonal in a rectangle); if $a>b$, then: $$\sqrt{a^2+b^2}\approx 0.96a+0.4 b.$$ Within 4% precision, ...
• 32.1k
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-...
• 32.1k

### IIR Lattice Filter in C programming

assume all of this (except k[0] and the output y[]) gets defined. states g[] are ...
Accepted

### Decoding a PCM BFSK signal (Bell 103)

The frequency resolution is independent of the sampling rate. Consider that in the extreme of an infinite sampling rate (continuous time), the Fourier Transform of a single FSK symbol at either 1070 ...
• 53.8k

### 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 ...
• 3,416

### Implementing a Butterworth Filter Manually in C/C++ via Second Order Sections

My code is wrong Even without assuming that the code's behavior is wrong, for long-term maintainability it has its problems. You'd do much better to structure your code such that you have a data type ...
• 12.9k

### 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 ...
• 53.8k

...
Accepted

### Hilbert Transform in C provides possibly strange results

The function in your question doesn't compute the Hilbert transform. The Hilbert transform can be implemented either in the time domain by filtering the input signal with a filter kernel that ...
• 91.2k