Author Topic: Audio spectrums  (Read 674 times)

0 Members and 1 Guest are viewing this topic.

Offline hamster_nzTopic starter

  • Super Contributor
  • ***
  • Posts: 2812
  • Country: nz
Audio spectrums
« on: October 22, 2020, 09:10:33 pm »
I'm not sure the right place to put this, so here goes...

I'm working on crufty software to use a higher quality sound card as an audio test interface, for my use only. I know other software exists that I could use, but a man has to have a hobby. I also what to have repeatability in the testing - so I know things will be exactly the same when testing on different days. I'm not really after a GUI, just an objective set of tests I can run to measure performance of the unit under test under different conditions.

I've got programming ALSA all sorted, and for this current setup I play a 1000kHz tone at 48kHz, 16-bit, while also recording line in. (as I am currently using my development laptops's onboard 16-bit CODEC for now). I've got a loopback cable from out to input.

 The noise is about +/- 14 counts RMS, the signal +/-30.000 counts. I've got my basic analysis going - collecting 4800 samples (0.1s) and running an DFT on them (no FFT yet, as I'm just playing around and performance isn't important). With 0.1s of data each DFT bin ends up to be 10Hz.

A plot of the results is attached.

So... a long build up to the question.

As you increase frequency resolution (longer data set, longer DFT, more bins in the result), I *assume* the noise per bin reduces too - after all, the total power has to remain the same. On a graph the noise floor will get lower.

How do I standardize the measurement so I get roughly scale-invariant metric of noise, regardless of DFT length?

Do I divide the bin's power by the width in Hz to get "power per Hz"?

Do I just remove the test tone bin, and calculate the power of the rest (I guess that leave THD+noise)?

Am I overthinking this?

Or maybe more importantly, are my assumptions wrong?
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22153
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Audio spectrums
« Reply #1 on: October 22, 2020, 09:53:55 pm »
Picking out the signal bin leaves you with THD+N, if that's what you're after then there you go. :)  Use Parseval's theorem to calculate total power.

Dividing a bin by its width gets you noise per BW, yes; though you don't know if this is signal or what (a good guess that the prominent peak is signal, of course :) ).  You'd have to average over all the baseline to get an overall picture of noise -- which, again, it's not an arithmetic average but an RMS one, in other words Parseval's theorem. :)

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf