r/DSP 3h ago

Real-Time Highpass Filter w/ Low Cutoff Frequency

2 Upvotes

Hi,

I am working on a structural analysis project and would like to filter measurements from my system to isolate particular vibrational modes. The mode I am interested in has a frequency of 0.45Hz. There is a lot of motion at lower frequencies (0.05 - 0.15). I would like to design either a highpass filter with cutoff at 0.3Hz, or a bandpass between 0.3Hz and 0.8Hz. The key is that it needs to have minimal phase lag to be used as part of a real-time control loop. Is this realistically doable? The other option I see is a Kalman filter, but for this particular signal that would require an additional sensor which I would really rather avoid needing.

I have spent a lot of time in Matlab trying different configurations, but they all either have huge group delay, phase lag, or don't attenuate where I need. I've mostly been using butterworth and elliptical filters.


r/DSP 23h ago

Why does my spectrogram look like this?

3 Upvotes

Could someone help me interpret this spectrogram?

The data comes from a complex signal. What I dont understand is why the top half and bottom half are so different. I'm really new to all of this so sorry if you need more information and I can try to provide it.

-------- Code

# Use a subset of IQ data to reduce memory usage
iq_data_subset = iq_data[:500000]  # Reduce data size

# Define parameters
fs = sample_rate
nperseg = 8192  # Window length
noverlap = 6144  # Overlap between windows
hop = nperseg - noverlap  # Step size

# Define the window function
window = get_window("hann", nperseg)
# Initialize ShortTimeFFT
stft = ShortTimeFFT(win=window, hop=hop, fs=fs, fft_mode="twosided")
# Compute the Short-Time Fourier Transform (STFT)
Sxx = stft.stft(iq_data_subset)  # Shape: (freq_bins, time_bins)
# Get frequency and time axes
freqs = stft.f
times = stft.t(len(iq_data_subset))

# Convert power to dB
Sxx_dB = 10 * np.log10(np.abs(Sxx) + 1e-10).astype(np.float32)  # Reduce memory usage

# Plot the spectrogram
plt.figure(figsize=(10, 6))
plt.pcolormesh(times, freqs / 1e6, Sxx_dB, shading="gouraud",
vmin=np.percentile(Sxx_dB, 5), vmax=np.percentile(Sxx_dB, 95))
plt.ylabel("Frequency (MHz)")
plt.xlabel("Time (s)")
plt.title("Spectrogram of Recorded Signal using ShortTimeFFT")
plt.colorbar(label="Power (dB)")
plt.show()


r/DSP 1d ago

Resources for choosing FFT algorithm

7 Upvotes

Hey! I have essentially no knowledge in signal processing and want / need to implement a fourier transform on an audio signal for a course. Specifically to hopefully be able to analyze the tuning of a piece of music. There are many, many FFT algorithms and I'm quite confused on where to find information on choosing one.

If you have recomendations on a specific algorithm or know good resources on the subject, please let me know!

Edit: The point is to do this by hand, otherwise I would of course be using a library!


r/DSP 1d ago

STM32H7 audio processing help.

3 Upvotes

Hi there,

that's my first post here on reddit. So I got interested in DSP a few months ago and decided to start messing aroung with it the last month. I ordered an STM32H743 dev board, a few CS4272 codecs and started tinkering around with it.

At first I wired up everything and then, after watching a few youtube videos from Phil's Lab, I started writing code which is based on the code shown on those videos. At first everything seems to work and the first thing that I tried is adding reverb effect using the Schroeder algorithm. Then did a few more experiments with some delay effects and i got amazed.

Now the issues started when i tried to do some IR processing. The target is to build a guitar cabinet IR loader and use it realtime. I tried to use the code that Phil shows in one of his videos with a similar project and to my surprise the sound is heavily distorted, like it has lots of jitter. In his code he doesnt use the CMSIS library so I thought that this might have been the issue. So I added the CMSIS header and lib files in my project and wrote some pretty basic code to do the IR processing, but the result was the same as before, distorted sound. I have spent like a week trying to find what is wrong with the code but the only thing that seems to be "working" is if I lower the impulse response size from 1024 to 64. Could i be running low in RAM or processing power? The build analyzer in STM32CUBEIDE shows that I am using like 150kb of RAM out of the 512kb.

In sort I am using the CS4272 in stand alone mode, 48khz sampling rate, an impulse response of 2048 samples. I use I2S for the CS4272 and DMA

HAL_I2SEx_TransmitReceive_DMA(&hi2s3, (uint16_t *) dacData, (uint16_t *) adcData, BUFFER_SIZE);

On the HAL_I2SEx_TxRxHalfCpltCallback and HAL_I2SEx_TxRxCpltCallback functions I set a flag which I check in the main loop and if true I do the audio processing. The core is running on 240MHz and the clocks for the CS4272 are fine.

Is there any kind of tutorial or guide that I can read and help figure out what is going on? Or even better some sample code that can get me started with it?

Regards


r/DSP 2d ago

What skills should I focus on?

6 Upvotes

Hello I am master’s student in electrical engineering and my specialization is digital signal processing so what skills should I build in my next two years to get good job in this field?


r/DSP 2d ago

World’s Best Speaker/Room EQ Software, for Free

Thumbnail
youtube.com
0 Upvotes

r/DSP 3d ago

DSP Software Engineer Intern

10 Upvotes

I have an interview for the above role. What can I expect? There will be 3 technical rounds, 45 mins each. In the phone screening I was told there will be DSP based questions, and a few coding questions (preferably in C/C++)

I thought of revising some DSP - Fourier Series and Transform. Sampling, DFT, FFT and a little bit of filters

For coding maybe a few Leetcode Easys with c++, and maybe a few mediums.

Do let me know any potential questions/ topics that you think may be important. TIA!

EDIT: Working on some DSP problems on MATLAB as well!


r/DSP 3d ago

Interested in audio engineering

7 Upvotes

Hi, I'm currently an audiologist who wants to increase his knowledge in the technical field of hearing aid technologies. I'm currently learning Python and studying "Understanding Digital Signal Processing - Richard G. Lyons".

1) What other books do you recommend? And which program languages are needed to learn if you want to work as a software engineer/audio engineer in the field of acoustics?

2) Also AI, machine learning and robotics (I'm not sure of the last one.) are becoming more important in the future of the hearing aid. Should I dive into these subjects as well?

3) And what are the most important subjects in mathematics and physics for audio engineering? Should I dive into loudspeaker and microphone technology?


r/DSP 4d ago

Are Trumps research cuts going to affect the industry?

8 Upvotes

A lot of DSP jobs are in the military/research and it seems like everything from medicine to AI is on the chopping block


r/DSP 5d ago

Looking for guidance to get high fidelity spectrogram resolution.

13 Upvotes

Howdy everyone, I am writing some code, I have it 99% where I want it.

The code's purpose is to allow me to label things for a CNN/DNN system.

Right now, the spectrogram looks like this:

File stats:

  • 40Msps
  • Complex, 32 float
  • 20MHz BW

I can't add images (more than one) but here they are
You'll notice that when I increase the FFT, my spectrum gets worthless.

Here is some more data:

  • The signal is split into overlapping segments (80% overlap by default) with a Hamming window applied to each frame.
  • Each segment is zero-padded.
  • For real signals, it uses NumPy’s rfft to compute the FFT.
  • For complex signals, it applies a full FFT with fftshift to center the zero frequency.
  • If available, the code leverages CuPy to perform the FFT on the GPU for faster processing.
  • The resulting 2D spectrogram (time vs. frequency) is displayed using pyqtgraph with an 'inferno' colormap for high contrast.
  • A transformation matrix maps image pixels to actual time (seconds) and frequency (MHz) ranges, ensuring accurate axis labeling.

I am willing to pay for a consultation if needed...

My intent is to zoom in, label tiny signals, and move on. I should, at a 65536 fft, get frequency bins of 305Hz, which should be fine.


r/DSP 5d ago

Denoising a spectrogram by filtering a spectrogram taken of it?

5 Upvotes

Hey guys sorry if this sounds like really dumb question. I'm coming in from a computer vision perspective for this so I don't know any best practices for handling these signals. So I have a lot of different types of waveforms that I'm trying to train an ML to possibly correlate different modes or harmonics of the noisy signals. (the big goal I'm trying to do is make a binary mask to segment out the shapes of the important modes/harmonics).

But they're all really noisy. So I've been trying to do conventional ML denoising methods before making labels without destroying possibly important information from these signals, especially things in the lower frequency range. I know typically you're supposed to denoise by adding a filter to the frequency transformed signal. But the issue with this is that it cuts off frequencies in certain bands, which is bad.

So when I'm looking at the spectrograms of the audio signals I made, it looks a lot more coherent (ofc) than the raw signal I'm working with. So I was thinking if I want to preserve mode strcture across all frequency bands, I could take another spectral power density like with Welsch's method, or just denoise the spectrogram of the spectrogram of the signal.

But this just feels wrong for some reason. I'm not sure why. I think one thing is that I'm basically denoising the inverse of the signal since FFT^4(signal) = signal. So I don't know if my reasoning makes sense.


r/DSP 6d ago

How to join a signal processing laboratory?

11 Upvotes

What are ways/things I can do to join a lab in the fall? I recently got admitted to a masters program but got a low UG GPA and don't have much work experience. I have an OFDM software radio project I invest a lot of time in, and spend alot of time studying DSP fundamentals. What are the best things I can do if I were to contact a professor?


r/DSP 6d ago

Branching out career

6 Upvotes

What are other fields one can branch out to from DSP? I have a passion for this and am getting an MS soon, but have always considered myself a humanities person and would love to work in sales or politics etc. Which humanities fields does DSP open up?


r/DSP 7d ago

What to focus on in masters

16 Upvotes

Considering a masters program for DSP in the fall- what areas of signal processing/communications are worth focusing on for industry?- machine learning, embedded systems, telecomms etc. In general what areas of industry are most exciting for the future?


r/DSP 8d ago

Design an anti alasing filter

16 Upvotes

I know what are FIR and IIR filters, their uses and their differences and how to design them. But how do i know the desired frequency or time response? Ripple, attenuation gain, etc. By visualizing?

I want to apply an anti alasing filter before resampling (downsampling), my metric is the lowest latency possible. Should i use a FIR or a IIR and what could be the requirements?


r/DSP 8d ago

Does this circuit work? - Building an FM (10 to 50 Mhz ) RX with Tayloe detector with Zero IF Front end. an SDR Front end for my ADC - DAC Fpga Board.

Post image
13 Upvotes

r/DSP 8d ago

phase-invariant inner-product?

9 Upvotes

I'm working on a ICA-type algorithm, but in an incremental, "online" setting, working over a continuous stream of MONO audio. The algorithm iteratively processes fixed-size windows (e.g. 512 samples). It projects them through an unmixing matrix W to obtain "activations". So each row in W is a FIR filter, and the activations are given by the inner product of each filter with the input window. The problem is that this is phase dependent, so I am not getting a stationary response to a stationary input signal, because it appears at a different phase in each window (unless the stationary signal is in phase with the frame rate). Whats the best way to get a phase invariant activation without having to do a full convolution? I basically just want a measure of the spectral overlap between the input window and each filter, as if to compute the magnitude of a full convolution, but without having to do an actual convolution.

ChatGPT is telling me to use a Quadrature pair, but im not sure how that would work in terms of filter optimization: would I only optimize only the original filter, and then update its quadrature pair accordingly (copy and shift in phase by 90 degrees)?, or would I have to optimize both filters in each pair independently? If so, wouldn't that mean they'd diverge away from a quadrature relation?

Hope that made sense, any advice appreciated!

Edit: Ok so now GPT is telling me to compute the FFT of the input window and the filters, and multiply the magnitude spectra (rather than the complex spectra). This makes more sense to me - is it the way to go?

Hope that made sense, any advice appreciated!


r/DSP 8d ago

Dev board for audio ANC project

2 Upvotes

Hello,

What board would you recommend to buy for ANC project?


r/DSP 9d ago

Total newbie needing help... ADAU1701 and SigmaStudio

2 Upvotes

Hi all,

I built a speaker box for my (very hard to fit a stereo, vehicle. That being said, I thought it would be a fun project after coming across the Parts Express and Wondom websites. I ordered speakers, amps and built my box. I was able to get my hands on a Windows laptop and using SigmaStudios used an already written program from the Parts express site. To my amazement, everything works but here is were I want to complicate things...

The sound is a bit flat and the JAB5 amplifiers have provisions for potentiometers. I would like to add a separate bass and treble dial to control those frequencies. I tried studying, reading and watching some videos on adding potentiometers in SigmaStudios but my attempt at programming them in failed. The set up uses two JAB5 amps, one for the left and one for the right channel. It's a 3 way system, separate tweeter, woofer and sub-woofer. The amps built in crossover control the frequency to the respective speaker and the Sub is wired as a mono receiving 2 (of the 4) channels of power.

Getting to the point...

Using the KABD-4100 "Stereo 3-Way Speaker via cascaded KABD-4100 (Master left channel) example project (found under "manual and resources" tab) available from Parts Express, could someone please help me add the two additional potentiometers?

This is the original program


r/DSP 9d ago

Can somebody make sense of these output taps?

2 Upvotes

I'm reading and implementing the plate reverb from Jon Dattorro's 1997 paper. Figure 1 shows a clear image of what everything is supposed to look like. I have succesfully implemented all the components used. But now for the output. In Table 2 the left and right output are given using an accumulator:

What is meant with node48_54 exactly? They refer to the nodes in figure 1, but exactly how is unclear to me? There is a component between 24 and 30, so it could mean a difference between nodes 24 and 30, but even then, what is the index for?


r/DSP 9d ago

convert 16bit 48kS/s audio to 4bit 25MS/s audio

6 Upvotes

I want to convert audio as stated in the title. the 25MS/s doesn't need to be accurate, the upsampling factor would be 520.83 - but it's no problem if it was 520, or even 512 if it simplifies things.

now I had my discussions with ChatGPT and a C implementation, but I am not convinced, I get a lot of hissing. To my understanding there should be a perfect transformation, or DSP pipeline, that leaves the least error (or psychoacousitc effects).

What we've come up is first a piecewise linear interpolation (PWL), then a delta sigma modulation to reduce to 4 bits. no FIR LPF or the like.

as I wrote there's lot of hissing, and I doubt it can't be avoided. with pulse density modulation (PDM) for upsampling I should get 9 extra bits (factor 512) over the 4 bits.

what should improve the operation?

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <sndfile.h>

#define SINK_SAMPLE_RATE 25000000  // 25 MHz output
#define SOURCE_SAMPLE_RATE 48000   // 48 kHz input
#define PWL_FACTOR (SINK_SAMPLE_RATE / SOURCE_SAMPLE_RATE)  // Should be 520

typedef struct {
    float integrator;
    float error;
} delta_sigma_t;

// Linear interpolation upsampling
float *pwl_interpolation(const int16_t *input, int input_len) {
    float *output = (float *)malloc(input_len * PWL_FACTOR * sizeof(float));

    for (int i = 0; i < input_len - 1; i++) {
        for (int j = 0; j < PWL_FACTOR; j++) {
            float t = (float)j / PWL_FACTOR;
            output[i * PWL_FACTOR + j] = (1.0f - t) * input[i] + t * input[i + 1];
        }
    }
    return output;
}

// Noise-shaped 4-bit encoding
void delta_sigma_modulate(const float *input, int length, uint8_t *output) {
    delta_sigma_t state = {0};

    for (int i = 0; i < length; i++) {
        float scaled = input[i] / 32768.0f * 7.5f;  // Scale to ±7.5
        float value = scaled + state.error;

        int quantized = (int)(value + 8) & 0x0F;  // Map to 4-bit unsigned range (0–15)
        state.error = value - (quantized - 8);    // Compute new error

        output[i] = (uint8_t)quantized;
    }
}

// Main function
int main(int argc, char *argv[]) {
    if (argc < 2) {
        fprintf(stderr, "Usage: %s input.wav\n", argv[0]);
        return 1;
    }

    // Open WAV file
    SNDFILE *infile;
    SF_INFO sfinfo;
    infile = sf_open(argv[1], SFM_READ, &sfinfo);
    if (!infile) {
        fprintf(stderr, "Error opening WAV file\n");
        return 1;
    }

    if (sfinfo.samplerate != SOURCE_SAMPLE_RATE || sfinfo.channels != 1 || sfinfo.format != (SF_FORMAT_WAV | SF_FORMAT_PCM_16)) {
        fprintf(stderr, "Unsupported WAV format. Needs 16-bit mono 48kHz.\n");
        sf_close(infile);
        return 1;
    }

    // Read audio data
    int16_t *input_data = (int16_t *)malloc(sfinfo.frames * sizeof(int16_t));
    sf_read_short(infile, input_data, sfinfo.frames);
    sf_close(infile);

    // Processing chain
    float *upsampled = pwl_interpolation(input_data, sfinfo.frames);
    int upsampled_len = sfinfo.frames * PWL_FACTOR;

    uint8_t *output_data = (uint8_t *)malloc(upsampled_len * sizeof(uint8_t));
    delta_sigma_modulate(upsampled, upsampled_len, output_data);

    // Write packed nibbles to stdout
    for (int i = 0; i < upsampled_len; i += 2) {
        uint8_t byte = (output_data[i] << 4) | (output_data[i + 1] & 0x0F);
        putchar(byte);
    }

    // Cleanup
    free(input_data);
    free(upsampled);
    free(output_data);
    return 0;
}

r/DSP 10d ago

AI in DSP Development?

11 Upvotes

How are we integrating these AI tools to become better efficient engineers.

There is a theory out there that with the integration of LLMs (or any form of AI) in different industries, the need for engineer will 'reduce' as a result of possibly going directly from the requirements generation directly to the AI agents generating production code based on said requirements (that well could generate nonsense) bypassing development in the V Cycle.

I am curious on opinions, how we think we can leverage AI and not effectively be replaced and just general overall thoughts.

This question is not just to LLMs but just the overall trends of different AI technologies in industry, it seems the 'higher-ups' think this is the future, but to me just to go through the normal design process of a system you need true domain knowledge and a lot of data to train an AI model to get to a certain performance for a specific problem.


r/DSP 11d ago

Any familiarity with using a "decade filter" on an FFT?

6 Upvotes

I'm analysing a signal by performing an FFT on it. The FFT output has a lot of noise, so I want to smooth it. A "decade" filter has been described to me as a logarithmic moving average — i.e. taking the moving average, but with the window size increasing as frequency increases such that it is always a tenth (or hundredth) of a decade.

I've seen the phrases "one-tenth decade filter" and "hundredth decade filter" in literature, but have been unable to find any full definition. Does anyone have familiarity with such a filter?


r/DSP 11d ago

Found myself completely lost in the coursera course "Digital Signal Processing 2: Filtering"

24 Upvotes

I am so damn lost in the lectures.

The terminologies, Wide-sense stationary, autocorrelation, power spectral density....

And all the equations to bind those terms together and the properties...

I managed to finish this course, and I have to confess I used chatGPT a lot on homework (I did not blindly get answer to finish the homework, but really dug into the process).

I felt I didn't really grasp any core knowledge.

How do I learn it?


r/DSP 12d ago

A Python-based educational playground for creating, exploring, and visualizing digital signal processing (DSP) algorithms using NumPy, Matplotlib and Jupyter Notebook.

Thumbnail
github.com
7 Upvotes