Harmonic analysis fails on audio from u-phono, somewhat works through laptop mic, works perfectly on wav file

I’m observing kind of weird behavior. Three different scenarios, in each scenario the signal source is the same - a sawtooth signal generated by a Yamaha Reface CS synthesizer. I’m taking this signal and doing a harmonic analysis on it with a plugin in Audacity (eg. Fre(a)koscope or SPAN).

  1. In the first scenario, the Reface is attached to a Behringer UFO202 (audio-usb interface) which is attached to USB port on the computer. Harmonic analysis totally fails in this case, it can’t/doesn’t recognize any harmonics and generates a blank graph.

  2. In the second scenario, the Reface’s built-in speakers are placed near my laptop’s built-in mic, so audio is recorded “over the air” as it were. Harmonic analysis somewhat works - it’s able to pick out the partials although their widths are wrong.

  3. In the third scenario, the Reface is attached to Line-in on my Juno-Gi synth. The Juno records the audio onto one of its tracks, then exports the track as a WAV file, then I import the WAV audio into Audacity. In this case, Harmonic analysis works perfectly - the locations, heights, widths of the partials are exactly where they should be.

I’m assuming the Behringer (#1) is introducing some noise or degradation in the signal, but it’s weird because if you zoom into the wave form it looks exactly like the waveform from #3 … so I don’t understand why the plugin can’t make sense of it. Furthermore, is the Behringer really that much worse than my laptop’s cheap built-in microphone?? It seems unlikely. I’ve played around with “Noise Reduction” and Amplitude without any improvement.

I’m baffled. I’m thinking about buying a Yamaha AG06 to replace the Behringer, but I don’t know whether that would help. Maybe there’s something I’m missing?

If the keyboard-output was dual-mono in anti-phase, then the signals cancel-out completely :
total destructive-interference. Then you have no net signal to analyse.
If you have two channels temporarily split into two mono, then apply your analysis plugin to one of those tracks only.

If there was anti-phase it would not be preserved “over the air”.

Trebor: thanks for your response. I’m pretty sure it’s not what you suggested, because I can see a waveform, I can hear it, and I’ve applied the plugin to each L and R independently.So I don’t think it’s an anti-phase thing.

I did notice that, in case #:, on the Reface synth if I lower the octave, and increase the filter cutoff, the plugin is able to analyze the harmonics properly. Maybe the Behringer is attenuating the higher frequencies?

I’ve decided to go ahead and get a better quality USB-audio interface. Or at least a more expensive one, which hopefully means it’s better quality. The Focusrite Scarlett 2i2. Once that comes in, I’ll test again with Scenario 1 and see if there’s any difference.

Before you spend the Christmas-money on new hardware,
can you tell us what’s the plugin you’re using for the “Harmonic analysis” ?.
( If I can find a free copy maybe I can work out how it can fail completely in some occasions ).

Fre(a)koscope: http://mdsp.smartelectronix.com/freakoscope/

Fre(a)koscope has a freeze button. If that’s on the display will not change.

Fre(a)koscope is a more than decade old, free, beta-software, written “in a few days”

Some of the vintage plugins from the same source will not work properly, or at all, on modern computers.

I would not buy new hardware on the basis that Fre(a)koscope now isn’t working properly.

Maybe, but it does work if I lower the octave and set the filter cutoff higher. This kinda leads me to suspect that the Behringer is attenuating the higher frequencies.

It also works flawlessly if I import a wav file instead of recording the audio from the Behringer.

It just occurred to me …
Behringer U-Phono is designed to be connected to a turntable, so has has RIAA equalization built-in.
Behringer U-Phono should be switched to LINE, not phono (RIAA), if you’re connecting it to a keyboard …

Behringer UFO202 U-phono, on phono, (for keyboard switch to line) .png

Thanks for the suggestion, but I’ve already got it switched to “Line” mode.

Are you getting a good recording? Does it sound OK and does the waveform look OK in Audacity? The Behringer interface should work fine (assuming long it’s not defective).

You can’t get a “perfect” sawtooth wave because digital audio is sampled* and then it’s filtered (smoothed) by the digital-to-analog converter. The higher the frequency, the more imperfect the waveform will be. However, it should sound perfect and the harmonic/spectral analysis should be very good as long as you limit the analysis to the audible frequency range (about 20Hz to 20kHz).

A better interface that works at higher sample rates may give “better results” beyond the audio range.



\

I’m pretty sure I’m getting a good recording. The waveform looks fine, and it sounds fine.

I’ve made a little bit of progress in narrowing this down. It occurred to me that my Juno-Gi can act as an USB-audio interface, so I tested it and got the same results as the Behringer. So I’ve ruled out the Behringer as the cause of the problem, which leaves two things:
a) signal degradation is happening in the laptop USB driver
b) audacity is introducing signal degradation when recording from the usb interface

I should be able to rule out (or confirm) (b) by using a different VSTHost instead of Audacity. I’ll try that next.

I did some more experimenting with some interesting results. I downloaded a simple free Audio Recorder, set it to take input from my USB interface (Behringer), set it to 44100kHz sampling and 16-bit resolution, and then set it to record as I am playing a saw-wave note on the Reface CS. This audio recorder can record either to an OGG file, or an MP3. I chose OGG 112kbps first, then I imported this file into Audacity and ran Fre(a)koscope on it. At least there was a graph with this, but it was very noisy and Fre(a)koscope could not analyze the harmonics. Then I chose MP3 192kbps, imported it into Audacity, ran the harmonic analyzer and it works perfectly.

From this we know: the Behringer works fine, the USB-audio driver on the computer works fine, something is wrong with Audacity’s “Recording Device - Microphone (USB Audio CODEC)”.

OCENaudio is free & can save in loss-less formats like WAV & FLAC.

When you make an MP3 of ~150kbps, a low-pass filter @ ~17kHz is applied in that encoding process: some high-frequencies are cut out.

If what you’re investigating are high-frequency components (>17kHz) they will be lost after encoding to MP3,
unless you use “extreme” or “insane” bit-rates.

The moral of the story : don’t use lossy-compression formats like OGG & MP3.

Ok, I feel like an idiot. I’ve been barking up the wrong tree all along. A fundamental flaw in an assumption I made early on. I had assumed that Fre(a)kosopce was doing a real-time analysis - that is to say, as the audio file played along, it would analyze whatever particular spot it was at when I pressed “Apply”. As it turns out, that’s not what it does. What is actually does is analyze the entire selected portion of the track. So, of course, if it’s a long clip there’s a lot more stuff (noise or whatever) in it and it can’t be analyzed. So the fix is to select a shorter clip.

Well, it’s not an entire waste, I did learn a few things along the way, but I still feel foolish.

OCENaudio’s version of “plot spectrum” may be of interest :
it continuously re-plots the spectrum as you change the selection, (it’s quicker than Audacity) …

OCENaudio's version of ''plot spectrum''.gif

Thanks for the suggestion of OCENaudio. I’ll check it out.