Page 1 of 1

Change an ADC from a mic to a line device

Posted: Thu Dec 01, 2022 2:22 pm
by Biquad
Hello,
i am just working to enable 32 bit ADC audio mode in windows 10.
I added define STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS 32 in the costumdefines
and
-STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS 32
-Stream_FORMAT_OUTPUT_1_SUBSLOT_BYTES 4
in the makefile.
I can't get it to work. Only 24 Bits are selectable in the MIC settings with the windows standard driver.
My ADC is recognized as a mic in windows and i want to change it to line.
Can you tell me how i can change it ? I looked around in the devicedefines but can't find a hint.

Regards
Andy

Re: Change an ADC from a mic to a line device

Posted: Thu Dec 01, 2022 3:24 pm
by MaximLiadov
As far as I remember it's in descriptors.h, Audio_In_FeatureUnit

Code: Select all

.wTerminalType             = 0x603,

Re: Change an ADC from a mic to a line device

Posted: Thu Dec 01, 2022 3:28 pm
by MaximLiadov
I would recommend you to look at UAC2.0 standard documentation for yourl reference, as it's not about XMOS code.

Re: Change an ADC from a mic to a line device

Posted: Fri Dec 02, 2022 8:19 am
by Biquad
Hi Maxim,
thanks for the hint. I suspected the mic input as a possible source of not going into the 32 Bit recording mode.
In the xmos projects are to many declarations around all folders to find the right one.
The constant UAC_TT_INPUT_TERMTYPE_xxx (usbaudio20.h) needs to be changed.
I got it working and its now a line device with 32 bit selectable. Big thanks!
Do you know a tool to check the bitrate under windows ? I assume when its selectable it should be running in 32 bit recording mode.

Andy

Re: Change an ADC from a mic to a line device

Posted: Fri Dec 02, 2022 10:44 am
by MaximLiadov
Hi Andy,

I would modify audio.xc this way (did not try, but should work):

Code: Select all

const signed data[2] = {INT_MAX, INT_MIN};  // max and min for 32 int
int counter = 0;

            for(int i = 0; i < I2S_CHANS_DAC; i+=I2S_CHANS_PER_FRAME)
            {
                    if (buffIndex)
                              {
                                  samplesIn_1[0] = data[counter];
                              }

                              else
                              {
                                  samplesIn_0[0] = data[counter];
                              }
                }

...

for(int i = 1; i < I2S_CHANS_DAC; i+=I2S_CHANS_PER_FRAME)
            {
...
                    if (buffIndex)
                              {
                                  samplesIn_1[1] =  data[counter];
                              }

                              else
                              {
                                  samplesIn_0[1] =  data[counter];
                              }
                              counter = 1 - counter;
Record file, modify data to max 24 bit int (2^23, -2^23 - 1) and see the difference.

Re: Change an ADC from a mic to a line device

Posted: Fri Dec 02, 2022 10:51 am
by MaximLiadov
More pleasant sine wave may look like
data[4] = {INT_MAX, 0, INT_MIN, 0};

Re: Change an ADC from a mic to a line device

Posted: Fri Dec 02, 2022 6:03 pm
by RitchRock
In the free DAW Reaper you can also get a free plugin called "Bit Meter". You could possibly use this to see what actual bits have useful information.

Re: Change an ADC from a mic to a line device

Posted: Sat Dec 03, 2022 11:46 pm
by Biquad
Big thanks guys,
i will look on it monday. I read about the Bit Meter or Bit Sort on audiosiencereview. I havn't found a download. Good
to know its now a plugin. Thanks.
I have a similar ADC brand module here that calibrates with 1Vrms on the ADC inputs pins totally different in Arta as my but
this module uses an CT7601 as usb bridge. My Arta calibration use 4800 as value the other one is 9822 for 0dBV (same ADC) .
Hence i made a frech xmos recompile with new source files with no luck. I have now the 32 Bit selectable but the 24 Bit
selection is gone and the xmos wants always an host to device (2) NUM_DAC(0) or it doesn't show up in the device manager.
I have an ADC only ;)

ADC bit testing is more complicated as a DAC where you can just count the bitsstream on a scope.

Alot to do next week.
Big thanks again!

Andy

Re: Change an ADC from a mic to a line device

Posted: Sun Dec 04, 2022 10:10 am
by MaximLiadov
I suppose you can add a new 32 bit mode in the device descriptor, not nessesary have to replace 24 bits to 32 bits. Look at DAC descriptor, as an example. It has 3 modes - 16 pcm and 24 pcm and 32 raw(dsd) altogether.

If you will have got any progress, share it pls. Good to know how it is going.