Hot answers tagged

5

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 + cascading options * https://root.cern.ch/ - advanced statistical signal processing Both provide generic facade, fall-back implementations as well as performance ...


3

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 hardware is sloppy. For example, cheap laptop sound cards often cut corners in the anti aliasing filters and or clipping management Your operating system is ...


3

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 $$\begin{align}G&=\frac{2R_g}{R_d+2R_g}\\a&=\frac{R_d}{L}\\b&=\frac{1}{LC}\\c&=G\left(a+\frac{1}{2R_gC}\right)\\d&=G\cdot b\frac{}{}\end{align}$$ ...


2

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 processing, statistics, matrix and vector, etc. For implementing a FIR filter for example, one can use the convolution (conv(A,B)) function.


2

This is one tortured piece of code. I strongly recommend to toss it and write whatever you need from scratch. Arguments N filter order or some design parameter fft_size: size of the final vector low_cut: the actual filter impulse Response padded to FFT size Code First loop creates a cosine window of length N and bias it with 0.5 2nd loop zero pads to FFT ...


2

My late night brain made foolish mistakes, for the record, if anyone needs this, the working code is as follows: Header: float state1; float state2; float state3; Implementation: In Constructor: state1 = 0; state2 = 0; state3 = 0; Robert's function: // this processes one sample float first_order_filter(float input, float pole, float zero, float *state) { ...


2

Your calculations are correct, although you should do some kind of sliding average over a few hundred samples or so. The problem seems to be that the sound level meter employs an A-weighting, while your code does not. If there is low frequency noise in your measurement environment, the readings at "silence" can easily differ by 40-50dB. Try measuring a test ...


1

Half average length. What is it? Primarily something the author made up. They design a lowpass more or less as a weighted moving average filter. They simply use the window itself as the impulse response of the filter. That's NOT the same as designing an ideal low pass filter at the cutoff frequency you want and then windowing it down to the filter order. ...


1

yeah, that's the way we've been doing pink noise filters (or "pinking filters") since the 80s. if you ignore edge effects it's made by alternating these pole functions: $$ \log|H_{2k}(j\omega)| = -\tfrac12 \log\left( 1 + (\tfrac{\omega}{p_k})^2 \right) $$ and these zero functions: $$ \log|H_{2k+1}(j\omega)| = \tfrac12 \log\left( 1 + (\tfrac{\omega}{q_k})...


1

Maintain a 2D array/structure/hash table where you Maintain a time frequency pair. Let us take an example, Let X(n,m) denote the spectrogram. Take N point FFTs and take M such FFT instances/time windows. If you want both the spectral peak values an their location then simply modify the code as below, where Y is a 2D array ($N\times 2$) storing both the ...


1

The array of time is obtained from the Sampling frequency $f_s$ and spectrogram window length M, since time duration between consecutive samples will be $T_s = \frac{1}{f_s}$. The array of frequency depends on both $f_s$ and DFT length N. Explanation : Suppose you have total $L$-length data sampled at $f_s$. The way a spectrogram is obtained is dividing ...


1

Spectrogram is obtained using Short Time Fourier Transform technique. It is used to visualize frequency changes over time. Imagine you have a very long signal whose frequency content vary with time. You can be tempted to take the FFT of this whole data. But that will not show you the variation of frequency content over time. So you will have to split your ...


1

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 write a sample for you. These documents are for gnuradio version 3.7 and in gnuradio 3.8 there is c++ code generation and gnuradio blocks are porting to c++ ...


1

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 easily in the code generation report. Pros : The code is easy to read. Integrates almost seamlessly with your code base. Portable. Cons : Slightly slower ...


1

I have heard good things about eigen: http://eigen.tuxfamily.org/index.php?title=Main_Page If you are on iOS I would look at: https://developer.apple.com/documentation/accelerate/vdsp It is possible to call Matlab from C. But hardly portable or something you do for a product. I have reimplemented parts of Matlab several times («a good Matlab programmer ...


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