Head-Fi.org › Forums › Equipment Forums › Sound Science › OK, so what CAN I reliably measure from a PC soundcard ?
New Posts  All Forums:Forum Nav:

OK, so what CAN I reliably measure from a PC soundcard ? - Page 3

post #31 of 51

Some more experiments on the above described onboard loopback, now I tried to measure the impulse response using the MLS added to the test sample:


resample -il 128 -r 44100 -k 11 -d 7 lb_fixed.wav mls.wav
convolve mls.wav ir1.wav 10010000000000000 -inv=1 -g 2
resample -k 3.4721088435374 -d -131071 ir1.wav ir2.wav
resample -il 128 -k 2.89882 -d 0.5 -r 96000 -l=1 ir2.wav ir3.wav
convolve sample2.wav sample2f.wav ir3.wav

sinetest -d 12 -c 1 -f 2500 -a 0.9 -p 0 sample2f.wav

    Channel #1: frequency = 2500.00000000 Hz
                amplitude = 1.95878840 (5.839750 dBFS)
                phase = 259.633841 degrees
                frequency correction = 1.000000000000
                amplitude correction = 0.45946770 (-6.75490030 dB)
                start time = 1.073311517954 s (103037.9057236 samples)

sinetest -d 12 -c 2 -f 3000 -a 0.9 -p 0 sample2f.wav

    Channel #2: frequency = 3000.00000000 Hz
                amplitude = 1.95877476 (5.839690 dBFS)
                phase = 23.533111 degrees
                frequency correction = 0.999999999998
                amplitude correction = 0.45947090 (-6.75483978 dB)
                start time = 1.073311543414 s (103037.9081678 samples)

average delay = 1.073311530684

resample -il 128 -k 20.073311530684 -d 29.78544217687 -g1 0.45946770 -g2 0.45947090 sample2f.wav C.wav


The result is limited to a bandwidth of 22.05 kHz, but here is the frequency and impulse response (in the latter there is some extra ringing because of the band-limiting, but it can be seen that RealTek used a linear phase DAC filter):




C.wav is the original sample converted to 96 kHz, convolved by the measured impulse response, and synchronized and level matched with A.wav and B.wav. In theory, it can be subtracted directly from B.wav for a null test, but because of the imperfect synchronization (phase drift over time because of not matching the sample rates exactly) and impulse response, this does not give great results, but is still worth listening to. Adding another test tone after the music would allow for more accurate synchronization.

I also tried to use the Audio DiffMaker, but it did not work well with the default settings, I need to experiment more with it.


Anyway, here is the difference file, amplified by 40 dB. While it is possible to hear the original sound, highpass filtered and getting louder over time, because of the phase drift, it already reveals hiss and some odd vinyl-like pops and clicks as the most noticeable artifacts. I am not sure if the pops are just interference, or an artifact of the DAC. There is no evidence of any heavy distortion; not that I expected it (I measured 0.00x% THD and IMD values), but many claim that cheap solid state gear measures well with sine waves, but performs poorly while playing real music.



post #32 of 51

Updated utility package:



Command line options can now also be read from a file, a bug has been fixed in "sinetest", and it now allows for analyzing two test tones for more accurate pitch correction, and the frequency can be different on each channel as well.

post #33 of 51

I'm so subscribed to this thread! Thanks stv014! beerchug.gif

post #34 of 51

Updated again:




- the interpolation algorithm in the resampler uses a different window function that is slower to calculate at the same size, but it needs a smaller window to reduce the error to insignificant levels, and there is not really any point using higher than the default -il 48 now

- the convolve utility can use "upsampled" maximum length sequences (zeros are inserted after each sample) as the impulse response. This can be useful when testing the impulse response of a DAC, for example by using a 44.1 kHz sample rate for playback, and 88.2 kHz for recording: a 2x upsampled reverse MLS will then also include the ultrasonic imaging of the DAC in the impulse response

- both the resample and convolve utilities allow for changing the window function used by a FIR lowpass or highpass filter. These are compared below:



Yellow: default (-fw 0)

Blue: -fw -24

Red: -fw -48

Green: -fw -72

Cyan: -fw -96

post #35 of 51

Another new version (the download link is the same as above):

- faster sample rate conversion (particularly upsampling) by fractional ratios

- fixed a bug on 64-bit systems

- more built-in filters in 'convolve': bandpass, band-rejection, and "comb" versions of these which also filter the harmonics of the given frequency

post #36 of 51

A preliminary version of the 'thd_test' utility is now included:


It can be used for analyzing sine sweeps to create graphs like many of the ones that can be seen here. Other than the addition of this new program, there is a very minor change to the sample rate conversion code.

post #37 of 51

Another update:

- new utility (groupdel) for analyzing the group delay, phase delay, or phase response using an impulse response file as input

- 'thd_test' has a new option for limiting the number of overlaps to reduce the processing time with large window sizes

- the filter frequency bug in downsampling by a ratio of less than 2 has been fixed

post #38 of 51

There is a new version again:



* new 'noise' utility:

- it analyzes the average signal and noise levels in a sound file using a large windowed FFT

- it can be used for measuring signal levels, noise, dynamic range, THD+N, IMD+N, and jitter+N with constant frequency test signals

- up to 10 signal frequencies can be defined; these are filtered out from the noise, and the frequency range of the noise can be limited as well

- levels are printed unweighted, A-weighted, and with the ITU-R 468 weighting filter

- it is possible to analyze a second file containing only the noise of the analyzer, and compensate the results for that noise (assuming that it is uncorrelated to the noise of the device tested)

- relative levels (raw amplitude and dBr) can be adjusted by a dB factor

- an RMS voltage can be specified for 0 dBFS input, if it is present, then voltages and dBu levels are also printed

* the 'groupdel' utility has new options for setting a phase offset (a constant value to be added to the phase response, this is mostly useful with multiples of 360) for each channel, and to automatically find the delay with which the phase delay is zero at the maximum frequency

* 'testgen' can now generate colored (white, pink, brown, etc. with a user defined dB/octave slope) stereo noise

post #39 of 51

A minor update: the 'testgen' utility now includes a simplified version of the sine generator with fixed frequency and amplitude, and no synchronization impulse (which is only useful with 'thd_test').


A short description of all the programs included can be found here.

post #40 of 51

It still needs work, but I have started implementing programs for creating graphs.


post #41 of 51

That's pretty nice. What are you using for plotting, gnu?

post #42 of 51
Originally Posted by ultrabike View Post

That's pretty nice. What are you using for plotting, gnu?


No, other than the sound file I/O for which I used the open source and cross-platform libsndfile library, it is entirely my code, because I wanted to avoid dependencies as much as possible (so, once you have a C++ compiler and libsndfile, you do not need more to compile these than to compile a simple "Hello, World" program). It does not interactively display the graph, though, it only writes a BMP format file.


The frequency and time resolution of the CSD analysis is not particularly good, that needs to be improved.

post #43 of 51

The dsputils.zip package has been updated again:

- new 'csd' utility for analyzing an impulse response, and saving a CSD graph as a BMP format image file

- reduced the amount of infrasonic "rumble" in the pink noise generator of 'testgen'

post #44 of 51

post #45 of 51

Another, soon to be added utility will measure impedance as a function of frequency. It can calculate either the output impedance from a known load resistance, or the load impedance from a known output resistance. For more accurate results, the input resistance of the ADC can also be specified (for example, 4300 Ω for the Xonar Essence STX). The measurement is performed by recording two loops of MLS, the first is done unloaded, and then the load needs to be connected between the test signals. It currently requires an exact delay between the unloaded and loaded test, so if the DAC and ADC do not share the same clock, pitch correction is needed.


Some examples - output impedance (measured with a 220 Ω resistor load):


Headphone impedance (using the Xonar Essence STX headphone output that has just been measured above):


New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Sound Science
Head-Fi.org › Forums › Equipment Forums › Sound Science › OK, so what CAN I reliably measure from a PC soundcard ?