V2.0.4 Sample Format Mismatch

Hello, it seems that 2.0.4 causes some head ache. I’ve stumbled over another issue that might be limited to my installed sound card only.
I’ve been trying to force Wdm-ks to play back over the speakers.
After fiddling with all possible settings in Audacity and the sound control panel, I’ve eventually recalled a snippet that I’ve written to determine the bit depth (so called “Sample Format” in Audacity) in order to see what goes behind the scenes. I have to add that the Wdm-ks is sometimes capable of recording any given input, so at least this part could be analysed.
Here’s the snippet for the Nyquist prompt.

(defun mono (sig)
  (if (arrayp sig)
      (sim (aref sig 0) (aref sig 1))
(defun bit-test (sig bits)
      (diff sig
        (quantize sig (truncate (power 2 bits)))))))

;;; find the bit depth
(defun bit-depth (sig)
  (let ((sig (mono sig))
        (test-values '(10 11 20 23 29 31)))
    (dolist (bits test-values)
            (if (= (bit-test sig bits) 0)
                (return bits)))))

;; run the test
(case (bit-depth s)
  (10 "8 bit unsigned")
  (11 "12-bit")
  (20 "16-bit integer")
  (23 "24 bit integer")
  (29 "30 bit compressed (mp3 etc.)")
  (31 "32-bit integer")
  (t "32 bit float"))

I’ve generated a chirp sound and recorded (overdubbing) it with all possible hosts and sample formats (preferences>quality>default sample format).
Now the results: :open_mouth:

Default Sample Format 16 bit

  • MME WDS WASAPI 16 bit

Default Sample Format 24 bit

  • MME WDS WASAPI 24 bit

Default Sample Format 32 bit

  • MME WDS 16 bit (no typo)
  • WASAPI 32 bit

(I’ve omitted the wdm-ks driver because of its buggyness)
Since my Sound card can’t supply more than 24 bits, I’d expect to see this value for the 32 bit option too, instead, it jumps back to 16 bit. The 32 bit for the Wasapi are not so surprising, because the values come from the loop back and the test sound has been generated at 32 bit.
Could anyone please redo this test or part of it with her/his system?
Thank you very much.

Before we spend too much time on this, is 2.0.3 any different http://audacity.googlecode.com/files/audacity-win-2.0.3.zip ?

Is the objective to measure what has been recorded?

As you know MME and WDS do not record at more than 16-bit due to PortAudio limitations. Results vary but the consensus was that 24-bit default sample format under MME and WDS will record at 16-bit zero padded to 24-bit. I don’t know if anyone tested it with 32-bit default sample format. You can find the tests on the Forum, perhaps by searching for “padded”.


Also WASAPI loopback recording is apparently limited to 44100 Hz sample rate. If you choose some other project rate, Audacity resamples it and this will probably cause break up of the stream.


I’ve hoped that someone has still an older version of Audacity. I don’t wanna scramble up my preferences again.

I am writing a tool that returns some info about the recorded audio in comparison to the original test tone. Including latency, bit depth, sample rate frequency response and the levels. And I wanted also to track down why wdm-ks sometimes works and sometimes not.

How should I? I am no C++ programmer. The portaudio documentation gives not much light on this. All Formats up to 32 bit float are defined in portaudio.h and could be passed as input parameters–even for a simple test call. The normal host info provided by port audio does not list anything about the bit depth (it is the same as the device info in Audacity).
Do you know by the way if higher sample formats are supported for a ASIO version of Audacity?

The major difference between integer and float format is that the former is asymmetric and the latter symmetric. I can’t say if zero padding offers any advantages for 32 bit float (it has certainly a “sweet spot” where the precision is highest).
If padded, then maybe to the fullness of the mantisse (24 bit?).

It may have been before you came to the forum, but this has been discussed at great lengths on several occasions in the past.

In theory, 24 bit recording should work with ASIO.

Thank you Steve.
I’ve made another test with the 2.0.3 alpha fromm Novemberr 5th 2012.
It has external inputs enabled for Wasapi. The line-in connection gives a device error but the microphone input works fine.
The above code returns “24 Bit Integer” if quality is set to 32 bit float. I do not know if this is only zero-padded too.
In any case, some future version of Audacity will certainly have the ability to record 24 bit (as stated in the documentation).

Any alphas that have WASAPI enabled for more than loopback recording will be very buggy.

In principle WDM-KS and WASAPI for physical inputs should record genuine 24-bit without padding if the sound device is 24-bit capable.

If WASAPI is shared, there will (if MSDN is correct) be extra conversions to and from 32-bit, whatever the Audacity Default Sample Format.