Altered samples received in xCORE-200 Multichannel Audio platform

Discussions about USB Audio on XMOS devices
mastandres
Newbie
Posts: 1
Joined: Mon Jan 25, 2021 11:21 am

Altered samples received in xCORE-200 Multichannel Audio platform

Post by mastandres »

Good morning everyone!

I am developing an audio application using the XCORE-200 Multichannel Audio Platform and currently I am targeting macOS as system and accessing the XCORE Audio Card using Apple's native API.
I have correctly set up the playback from my macOS App, setting the following Audio properties:
- 10 channels
- 44100Hz sample rate
- PCM, Signed Integer, 32 bytes per samples non interleaved
Whereas, the XMOS audio configuration is the following:
- 10 in/out USB channels
- MIDI, SPDIF disabled
In fact, I get no problems rendering audio via the 8-ch ADC on board.

What I am trying to do is to be able to detect arbitrary crafted audio samples from host application.
If I craft an audio packet containing a word like 0x11223344, on the XMOS firmware I receive 0x11223340. Or if I send 0xAABBCCFF, I receive on the XMOS 0xaabbcd00.
I don't actually understand why this happens and why I have this shift between sent and received value, I am sure I am missing something.
I ensured that the volume is at maximum level (I even set OUTPUT_VOLUME_CONTROL to 0), so shifts shall not be regarded to system volume and anyway the difference from sent and received samples is not constant.
The constant part seems to be the two most significant bytes of the word I send.

This is the code I am using to print sample value that I am using in xmos audio.xc source file:
```
int sampleRValue = (int)(samplesOut[frameCount+9]);
if (sampleRValue != 0)
printf("Sample is %x.\n", sampleRValue);
```
As you can see I am hooking up channel #9.

Can you please help me understanding what I am doing wrong or missing?
Thank you so much.
User avatar
akp
XCore Expert
Posts: 580
Joined: Thu Nov 26, 2015 11:47 pm

Post by akp »

I wonder if Core Audio isn't bit perfect (will Steve Jobs strike me down if the blasphemy is spake thus?) If Core Audio's got a 32 bit floating point conversion in it somewhere along the line then you'd only get 24 bit/sample effective resolution.
User avatar
fabriceo
XCore Addict
Posts: 233
Joined: Mon Jan 08, 2018 4:14 pm

Post by fabriceo »

agree, thats why players like Audivana use an "integer mode" somehow bypassing core audio at the latest stage
User avatar
Ross
Verified
XCore Legend
Posts: 1149
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

Seems like you have some sample rate conversion occurring in the host.
Technical Director @ XMOS. Opinions expressed are my own