I have a sneaky problem when my custom sound card sends audio data to the host. When I record the data stream from my sound card on the PC, artefacts can be heard, when I playback the recorded stream. These artefacts can also be seen in the audio editor. I have added a screenshot ("audio editor.png"). In the screenshot you see a record at 48000Hz, where the samples have the values 1x20,000 and 5x10,000 on the left channel and 0 on the right channel. The artefacts happens all approx. 0,5s for about 10ms. Then, I have sniffed the usb traffic with wireshark and found some errors in the transfer (see screenshot "wireshark.png"). At first, I thought it is a hardware problem, but by chance I discovered that it is a software problem. I create the test signal (1x20,000 and 5x10,000 on left, 0 on right) directly in the code. During testing I always had a external source connected with the same sample rate. When I disconnected the external source, the artefacts didn't occur any more! Currently, my thoughts are:
- The xud thread has too less cpu cycles to process the the transmission in time, because to many cores are used on the usb tile. The libusb spec says, that the thread must run at least at 80MHz.
- It takes a too long time after receiving the SOF interrupt to call "XUD_SetReady_InPtr()" to transmit the next samples to the host.
- Something totally different ...
Ad 2) If this were the case, I think the recorded samples would look different in the audio editor. I would expected artefacts on every sent sample block (6 samples per channel at 48kHz). Am I wrong?
Ad 3) No ideas, yet.
The thing that irritates me is that the output is transmitted bit-perfect even at 192 kHz, but the input already has problems at 48kHz. Do have any ideas?