How to vertically shift waves

I’m looking for an effect to download that moves the audio in waveform towards or away from the poles. I Googled this, and got Vertical Zoom (We’ve all had a time where Google confuses something for another, right?), and DC Offset Correction. Basically, I want a DC Offset adjuster. If it doesn’t exist, how would I make one in Nyquist, could I make a synthesized wave set for 0 Hz and adjust that?

How to make this in NYQ or where to download a such plugin? Help would be appreciated. Thank you for reading and helping.

Any specific reason you want to add a DC offset to your signal?

Here is one way to do it using Nyquist:
The amount of DC is from 0 (nothing) to 1 (full scale).
The code below only adds a positive DC offset to either mono or stereo tracks.

;control dc "DC offset (0 - 1)" real "amount" 0.5 0 1

(if (arrayp *track*)
(vector (sim (aref *track* 0) dc)(sim (aref *track* 1) dc))
(sim *track* dc))

Screen Shot 2022-01-27 at 7.56.57 AM.png
Before adding a DC offset:
Screen Shot 2022-01-27 at 8.01.03 AM.png
And after:
Screen Shot 2022-01-27 at 8.01.31 AM.png
Zoomed in view:
Screen Shot 2022-01-27 at 8.03.58 AM.png

I want a DC Offset adjuster.

Why? We should hit that first to avoid going around the barn for a job that Audacity will never be good at.

Audacity is an audio editor. Audio had a zero point in the middle with a graph of positive and negative air pressure up and down. If you’re trying to make Audacity do some other job, it would be good to know.

For one example, a positive or negative offset of the blue waves represents wind or a breeze, not audio.


If you want either a positive or negative DC offset, here you go:

;control dc "DC offset (0 - 1)" real "amount" 0.5 0 1
;control action "Polarity" choice "Positive, Negative" 0

(if (= action 1)
(setf dc (- 0 dc)))

(if (arrayp *track*)
(vector (sim (aref *track* 0) dc)(sim (aref *track* 1) dc))
(sim *track* dc))

Screen Shot 2022-01-27 at 8.19.18 AM.png

Well, if you’re wondering… when I was copying old VHS tapes to my computer as videos, the audio’s position is off (could be an unsigned/signed error?). The idea is to manually adjust the off-set to normal, and I was going to see if I could fix it… manually. The picture/link shows the error caused when transferring audio from VHS to the computer.

Or you could apply a highpass filter of say 10 Hz.
You won’t be cutting out anything important as not much audio in
that frequency range.

A DC offset in audio is never a good thing, but since you asked to generate some… :wink:

Winston wrote:

could be an unsigned/signed error?

My money is on a problem or design fault with the ADC.
Seen that before with some models of USB “grabbers”.

If you just want to remove the DC offset, you can use Effect > Normalize instead. It’s got a “remove DC offset” button.

Normalize instead. It’s got a “remove DC offset” button.

That’s the preferred method. The High Pass Filter technique can give you pops, clicks, or damage at the beginning and end of the correction depending on the amount and direction of the damage. The Normalize/Remove DC tool provides an overall average of all the selected waves above and below the zero line—as a legacy audio system with no DC response would do.

Best is avoid the problem by getting a transfer interface that doesn’t do that. 6dB offset is a lot of damage. The first time you hit a transfer with a loud performance, it’s going to clip the waves and permanently damage the sound.

Chances are terrific that the offset isn’t the only damage. It’s only the obvious one.


Koz wrote:

That’s the preferred method.

It depends on the use case.
Normalize will certainly work, however to say that a highpass will introduce clicks and noise, is not always correct.
In the case of the OP, he would most probably remove DC from the whole file anyways.
In that case, a highpass may actually help reduce thumps due to DC discontinuities.

Plus VHS ain’t exactly hifi, so attenuating (highpassing) frequencies below 50/60 Hz (PAL/NTSC)
will actually be beneficial with some recordings, to get rid of field/frame scan noise that sometimes
plaques VHS recordings and playback.

Likewise, there ain’t much above 14 KHz, so a lowpass filter will reduce potential line noise.
(15.625 KHz for PAL and 15.750 KHz for NTSC).

Note however, filters do have limitations, and one of them is phase delay and can cause peaks.
However, it’s nice to have options, depending on use/application.

Since Audacity is used for so many different applications, the manual method can be put to another use,
i.e. generating complex waveforms for step and impulse response testing of audio/analog circuits using spice simulations.
(Note that the spice simulator will not play the wav file through the “normal” output, but rather apply it to the circuit).

You can create crazy waveforms like such:
(Just don’t play them through your speakers or headphones, export as a mono wav and use it as a step source in your simulations).

Screen Shot 2022-01-27 at 5.43.27 PM.png
By using high sample rates (192 KHz), you can create short pulses with a resolution of around 5uS.
That is nearly a line synch pulse width for good old analog video. :wink:
The slew rate will also be pretty darn good, so any skewing/undershoot/overshoot you see in the simulation,
will be from circuit under test.
Screen Shot 2022-01-27 at 6.07.22 PM.png