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
2answers
59 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
1answer
214 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
217 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
47 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
78 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 ...
0
votes
1answer
1k 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
305 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
66 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
58 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
294 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
523 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
39 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
597 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
426 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
1k 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 ...
0
votes
1answer
207 views

Get dB full scale value of a group of wave samples

I am trying to compute the dBFS value of a group of samples (stereo wave file), according to this formula: $$p_{RMS} = \sqrt{\frac{ x_1^2 + x_2^2 + \ldots}n } $$ $$dbFS = 20\log_{10}\frac{ p_{RMS}}{...
1
vote
0answers
884 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
554 views

Biquad filter from Matlab to C using “tf2sos”

This is a biquad implementation I use: ...
2
votes
1answer
465 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
97 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
259 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
88 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
3k 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
630 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
2k 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
69 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
358 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
137 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
2k 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
980 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 modulate my ...
2
votes
1answer
926 views

VIbrato (pitch variation) function

I'm looking for an algorithm for Vibrato audio effect for a cross-platform C++ program of audio processing. Now I use the realization from Chaotic-DAW sources. The problem is that Chaotic-DAW has a ...
-1
votes
2answers
316 views

Signal signs are changing after IFFT reconstruction

I want to take FFT of my signal and reconstruct it back via IFFT. It seems the real part of odd numbered samples and image part of even numbered samples are multiplied by -1 which can be observed ...
1
vote
0answers
274 views

A C/C++ library for FIR filter design with “Don't Care region”

I need to get coefficients for my FIR filter. I know my pass band lets say between 350 - 400 Hz And my stop band(s) lets say 200 - 250 and 500 - 500 Hz, The other regions in the spectrum I simply ...
1
vote
3answers
3k views

3dB and 6dB Per Octave Rolloff Digital Filters / Generating Pink and Brown Noise

So I would like to have a design method for filters with 3dB and 6dB per octave roll off -- for generating pink and brown noise respectively. I know the following 'pinking' filters exist: Filter to ...
1
vote
0answers
68 views

The Rank Of Broadband LCMV Beamformer Constraint Matrix

So I am wondering why I keep seeing that the rank of the LCMV Broadband Constraint Matrix is equal to the number of constraints, when in practice, I find that the rank is only 1. This is precluding me ...
0
votes
2answers
33 views

Window functions and indexes larger than N/2

How does the n index for a window with $0 \le |n| \le N/2$ e.g the Bohman window function, get implemented when having a specific window size? ...
1
vote
1answer
232 views

Fractional/Interpolating Delay Line still sounding glitchy

I'm trying to implement a simple digital delay line. I want it so that when the user changes the delay amount, it sounds smooth and not glitchy. Currently I'm implementing a fractional delay line but ...
1
vote
0answers
464 views

How do I decode(demodulation) and get original data from audio sample data

Here I'm talking about the less-than-ideal situations, in other words, the audio sample data may have burrs or error bits in it. Encode and decode theory: I am using FSK to encode my original binary ...
4
votes
1answer
1k views

Smoothed Square Wave

new here and probably pretty unexperienced compared to the rest of you. This should be simple enough but just wanted some clarification. I'm trying to model an analog square wave oscillator with C. ...
1
vote
1answer
2k views

How to perform sine generation (in C)?

I am interested in how should a listing for a program look like that will generate a sine of f=50hz, using the next arguments for any moment in time. ...
1
vote
2answers
1k views

Forward and backward filtering

I have an input sequence $x(n)$ and impulse sequence \begin{equation} h(n) = \begin{cases} 0 & \quad \text{when } n = 0 \\ .239052 & \quad \text{when } n = 1 \\1.3357\exp(-0.650286n) & \...
0
votes
1answer
236 views

Possible to implement simple IIR filter with greater than 6 db/octave slope?

I am using the following IIR code as a low-pass filter in a software project, and it works great. However, I would like the slope of the filter to be much steeper as the one here seems to be very ...
0
votes
1answer
367 views

How would I go about designing a difference equation for a given type of filter?

I have experience using design tools such as Xilinx's CoreGen and MatLab's DSP tool kit, but I have not really had much experience designing filters from the ground up. Reinventing the filter as it ...
0
votes
1answer
1k views

Help me understanding the super equalizer source code

Please forgive my bad English. Hello, I'm trying to understand Shibatch's super equalizer Winamp plugin source, but I'm not good at DSP and mathematics. It seems that super equalizer plugin uses ...
3
votes
2answers
4k views

Perform Convolution in Frequency Domain Using FFTW?

I'm trying to convolve two signals $x(n)$ and $h(n)$ in C by using the FFTW library's functions to perform a Fourier transform on each, multiply the appropriate complex components together, and take ...
0
votes
2answers
236 views

Playing back an audio file at an arbitrary rate with upsampling and downsampling

Background: My overall goal is to create an audio file player which can playback an audio file at an arbitrary rate. The rate can change continuously as the file plays. This means upsampling to ...
0
votes
1answer
51 views

Fast Fourier Transformation using parallel processing coding for image processing [closed]

I'm now working in parallel precessing -and i want a full code for fast Fourier transform(FFT) written parallel processing Code for any image processing application
0
votes
1answer
342 views

Kiss fft does not work after giving it more than 32 samples

I am trying to take data from an accelerometer and apply Kiss FFT to the samples. I'm using a Freescale Kinetis FRDM-K22F board. I want to use 64 samples, but when I run the program I get an error ...
2
votes
3answers
2k views

Get a N-FFT with two N/2-FFT already computed

After somme researchs on the web, I don't find the answer of my problem (or I don't understand it) and I hope this post will succeed. I'm working on a real-time FFT convolution algorithm (C++) which ...
1
vote
1answer
1k views

Beginner - use FFT to display spectrum/equalizer

At first, I want to say that I'm totally beginner in DSP and I don't have enough math education to understand Fast-Fourier transformation. I'm a programmer and I want to archieve something like ...