Skip to content

Instantly share code, notes, and snippets.

@ericfont
Created December 1, 2025 01:19
Show Gist options
  • Select an option

  • Save ericfont/c686fa2d656d9e07ecf60975c7c734ba to your computer and use it in GitHub Desktop.

Select an option

Save ericfont/c686fa2d656d9e07ecf60975c7c734ba to your computer and use it in GitHub Desktop.
something working, with hystersis for comparator and summing input with feedback
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ericfont
Copy link
Author

ericfont commented Dec 1, 2025

so to decimate the delta PWM signal, apply that formula y[n]=x[n]-x[n-1]+a*y[n-1] and continuously accumulate that, and dump every nysquist sampling rate sum as the delta for that nyquist sample. If can get the oscillation to be around 96kHz, then a simple boxcar averager will null that oscillation when downsampling to 48kHz.

Also note during analog reconstruction, a simple notch filter will null around that oscillation.

@ericfont
Copy link
Author

ericfont commented Dec 1, 2025

hypothetical notch filter:

image

Might want to combine notch with general lowpass and maybe notch higher overtones too.

@ericfont
Copy link
Author

ericfont commented Dec 1, 2025

image

nice no jaggedy integration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment