Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [c]

C is a high level (i.e. not assembler) programming language often used to program DSPs and other embedded microprocessors as well as being used for systems programming. Features of the language make it especially suitable for programming hardware and writing device drivers.

Filter by
Sorted by
Tagged with
0 votes
2 answers
95 views

piecewise linear sqrt in python and C output comparison [closed]

I am implementing a piecewise linear function to linearize the sqrt operation. I am using breakpoints from 0 to 100,000. I have set higher precision in lower breakpoints (as the sqrt changes more ...
Gabriel Galeote-Checa's user avatar
0 votes
0 answers
18 views

How can i add overlap-add into this

Im new to DSP and i wanna know how i can add overlap-add into this to remove artifacts. ...
SignalWhisperer's user avatar
0 votes
0 answers
23 views

How to use an LDPC encoder implemented in C in MATLAB and which (open source) encoder is most energy-efficient?

I am looking for an open source LDPC encoder available online as I just have to use it for encoding raw bits to LDPC-encoded data to estimate the energy consumption. Which is the best encoder from the ...
Anamika's user avatar
1 vote
1 answer
57 views

byte order of P6 ppm image in C [closed]

this is the main function ...
Ishaan Vatus's user avatar
1 vote
2 answers
348 views

How to do FFT with complex numbers - Ansi C code

I have a small issue. I'm going to do FFT2 onto a matrix $X$, and the only library I have is FFTPack. FFTPack is the oldest FFT library, but it's one of the fastest and 100% portable too. The problem ...
euraad's user avatar
  • 405
1 vote
1 answer
77 views

Handling asynchronous MCU I/O peripherals

Technical Background I'm making an audio processing board with an onboard microcontroller that takes in data via I2S from an ADC, applies digital filters, and outputs a stream of the same samplerate ...
theseventhsu's user avatar
1 vote
1 answer
121 views

Getting half the frequency and double the duration from a sine wave generated using C and played using aplay

I am trying to generate a sine wave of 440Hz frequency that lasts for 10 seconds using the following C code: ...
Ishaan Vatus's user avatar
1 vote
1 answer
229 views

3D convolution product with Fourier transforms, FFTW and MPI in C

My question is not really from the field of signal processing but I think you are the most suited for answering my question. I am willing to compute the gravitational potential which can be written as ...
YouShallNotPass's user avatar
0 votes
0 answers
53 views

Converting simulink PID block to C code

I have implemented and tuned a PID block in a simulink model and now i want to convert this block to C code to use on my micro controller I have taken the discrete equation of the PID block and the ...
Boody Alyehia's user avatar
0 votes
0 answers
52 views

What are noise reduction techniques implemented in code, if not graph beautifiers?

How does Noise Reduction techniques implemented in code help us? I am working on an analog accelerometer and while I log the data, I see noise in the data values that is almost constant and in the ...
Diracx's user avatar
  • 1
1 vote
1 answer
167 views

Which DCT implementation is the correct one

I'm trying to compute the Discrete Cosine Transform via FFT in C, using a response to this question, but the recommended solution gives me wrong results. Function DCT in matlab: ...
Jailer's user avatar
  • 13
0 votes
0 answers
748 views

Efficient CIC Decimation Filter in C

Does anyone have advice on efficient CIC Decimation filter implementation. I designed a basic 4th order CIC filter with a 64 decimation ratio in C (below). I am currently testing this on a Sharc SC589 ...
gdsp's user avatar
  • 1
1 vote
2 answers
131 views

Inverting $6 \times 6$ complex matrix on the ARM Cortex M4F processor

I want to invert a $6 \times 6$ complex matrix on the ARM Cortex M4F processor. I have the C code to invert a real matrix using the CMSIS library. Has anyone written a similar C code for complex ...
Gaurang Mohta's user avatar
1 vote
1 answer
1k views

IIR Filter Implementation in C results in unstable system response

I need to implement a basic 6th order Butterworth lowpass filter on a DSP that sampled data at 50kHz. I calculate the coefficients using matlab for a filter with the following step response: $$\begin{...
Mantabit's user avatar
  • 121
3 votes
1 answer
546 views

pocketfft delivers wrong values

does anyone understand how to use the pocketfft by martin reinecke? Link: https://gitlab.mpcdf.mpg.de/mtr/pocketfft Basically it's just this snipped of code: ...
jp21's user avatar
  • 31
1 vote
1 answer
481 views

How can I split a buffered audio signal into multiple frequency bands for visualisation in C?

Currently, I am trying to split a buffered audio signal (buffer size = 1024 samples) into several bands in order to output a bunch of numeric values of their levels (calculated as RMS values). So far, ...
SkyyySi's user avatar
  • 11
1 vote
1 answer
299 views

How to apply hann window to unsigned integer ADC

I am using Arm-Cortex M3 Microcontroller and CMSIS for FFT, my microcontroller does not support floating point unit therefore I have to use fixed point (Q15 or Q31) for calculation. Before calculate ...
lojos's user avatar
  • 13
1 vote
2 answers
820 views

best way to converting data from uint16_t to q15 for least saturation error

Q15 standard is fixed point fraction from -1 to 1 represented by 15 bit, and uint16 is numbers from 0 to 2¹⁶. I have data range from 0 to 2¹², I can directly cast them to Q15 and all the data will ...
mohammadsdtmnd's user avatar
6 votes
2 answers
6k views

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

Short background: I want to implement a lowpass butterworth filter in C/C++. The end goal is to use this in a low-latency Python program, for which of course ...
fabian789's user avatar
  • 163
11 votes
6 answers
5k views

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

I have been working on MATLAB for signal processing for a while. Many companies from DSP for a communication background has asked me whether I know C/C++ very well. I am confused as to why the ...
Sukshith Shetty's user avatar
4 votes
1 answer
524 views

Wrong result when realizing fixed-point biquad IIR filter

I'm implementing a fixed-point direct form I biquad filter with Q1.15 precision. I use fraction saving to improve quantization error. However, my function gives me the different results compared by ...
DSP novice's user avatar
2 votes
2 answers
550 views

Non-Uniformly Partitioned Convolution Implementation

I've succeded in implementing the uniformly partitioned convolution algorithm and now I'm looking to implement the non-uniformly partitioned version. I've had no luck with running parallel threads on ...
Guybrush's user avatar
2 votes
1 answer
75 views

Audio, estimate codec's compression ratio only by content

I am about music audios. These can be compressed by different formats with different degree. (I.e. I don't mean the dynamic compression). After being compressed by a large degree (say 96kbps mp3) the ...
User42's user avatar
  • 87
0 votes
1 answer
51 views

Alg for identifying any temporal interfering signal

I'm a little bit on a loss at my search for an algorithm due to audio signals. I'm a sw-engineer with some basis knowledge in math here and there, know how to build and use FFT etc. but with no prof ...
User42's user avatar
  • 87
0 votes
1 answer
430 views

How to use Pffft FFT library

I am interested to use the pffft library, available here: https://bitbucket.org/jpommier/pffft/src/master/ I am currently using Intel MKL library, as well as a naive optimized reference implementation....
James's user avatar
  • 13
5 votes
2 answers
2k views

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

I am going to implement in C++ software the synchronous frame phase locked loop (SFPLL) for estimation of angle and frequency of the three phase grid 220V/50Hz. For the internal PI controller setting ...
Steve's user avatar
  • 397
1 vote
1 answer
131 views

Phase locked loop for three phase grid

I have been implementing a control software where one of its core functionalities is the ability to synchronize with the three phase grid. Basically I need to implement some form of the phase locked ...
Steve's user avatar
  • 397
0 votes
0 answers
38 views

How to replicate/simulate experiments done on dsp kit 6713 without using hardware?

Due to covid, our university is now offering online classes to under grad students, even labs are conducted online. But we are bit confused regarding evaluation? We make videos of demonstration of dsp ...
cvz's user avatar
  • 11
1 vote
1 answer
368 views

Matrices of complex numbers multiplication

I'm trying to implement the multiplication of two matrices something like this picture in c langage. I want to read the numbers from a text file of x and store it later in an array the code that i ...
lifay010's user avatar
2 votes
1 answer
595 views

How to optimally normalize filter coefficients?

I have designed an IIR filter in Matlab that comprises the following biquads ...
neolith's user avatar
  • 147
1 vote
2 answers
1k views

Simulating a raised cosine filter

I am rewriting a simulation written in Matlab to C. I have a problem with a transmit data. The data is filtered by a raised cosine filter. In Matlab it was implemented by using the following function ...
AD23's user avatar
  • 79
1 vote
0 answers
53 views

filter single radio station with sdr [closed]

I want to write a program to filter a single radio station using SDR. Not for any application just a stepping stone to learn. I am going to use C so it is easier for me to see the steps and things ...
meanthatmuchtoyou's user avatar
0 votes
1 answer
2k views

simple iir filter implementation in C++

I am programming the simplest way of implementing and IIR filter. However, I am struggling with the use of buffers. Do any of you have any simple implementation of an IIR filter implementing manually ...
Gabriel Galeote-Checa's user avatar
1 vote
0 answers
532 views

FIR filtering with C++ to a sinewave

I am translating my FIR filter script from python to C++. My problem is that I am following a workflow which in theory should work but I get weird results. 1st. I create a signal from 1 and 50 Hz sine ...
Gabriel Galeote-Checa's user avatar
0 votes
0 answers
35 views

How to apply an offset to a complex exponential without chopping it off?

I am trying to encode a bitstream as offset in a complex exponential, but when I do, the sinusoids get chopped off. Do I need to apply a lowpass to the bitstream or is there a more elegant way? ...
neolith's user avatar
  • 147
2 votes
2 answers
313 views

Fast algorithm for n-dimensional DCT

I need to implement an encoder which compresses a 5-dimensional structure of 10 bits values. Each dimension has between 4 and 12 elements. If a dimension ever has more than 12 elements, it is ...
Cristian Maruan Bosin's user avatar
1 vote
0 answers
176 views

Are there any State Space Control C libraries?

I'm searching for a C library which implements methods needed for state space control (e.g. state feedback controller and state observer equations). Googling various terms only brought up a non-C (C# ?...
ClBr's user avatar
  • 11
1 vote
3 answers
305 views

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

When sampling a low-frequency sound (like a 55Hz sine wave) I hear an additional high frequency sound at certain sampling rates, but not at others. This happens in Audacity and in my own program. For ...
KTC's user avatar
  • 111
1 vote
0 answers
86 views

Problem with natural logarithmic function in fixed point notation

I am facing a problem with natural logarithmic function in fixed-point notation. Let's say $$x = 0.54, \qquad\text{then}\qquad \ln(x) = -0.616186, \qquad\text{a negative number} \tag{1}$$ Then in ...
rkc's user avatar
  • 59
0 votes
0 answers
36 views

Changing Coherence function from float to fixed point

I want to calculate the coherence between two audio signals. After referring a few websites, I found that the coherence is calculated by using the equation $(1)$ which is as follows $$\rm Coherence = \...
rkc's user avatar
  • 59
2 votes
1 answer
1k views

Coding an LFO in C

I want to know how I could implement a Low Frequency Oscilator on a simple synth I've coded in C. First in order to understand how to make this happen I would like just to modulate a sine wave by a ...
valentin diverchy's user avatar
0 votes
2 answers
1k views

Calculating the true values of biquad filter coefficients from normalized form

I have a C code in which the IIR filter(BiQuad) uses only 4 (normalized) coefficients per stage (a2/a0,a1/a0,b2/b0,b1/b0) instead of 6 coefficients (a0,a1,a2,b0,b1,b2). I know that the value of a0 is ...
rkc's user avatar
  • 59
0 votes
1 answer
3k views

Comparison of results with Direct form1 and Direct form2 implementation of IIR filters

The results obtained from Direct form1 and Direct form2 implementations (in C language) of IIR (BiQuad) filters are a little different. In the implementation, i have made the b0 coefficient as 1. So, ...
rkc's user avatar
  • 59
0 votes
1 answer
117 views

Carrier frequency offset in Bell 103 FSK system

This question is a sequel of the discussion that started in this question. Dan Boschen suggested some very nice solutions to decode a Bell 103 FSK signal. I am especially interested in decoding the ...
LearningDSP's user avatar
0 votes
2 answers
92 views

What's wrong with this implementation of my IIR filter?

I posted this originally in the electronics stack exchange, as it's for an electronic purpose (digitally controlled boost) but it was pointed out to me that this would be the more appropriate place - ...
JustAnEngineer's user avatar
0 votes
1 answer
984 views

Decoding a PCM BFSK signal (Bell 103)

A recent project requires me to get into some basic DSP, in C. I receive PCM samples of a BFSK signal (Bell 103). The sample rate is 8 kHz. The mark and space frequencies are 1070 and 1270 Hz. To ...
LearningDSP's user avatar
0 votes
1 answer
1k views

Calculating Cross Power Spectral density between two complex signals

I have a small misunderstanding of cross power spectral density between two complex signals. I know that it is the Fourier transform of cross correlation between two signals. Let's say the complex ...
rkc's user avatar
  • 59
1 vote
1 answer
119 views

dB SPL readings differ from external sound level meter?

I'm trying to write a program that takes values from a MEMS microphone and calculates the dB of the incoming audio data. The microphone i'm using is this: https://www.mouser.es/datasheet/2/218/...
r0k1m's user avatar
  • 111
0 votes
1 answer
324 views

FIR Filter implementation without padding

Is it possible to implement FIR filtering action without padding the input and coefficients? i.e. Let's say if the input and filter coefficients are of size 4, then the output will be 7 samples. So, ...
rkc's user avatar
  • 59
1 vote
1 answer
213 views

FIR Filter implementation vs Linear convolution implementation

I came across a C code for the FIR filter on one of the websites. It is as follows ...
rkc's user avatar
  • 59