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
0answers
4 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, then ln(x) = -0.616186, a negative number => (1) Then in fixed-point notation, the value of x ...
0
votes
0answers
28 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 = \...
0
votes
2answers
46 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 ...
0
votes
2answers
52 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 ...
0
votes
1answer
32 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, ...
0
votes
1answer
26 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 ...
0
votes
2answers
46 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 - ...
0
votes
1answer
140 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 ...
0
votes
0answers
12 views

Looking for a good implementation / API for the radon transformation in C/C++

I am currently working on a project about Metal artifact reduction (MAR) for CT images. I am looking for a good implementation of the radon transformation and a backtransformation, ideally filtered ...
0
votes
1answer
32 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 ...
1
vote
1answer
62 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/...
0
votes
1answer
68 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, ...
1
vote
1answer
56 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 ...
10
votes
8answers
4k views

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

How can I generate a sine wave with time varying frequency that is continuous? How can I resolve the following problem? I want a continuous graph. I'm generating this simply like this: ...
0
votes
1answer
36 views

Given a static time domain signal, why does the magnitude oscillate in the frequency domain after FFT?

I'm trying to: Generate a sine wave in the time domain (locally within my program at 500 Hz). Analyze it with FFT Print the results in the frequency domain. The expected results are that since the ...
0
votes
1answer
47 views

Kalman filter using only location information

I have never used a Kalman filter. Is it possible to implement a Kalman filter using only location information? In addition, if you can implement it, what kind of procedure should be used to program ...
2
votes
0answers
104 views

How to work with portaudio?

I am working in a project to record audio and process in real-time in C.For starting, I wanted to check how it works. I downloaded the pa_stable_v190600_20161030.tgz from here. I ran ,/configure and ...
2
votes
0answers
105 views

Understanding and converting Matlab's coarse frequency compensation function

I am trying to understand and convert to C Matlab's coarse frequency compensator the documentation for which can be found here: Documentation Matlab's design itself is based on this IEEE paper: ...
0
votes
0answers
194 views

Simple and Efficient FFT C or C++ code for HLS implementation

I'm working on my project and it's related to speech processing. I have to implement parts of the project on an Intel FPGA board using Intel HLS Compiler that converts C code to RTL code for FPGA ...
0
votes
1answer
87 views

Translating Matlab scrambler function to C

I am trying to implement the following matlab function in c: Mathworks scrambler Function Documentation This is the code I've written: ...
0
votes
2answers
1k views

How to design a digital filter in python that will run over an uC?

I am trying to implement a digital filter over a uC (it doesn't really matter which filter and which micro controller because I'm looking forward to learn how to do it in the future with different ...
0
votes
2answers
90 views

Hyperbolic sine “sinh” in fixed-point?

As part of an audio peaking filter calculation, I need to implement hyperbolic sine ("sinh") function in a fixed-point arithmetic (fixed-point DSP processor). What is the proper way to do this?
1
vote
2answers
721 views

Hilbert Transform in C provides possibly strange results

I am calculating some signals that depend on the Hilbert Transform and, after following various guides online and SO, my function looks like this: ...
1
vote
1answer
414 views

How to properly filter a BPSK demodulated signal?

I am new to this field and yesterday I began a project for BPSK modulation. So this is what i did: $\ x(t) = 0 $ or$\ 1 $ binary data $\ Fs = 15 $ sampling frequency kHz $\ Fc = 10 $ carrier ...
0
votes
0answers
61 views

BPSK demodulation [duplicate]

For experimental reasons i created a function that helps me to modulate a signal using BPSK, the input signal is {1,1,0,1,0} and it works fine ...
0
votes
4answers
126 views

Circular buffer wrap around with chorus effect

I am developing an embedded DSP audio processor and am trying to implement a chorus effect. To my understanding, the chorus effect is multiple delayed versions of the original signal, where the delay ...
1
vote
1answer
5k views

What exactly is “sparse representation”? [closed]

I saw a recommended topic for the final project in my university called "dsp and dip applications using sparse representation techniques (MATLAB, C, C++)". I consider taking this topic as my final ...
1
vote
1answer
394 views

how can I make a simple lowpass filter with this constraints? [closed]

I'm searching for a simple low pass filter code in C with this constraints a modulable frequency cutoff (how can I convert all these crazy coefficients into a frequency?) I could change with a slider....
0
votes
2answers
77 views

Pitch fluctuates unexpectedly in simple sine function

I wrote a very basic C program to play a sine of a user-specified frequency. In the interest of portability, I have it spit values directly to stdout, so hopefully you can reproduce my problem on your ...
0
votes
1answer
76 views

Difference between filtering using Matlab and filtering using C code generated by Matlab

hi,has anyone used Matlab coder to generate C code for a filter? Here is the thing: I tried to filter the same audio signal using Hamming window-based FIR bandpass filter, the filter is designed by ...
1
vote
1answer
407 views

How to convert floating point code to fixed point?

I am working on converting a floating point MATLAB code into fixed point C code. The code is to be run on a DSP platform, the specifics of which are yet to be decided. I'm new to floating point to ...
0
votes
2answers
688 views

IIR Lattice Filter in C programming

I would like to implement Lattice IIR filter in c, i can't defined the value of gN, i know that x(n) = fN(n), but how to initialize gN ?. you can find the algorithm here : n
1
vote
1answer
44 views

Finding a change in a signal

I am looking to some C algorithm(for MCU), where I have these signals : First graph you can see that there is an event in the middle and it goes back to normal, second and third there is some event ...
2
votes
2answers
785 views

Trouble with fixed-point arithmetic 2nd order IIR implementation in c

DSP newcomer here! I am tinkering around with a TI DSP and am trying to implement a second order IIR filter in C. Input is 16 bit 2's complement, as is the output, the accumulator is 32 bit wide. I ...
0
votes
1answer
560 views

How can i measure soundcard latency?

I want to write sonar/radar like sample application. For sake of simplicity (and not to use Arduino and specialized RTOS) - I simply used using audio in/out analog ports of a motherboard integrated ...
0
votes
3answers
2k views

Convolution and Deconvolution in C

I understand the theoretical foundations of convolution, but now that I'm trying to program it I'm having some issues conceptually. Say I have two blocks of 64 audio samples each. I also have access ...
1
vote
0answers
1k views

Decimation function implemented in standard C [closed]

I'm thinking in a decimation C function. The prototype of the function is: decimate(int N, float input[], float r, float output[]) where N is the length of array ...
1
vote
1answer
732 views

Biquad filter from Matlab to C using “tf2sos”

This is a biquad implementation I use: ...
2
votes
1answer
597 views

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

I have two C implementations of 4th order high-pass filter (fs = 16 kHz, cut-off=100 Hz, designed using Matlab ...
1
vote
1answer
104 views

Detection milliseconds signal using a DVB-T dongle as SDR in C (need idea)

I have probably amateurish problem. Assume that we have a USB tuner DVB-T + connected antenna. I would like to write a program that will detect the signals of at most a few milliseconds. Signal ...
2
votes
0answers
323 views

How to use linear predictive coding to compress voice diphone samples?

I'm working on an experimental diphone / unit selection speech synthesizer for my native language which lacks good speech synthesizer for blind people. The problem is that recorded unit library can ...
0
votes
0answers
103 views

Bit Scaling Audio Streams

I posted this in stackoverflow but a poster suggested I ask the question here too... Basically, I'm getting a USB audio stream in the form of a unsigned 8-bit integer pointer. I want to convert ...
1
vote
2answers
4k views

IIR coefficients and difference equation implementation in C language

I can't find anything on this topic, so either I'm in the wrong direction or else there is just nothing about it on the internet. So let's say I have 3 $b_i$ coefficients ($b_0,b_1,$ and $b_2$) and 2 ...
0
votes
1answer
898 views

Time-domain cross-correlation with padded signals [closed]

I have a frequency domain cross-correlation implementation written in C (based on: https://github.com/dMaggot/libxcorr). It uses the library FFTW3 and this is the gist of it: ...
2
votes
1answer
4k views

Cutoff frequency of a first order recursive filter

I've implemented a very simple first order recursive low pass filter in c using the algorithm: ...
2
votes
1answer
72 views

Difference equation with complex zero

Let's assume I have the following transfer function: $$ H(z)=\frac{z-\left(\frac{1}{\sqrt{2}}+i \cdot \frac{1}{\sqrt{2}}\right)}{z} $$ It looks like a first order highpass-filter with a complex zero ...
0
votes
2answers
482 views

Aliasing Square Wave

I'm having a really weird issue with generating waveforms from frequencies C1 to C8. When I generate sine waves, everything sounds good; no problems whatsoever. However, when I generate a square ...
0
votes
0answers
205 views

Translating Bessel filter from python to C - odd behavior past the cutoff frequency

I recently translated the code from scipy.signal.bessel to C in order to implement a bessel filter in a piece of analysis ...
12
votes
4answers
3k views

Recommendation for book - Writing DSP code in C

I am looking for some good book, that simply show how you actually write a code in C, to do all the main DSP methods . FFT. Low-pass and high-pass filters. Auto-correlation. Noise processing. And ...
0
votes
2answers
1k views

Audio frequency modulation algorithm

I have a digital audio signal (float samples). I need to apply the Vibrato effect to a signal. "Vibrato" is no common term, but it is the same as the frequency modulation. So, I need to ...