raspberrypi / tinyusb

MIT License
69 stars 18 forks source link

TinyUSB Audio is flawed: https://github.com/raspberrypi/pico-sdk/issues/653 #14

Closed TheMindVirus closed 2 years ago

TheMindVirus commented 2 years ago

Set up Standard Raspberry Pi Pico RP2040 and also Adafruit Macropad RP2040 Windows 10 Pro with Pico SDK, Recommended ARM GCC and additionally Arduino IDE Windows 10 Pro Runtime OS Device Manager and additionally Windows 10 on ARM with the same universal device behaviour

Describe the bug Please see: https://github.com/raspberrypi/pico-sdk/issues/653 for more information "i2s_dummy_buffer" @ https://github.com/raspberrypi/tinyusb/blob/d49938d0f5052bce70e55c652b657c0a6a7e84fe/examples/device/audio_4_channel_mic/src/main.c#L394 https://github.com/raspberrypi/tinyusb/blob/d49938d0f5052bce70e55c652b657c0a6a7e84fe/examples/device/audio_4_channel_mic/src/main.c#L419 Appears to be causing bit-crushing distortion to any wave applied through it, especially 2 in 2 out USB audio interfacing

To reproduce

  1. Download the Pico SDK and Build the usb examples (especially audio_4_channel_mic from tinyusb and other relevant audio tests)
  2. Ideally adapt the example to create "audio_2i2o", a 2 input 2 output Audio Unit USB interface with the Pico or RP2040 board
  3. Deploy the example UF2 file (converted from .elf with ELF2UF2) onto the Pico, look in Device Manager and Record it in FL Studio Optionally Audacity can be used for the recording. Increase the volume of the sample to 300% to make the interference pronounced.

Screenshots PicoSine PicoSample.zip

Log No log available from the Pico while it is processing audio over USB, other than all TU_LOG2() statements included in the audio_4_channel_mic example (code reaches all the segments it needs to). Same issue with logging from Macropad but identical data can be observed in the recorded audio sample (which could eventually be used as a trace).

aallan commented 2 years ago

The TinyUSB repo is at https://github.com/hathach/tinyusb. You need to file this issue against that repo, not this one. This does not seem to be an issue related either to RP2040 or to the Pico C/C++ SDK.