Square Wave Response

GroupDIY Audio Forum

Help Support GroupDIY Audio Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

gnd

Well-known member
Joined
Jan 24, 2006
Messages
285
Hi.

Is there a way to reduce ringing od square wave signal at output of device?

I noticed that my soundcard is outputing square wave with some ringing. No matter the frequency, ringing is with periode of some 50us, which is some 20kHz. And it is quite high in amplitude, overshot some 25% of signal.

It is not like that Gibbs phenomena, but it is assymetrical, ringing type. It looks preety much like this:
http://ptolemy.berkeley.edu/ptolemyII/ptII6.0/ptII6.0.2/ptolemy/domains/ct/demo/SquareWave/SquareWave.htm

Can something be done to calm it down a bit? Maybe capacitor in a cable, or some other simple tweak?

thnx.
...
 
Sometimes cable capacitance can cause instability. Try adding a build out resistance. Something like 100 ohms should be adequate. For balanced wiring use similar buildout on + and - outputs to keep impedance balanced.

JR
 
[quote author="JohnRoberts"]Sometimes cable capacitance can cause instability. Try adding a build out resistance. Something like 100 ohms should be adequate. For balanced wiring use similar buildout on + and - outputs to keep impedance balanced.

JR[/quote]

Thnx, John.
Actually I was scoping directly on output jack, without cable. Shall I try with resistor on cable anyway?
 
I tried with resistors and cable:
1. no cable
2. cable + 100ohm series at card output
3. cable + 100ohm in series at end of cable
4. cable + 10k load at end of cable

All variations are the same, no noticable change at all.

I'm not using 10x probe. I have digital handheld scope/multimeter, with normal multimeter probes, and I never really learned how to use it. I guess thats the problem. :oops:

I recorded signal to another computer, just for test, and waveform is notably different. Basic shape was still the same, but 20kHz oscillation was reduced.

So, is it that scope is making sound card output to oscillate?

What would be proper measurement setup, to get correct results?

thnx.
 
digital handheld scope/multimeter

Hmmm, that could be it. Those things tend to have a low sampling rate, possibly too low to resolve the higher harmonics present in your square wave. You might be running into problems with aliasing. It could be the same deal with the soundcard in the other computer, probably even more so due to an even lower sampling rate.

Just a W.A.G.

Anyway, can you borrow an analog scope?
 
[quote author="NewYorkDave"]
digital handheld scope/multimeter

Hmmm, that could be it. Those things tend to have a low sampling rate, possibly too low to resolve the higher harmonics present in your square wave. You might be running into problems with aliasing. It could be the same deal with the soundcard in the other computer, probably even more so due to an even lower sampling rate.

Just a W.A.G.

Anyway, can you borrow an analog scope?[/quote]

This scope has 8MHz bandwidth. Wouldn't this be enough for 100Hz Square wave? I know perfect square has unlimited harmonics, but I read resonance in range of 30% of signal.
And if it was aliasing, I guess it would change with freq change.
Both cards are in same range output EMU1820m and recording EMU 1212m.

Recording square from 1820m to 1212m soundcard is actually reading less oscillations than viewing 1812m output with scope. So could it be my multimeter probes causing 1820m outputs to oscillate?

I cannot borrow analog scope, but I can cary my handscope to some service, and measure some squares there, to see how the look.
....
 
8MHz bandwidth is on the low side for a scope but I agree, it's more than adequate to display a 100Hz squarewave.

If the small amount of capacitance from your probes is causing the output to oscillate, there's a serious problem with your soundcard!

Your plan sounds reasonable: hook your scope to a square-wave generator with a known-good output and see what it displays. That would eliminate any problems with your scope and probes.
 
Unfortunately the Java applet you linked does not work on my computer so I don't have a visual aid at hand. Nonetheless, I think that the response you see is entirely due to the upsampling filter of your DA converter. There is no need that digital upsampling filter have symmetrical response, though this is usually so. The quest for low latency and/or low DSP power may force the designer to use different filters.

Samuel
 
I'll second what Sam said.. How sure are you that it isn't Gibbs? FWIW The square wave with everything above 20kHz removed can have what looks like an artifact at roughly 20 khz.

On the subject of interpreting high rise time edges with scopes, they typically have a square wave output accessible from the front panel so you can calibrate the lead/lag trim in the scope probe, and confirm accurate reads of HF edges. I don't know if the small hand helds have (or need) that.

I couldn't open the applet either, so mostly guessing here.

JR
 
The applet looks like a standard underdamped response, with overshoot and riniging, where the ringing almost damps out to invisibility on the scale shown before the next transition. If that is what the output looks like at 100Hz from the soundcard, there is significant high frequency peaking in the system somewhere that I would consider unacceptable.
 
[quote author="Samuel Groner"]Just for reference two low-frequency square wave responses from different sample rate converters I measured: square_1.pdf and square_2.pdf.

Does that look vaguely similar?

Samuel[/quote]

No---those look like typical artifacts of digital filtering. The posted applets are basic underdamped second-order-system step responses, no more, no less.
 
Thnx all.
I did some photos now, both from scope and recorded waveform.
Sorry for java applet before.

I recorded 100Hz square to second comp, and then measured the same signal at the end of same cable.
Here are scope pics at the end of cable.
http://84.255.203.119/cardres/scope_06.JPG
http://84.255.203.119/cardres/scope_07.JPG

Measuring without cable, directly on card output, gives no visible difference with scope, so cable does nothing visible to signal. Cable was some 3 meters long.

Recording to another comp, there was some modulation to signal, with period of approx 2.3 seconds. Here is some 13 seconds of recording.
http://84.255.203.119/cardres/scope_01.JPG

Thats probably due to card aliasing, or maybe even screen display aliasing of Cool Pro software which I used. This software uses spline interpolation to display curve between sample points, so modulation may be due to this approximation. Or it may be actually at output of soundcard. Card output peak meter is steady, while second comp card input peak is showing level modulation. But modulation is not visible on scope. Maybe because it is just 1.5 dB, and is too small to be noticed. Playing back recorded waveform again clearly shows that 1.5dB modulation. But that is only with square signal, with sinusoidal signal of same freq there is no modulation.

I made photo at both levels, just for comparison. At lower modulated level, zoom looks like this:
http://84.255.203.119/cardres/scope_02.JPG
http://84.255.203.119/cardres/scope_03.JPG
http://84.255.203.119/cardres/scope_04.JPG
http://84.255.203.119/cardres/scope_05.JPG

And at modulation top, it looks like this:
http://84.255.203.119/cardres/scope_08.JPG
http://84.255.203.119/cardres/scope_09.JPG

Spline interpolated curves may be usefull anyway since splines are probably closer to reality than linear connections between sample points. Actual sample points are those green dots.

Would you say that my scope reads close enough to recorded signal?

If my cards outputs are underdamped, can something be done with extenal damping, like cabling or some circuitry? I will not dig into unit itself, it is all tiny SMD, I better not even think about playing arround there. :?

And possibly philosophical question: Would this ringing be heard at all? My ears are dead at 20kHz, and I doubt I could hear anything up there... :? But would anybody hear such ringing? Does it matter at all?

Also, can such ringing be caused by noisy ground, filled with pulses from several computer switching power supplies? I have seven computers in my studio, and scoping their grounds against mains ground it is all just spikes of all frequencies, up to MHz. Basically nasty pulse white noise.

thnx.
...
 
[quote author="JohnRoberts"]I vote Gibbs.


JR[/quote]

John.
Isn't Gibbs symetrical for up and down slope? I did same scoping on another computer with Terratec Phase28 card, and output is symetrical (square approximation), clearly limited bandwidth. Similar with another computer with Yamaha DSP Factory, also symetrical up/down slope.

With card in question (emu 1820m) there is surely some gibbs too, but main ringing is assymetrical regarding up and down slope.

I also tried output of my master recording comp (emu 1212m), and it is similarly assymetrical as in emu1820m, just a bit less of ringing.

...
 
Here is nice Gibbs explanation, with some fancy looking animation too. :thumb:

http://en.wikipedia.org/wiki/Gibbs_phenomenon
 
Yes, I'm well aware of Gibb's Phenomenon.. and the perfectly symmetrical pre/post ring is the theoretical ideal fourier series, not always what you will experience in real life depending upon the mix of analog and digital filtering, phase integrity of the sundry components, etc.

The typical ringing in an under damped analog filter only occurs after the transient and slowly decays. I looked at several more of you scope photos and they clearly show evidence of pre-ring or the waveform zigging before a major zag. While this pre-ring is smaller than the post artifact, the fact that it is there at all is evidence of digital filtering.

So I remain convinced that at least some of that is Gibbs related.

More questions like what is the source of the square wave (digital or analog). If analog perhaps try LPF it at say 50kHz, 200kHz etc. to see if input anti-alias is well behaved.

JR
 
Back
Top