24-bit output from signal generator?

Greg Dunn

Member
Thread Starter
Joined
Oct 4, 2017
Messages
107
I've been running some stepped sine, swept and other tests on electronics lately and while I'm getting what I expect most of the time, something came up today that I don't quite understand. Perhaps I'm setting something wrong. This is with beta 29 and Mac OS 10.13.6.

One of the tests I'm trying to work on is a DAC level linearity measurement; setting the signal generator input to various levels and then checking the output to see where the value departs from a 1:1 ratio to determine how many bits are effectively linear. I'm using the spectrum display, 64-bit FFT and setting the signal generator to output 24-bit data. I calibrate so that my 0 dB reference is just shy of clipping, before the distortion starts to rise. When I get to -96 dBFS, all is well and I can see that the DAC is beginning to depart from ideal. However, the moment I drop below -96 (which is 16 bits equivalent) the signal abruptly drops out. I looked at the scope, and as I lower the level, the waveform of course shows more of its discrete nature, until at -96 the signal is very nearly a square wave, not even close to the stepped sine which I would expect from a 24-bit quantized sine. Sure enough, if I lower the signal slightly more, the waveform becomes a straight line and the spectrum disappears.

I have the signal generator set to 24-bit and the behavior is the same with or without dither. To my eyes it looks like what I'm actually getting is only a 16-bit quantized wave. See the attached image - REW thinks it's in 16 bit mode despite Audio MIDI setup being configured for 96/24 in and out and the signal generator being set to 24 bit. I can't find anywhere else in REW to change the bit depth, but maybe I've missed it...
 

Attachments

  • Scarlett setup.png
    Scarlett setup.png
    22.2 KB · Views: 22

John Mulcahy

REW Author
Joined
Apr 3, 2017
Messages
7,383
There isn't a bit depth setting in REW. It asks the driver whether it supports 24-bit data, and if it does 24-bit is used, otherwise 16-bit will be used provided the driver supports that. You can see the formats the driver is offering by looking at the file produced by "Generate debug file" on the Soundcard preferences. As an aside, devices may not support the same bit depth at all sample rates.

The display at the bottom of the REW window is derived by examining the incoming data and looking for the least significant bit which shows changes in the incoming data, since the driver's declared word width may be zero padded.
 

Greg Dunn

Member
Thread Starter
Joined
Oct 4, 2017
Messages
107
By "driver" I assume you mean the Java VM? Because the Scarlett, as a class-compliant device, doesn't use a driver per se. It communicates directly with the Mac through Core Audio unless the software bypasses that.

And, after further investigation, that seems to be what is happening. I suspect that when I had the Scarlett assigned as the default I/O device with 96/24 configuration in the OS, REW was talking to the Java audio code's default in/out port which does not appear to REW as 24 bit capable even though it passes a signal. So REW only sends and receives 16-bit data with that setting. Choosing a device like the Scarlett as the default Core Audio device and then using the default in the application works fine with software like GarageBand, Logic Pro and iTunes, though you can select the in and out ports individually from the application if you like and it behaves the same. When I selected the Scarlett input and output specifically in the REW preferences, it was able to communicate 24 bit capability; REW shows "24 bits" on the main screen and now everything works as expected.

I've attached the debug file for the setup which actually works. The only difference I saw between all the debug files (I generated one for each configuration) was the name of the selected device, and of course the sample rate chosen was shown for the last item in each list. All of them show 16 bits as that setting. None of them including this one specifically showed a 96k / 24 bit option; all they show is "unknown sample rate at 8/16/24 bits". The setting which generated this debug file does indeed produce valid-looking 24-bit output despite listing "96000.0 Hz, 16 bit" as the capability.

At any rate, with the REW configuration set so that it directly uses the Scarlett ports, it delivers a satisfactory looking 24-bit signal both from the generator and the measurement routines, and the corresponding distortion/noise levels are greatly improved, as they should be. I would recommend that this possibly confusing behavior of the Java runtime be mentioned in the REW help file; the suggestion that default in/out be used for measurements should at the least contain a caveat that this may cause the application not to recognize certain capabilities of the device. I know there's nothing you can do about the behavior of the JVM.

Hope these observations are helpful!
 

Attachments

  • soundcard_debug_test.txt
    30.2 KB · Views: 7

John Mulcahy

REW Author
Joined
Apr 3, 2017
Messages
7,383
Great that you worked out what was happening. The help recommends selecting devices directly rather than using the defaults, but I'll expand on why.
 

Greg Dunn

Member
Thread Starter
Joined
Oct 4, 2017
Messages
107
You're right - I misread the section "To prevent REW from accessing soundcard controls, leave the input and output devices set to "Default Device" as a recommendation when in fact it's a troubleshooting tip.

I ran into a similar situation last week with a series of programs which bypassed Core MIDI and only worked if you configured the ports from within the programs, so that put me on the right path to a solution.

Thanks again for all you do to make REW such an essential tool.
 
Top Bottom