Issues with simple waveform recording

I have been having an issue recording audio on my Windows 10 laptop. I was having the issue first with sound I was generating outside of Audacity and then tried this test. I genereated a 440 square wave via Audacity generate menu. Here it is exported:

I played back the square wave previously generated in Audacity from another application and recorded it. Same issue no matter what application I used to play it back. This is the recording exported.

The recordings waveform is very distorted. I have not been able to figure out why. I have tried both WASAPI with loopback and also both MME and DirectSound with Stero Mixer. I have tried adjusting microphone levels and also adjusting “Software playthrough of input” option. No luck with any of there.

Any help is appreciated!
-Tom
waveform-issue.PNG

I have been having an issue recording audio on my Windows 10 laptop.

Probably not. You’re having trouble recording playback or internet sound in Audacity. That’s very different from plugging a microphone in the side of the computer and recording that.

There is no natural pathway to play an internal sound in the laptop and record it. That means running both natural sound pathways, playback and record, at the same time and then connecting them.

We should know that square waves are not natural sound. They won’t go through some sound pathways and even if they do, they may get very distorted. For one example, the A-440 square wave you posted has musical overtones and harmonics at 21860Hz. That’s not a typo. Human audibility stops at 20000 and I think the only reason your wave stopped there was that WAV format won’t go any higher.

It’s possible the only way your computer will allow you to record playback (or internet sound), is to push the playback sound all the way through your soundcard, turn it around and then bring it back for recording. That means all the errors of both sides of the soundcard are in that recording. I bet if you tried a sine wave, it would work a lot better.

So what you have is normal. You are just using an invalid test.

Koz

There’s another odd problem. Your expectations and the computer’s delivery may be different. If you listen to both of those sound clips, they sound remarkably similar. So any normal person would think everything was OK.

It’s only you, who is expecting the accuracy of a multi-hundred dollar sound card, is going to notice that it’s just a laptop.

That brings up an Audacity “problem.” Audacity is an audio production manager, not a wav editor. Audacity will sometimes do electronically awkward stuff because it sounds good. This drives some engineers nuts. Different goals. Note Audacity doesn’t save a sound file. It saves Audacity Projects. If you really want a sound file, you have to Export one. It’s not a natural pathway.

Koz

Thank you very much for the replies, Koz.

I think I follow what you are saying. I will attempt the loopback cable route just to understand better what I can expect there. I would have tried it already but my computer does not even have an input jack.

You are right - I had previously also tried a sine wave and it did look normal.

-Tom

I just tried that test on a decade-old laptop computer. Mine are visibly a better match …

Original 440Hz square & WASAPI recording (all sample rates 48kHz).png
Maybe mismatching sample-rates are the reason yours are visually more different.

Perhaps not “very distorted”, but rather “phase shifted”.
Below shows a 440 Hz square wave.
The second track is the same square wave after passing through a 440 Hz “all-pass filter”. An “all-pass filter” allows all frequencies to pass through without any attenuation See: https://en.wikipedia.org/wiki/All-pass_filter)

The third track is the same square wave after passing through two all-pass filters (440 Hz and 1000 Hz).
All three tracks sound identical, and have identical spectra.

tracks000.png
The only difference between these three tracks is that the phase of the waveform has been rotated by amounts related to the frequency.

The only way to achieve an exact replication of the square wave (so that it still looks like a square wave), is if you have bit-perfect replication (such as copy and paste). If there is conversion between the digital and analog domains, then the visual appearance is certain to change (unavoidable).