Adjust DC offset?

Hi there.
I have a signal with a varying pulse-width (which I want) on the +ve-going side of zero, and spikes (which I don’t want) on the negative-going side of the waveform. Solution 1 - crank the DC offset down off the bottom (to use an oscilloscope analogy) and increase the amplitude, which would just leave the pulses.

However, as far as I can tell Audacity doesn’t have any facility for adjusting the DC offset, just the ‘remove DC offset’ facility which is for a completely different scenario. Or maybe there is a different solution?

Apply this code using the Nyquist Prompt effect (see:

(s-max *track* 0.0)

Almost! That chops off the -ve-going spikes. I then need to (from my perspective) shift the DC baseline to the middle of the result (which is now going zero to +ve) so the pulses straddle zero (-ve to +ve).

Oops. of course, now I can apply ‘remove DC offset’, then amplify, works fine.
Many thanks!

Yes :slight_smile:
It would be possible to do all of that in Nyquist commands, but I wasn’t sure exactly what you wanted, so I just gave you the simplest version to do the part that can’t easily be done by other means. Nyquist is extremely useful for oddball jobs.