# Audio frequency sweep spectrogram artifacts… hints?

I'm wondering how to interpret artifacts on spectrograms like the following which shows the recording of a linear frequency sweep.

In this case:

• The recording is done with a cheap microphone and cheap sound card, and playback was done using an off-the-shelf system, which could have its own issues.
• There are obviously harmonics which can be seen at the beginning of the chirp, but I can't remember where these can come from, then also those "X" patterns that are catching my attention.
• There are some fixed-frequency perturbations, some constant, some pulsed and periodic

I'm looking for hints, ideas to perform root cause analysis, pointers to common and less common phenomena causing unwanted artifacts.

Collected hints so far:

• Playback issue: speaker saturation or sound clipping, which can cause harmonics, and can be witnessed using another recording device.
• Playback issue: clock desynchronization can cause waveform skips which cause very short pulses (of one sample).
• Short pulses (not on the attached spectrogram, they're short vertical lines) can be caused by power line transient perturbations.
• Missing anti-aliasing filter can cause capture of aliases of non-audible signals.
• Out-of-band noise caused by sigma-delta ADCs (ref) which can also be filtered by low-pass filter.
• Audion noise caused by capacitors in power circuits, eg. in LCD panel amplifiers.
• Your attainment doesn't open for me. – alephzero Jun 29 '17 at 21:17
• Sorry, smaller version of the 5760x864 image here: i.imgur.com/9nfWm8J.jpg – cJ Zougloub Jun 29 '17 at 21:22
• I strongly suspect after some investigations, that the harmonics are actually caused by the speaker used to perform the test, it was saturating (audio clipping) and causing these. Also, the 7.5 kHz pattern is pulsing, it's probably coming from (an aliased version of) electrical perturbation on the microphone wire. The other two frequencies are actually one and its first harmonic, and should also come from the electronics of the recorder. The system is a black box and I don't know if an anti-aliasing filter is used, but I'll try some experiments with more open hardware, and report. – cJ Zougloub Jul 6 '17 at 4:06
• (1/2) Tangentially related anecdote: I have seen anomalies similar to these in spectral plots of audio sweeps we conducted over different telephone systems. PSTN and GSM codecs have quite harsh compression which can severely distort or even completely suppress certain frequencies. PSTN for instance will roll off everything below 300 Hz and everything above 3700 Hz and will actively remove any constant tones. If you want to transmit a "pure" constant tone across PSTN for more than a second or so, then you have to add some white noise along with it (at least in the UK). – user6335 Nov 14 '17 at 10:17
• (2/2) ... Our spectral plots of our experiments look rather like yours but the unwanted harmonics / distortions were much more violently evident. They were so bright that I used them as a desktop wallpaper for a while because they looked so awesome. I've got the picture somewhere... – user6335 Nov 14 '17 at 10:19

The "X patterns" look like anti-aliasing. If you project the first downward-sloping line of the X back upwards, it will probably intersect one of the "harmonics" lines at the Nyquist frequency corresponding to your sampling rate. For example If you are sampling at 48k samples/sec, your FFT will show a signal at $(24+x)$ kHz as if its frequency was $(24-x)$ kHz. On the frequency response plot, this looks the same as if the horizontal line at 24 kHz acts like a mirror, reflecting anything that should have been plotted above it.

The way to get rid of them is to use an analog filter before you digitize the signal. But if you are using "consumer level" equipment, just ignore them.

It's hard to tell guess if the "harmonics" are something you actually measured, or an artifact of your digital signal processing. If they are low amplitude, and you don't have access to any better analysis tools, I would be inclined to just ignore them. I'm assuming you don't have any reliable calibration curves for your sound source, microphone, ADC, etc - a few numbers and/or a little graph pulled out of the marketing material don't count as "reliable" IMO.

Cheap sound cards often are a long way from having linear response in either amplitude or phase at high frequencies - if most people use them for listening to low-bit-rate MP3 files, there's no meaningful high frequency audio content anyway, only random noise!

The constant-level noise lines at 7.5, 9.5 and about 18.5 KHz are presumably coming from somewhere after the microphone input. Again, if you can't find out exactly where they come from (for instance by cutting the signal path to see when they go away) you don't have much alternative but to ignore them. Don't forget that those three frequencies shown on the plot might also be aliases of higher frequency signals!

Update: Note that a chirp signal is never a "perfect" sine wave. If you look at one cycle of the signal, it is distorted slightly because the frequency is changing. The amount of distortion depends on the ratio of the sweep frequency to the chirp frequency. This might explain why you see "harmonics" at the start (low frequencies) of the chirp but then they disappear. Try changing the sweep frequency and see if the amplitude of the "harmonics" changes.

• ... with some interesting hints. I'll try to test your sweep theory in simulation, intuitively I'd be inclined to only see the sweep pattern instantly containing frequencies neighbouring the current frequency. I'll also check if an anti-aliasing filter is here or not, by playing sounds above the Nyquist frequency... somehow. Then about "harmonics", in the case the culprit is not known, the first thing is to look at finding out who's introducing them, player or recorder, by using a third device. – cJ Zougloub Jul 6 '17 at 4:17