I am running Audacity 2.0.6 on Windows 8.
When viewing the headphone output of my computer on an oscilloscope a 1khz sine wave looks perfect. But when I output a clipped sine wave, I get a bizarre waveform that does not look like any kind of linear or non-linear distortion that I have ever seen.
Any suggestions about what may be going on would be greatly appreciated. I have attached jpegs of the waveforms.
Between the digital data on your computer and the display on your oscilloscope, some frequencies are arriving at the oscilloscope display a little later than other frequencies, and that can distort the waveform in all kinds of pretty ways.
Are you familiar with an “all-pass filter”?
It’s much like a normal “high-pass” or “low-pass” filter, except that it passes all frequencies, high, middle and low. Although it does not “block” any frequencies, what it does do is to slightly delay some frequencies more than others, causing a “phase shift” at certain frequencies. The effect of this is much like what you are seeing.
Try this:
Generate a square wave (Generate menu > Tone → select “Square” as the waveform, 440 Hz as the frequency and 0.5 as the amplitude.
Zoom in close to see the “square” waveform.
Double click on the track so that it is selected.
Effect menu > Nyquist Prompt.
Copy and paste this code into the Nyquist Prompt text window:
(allpass2 s 1000 2)
That is a simple way to apply an “all-pass filter” with a centre frequency of 1000 Hz and a “Q” of 2.0.
The all-pass filter does not affect the frequency content, but it does affect the “phase” of different frequencies.
6) Click the OK button - isn’t that pretty
Not the same, but a similar thing to your phenomena.
Thanks, that is very interesting. I will explore that some more.
As an update: I got the same result using Goldwave software; but on another laptop I got an accurate reproduction of the waveform.
Also when I input a square wave into my iPhone 5s it captures a similar distorted waveform.
Frequency dependent phase shift would explain why it isn’t heard with music and voice.
Does anyone know if this is a common issue with sound chips/sound cards?
Is your computer applying special effects to the headphone system? I got stuck with “cathedral sound” effects on a computer under test for a long time before I figured out what was going on.
“This thing just will not pass standard sound tests…”
In scientific / engineering equipment, they go to great lengths ($'s) to prevent such things from happening. For sound cards, they don’t. It doesn’t really matter in terms of sound quality if there is a bit of frequency dependent phase shift, so why push up the price of the product for the sake of something that doesn’t affect sound quality?
Out of interest, I had a go at reproducing that waveform by applying an all-pass filter to a truncated sine wave.
This is the code:
(setf s (clip (mult 2 (hzosc 500)) 0.5))
(allpass2 s 300 0.1)
The first line generates a truncated sine wave.
The second line applies a second order all-pass filter.
Thanks everyone.
As suggested, I found a setting in my sound card driver, “Disable All Effects”, which cleared up the problem.
The observation that my problem was phase distortion was very astute and should also will help me in solving my iPhone issue.