USB audio clicking noise with Teensy 4.0

Hello, I am using the Teensy 4.0 and the Audio board Rev D, I define the device as Serial+MIDI+Audio. I am using this option because I need to read it as a microphone to stream it in real time and also communicate with the device to send commands in order to change filters. I am testing on ubuntu 22.04.2 with Teensy version 1.58. The problem that I am having occurs when I capture the audio data with any application online. For example, when I record the input on audacity there are not clicking noises present, but when I made a Google Meets or a Microphone Test Online I start getting the clicks. So I record the audio with the following command:

Code:
yes | ffmpeg -f pulse -i alsa_input.usb-Teensyduino_Teensy_MIDI_Audio_13313920-02.analog-stereo -t 10 /home/test-analogue.wav
yes | ffmpeg -f pulse -i alsa_input.usb-Teensyduino_Teensy_MIDI_Audio_13314160-02.iec958-stereo -t 10 /home/test-noise.wav

The first option is defining the input as analogue and the second one as digital, actually defining it as analogue help a bit to reduce the clicks, but they are still present. The distortion looks like this at the wave:

wave.png

An it sounds like this:
https://drive.google.com/file/d/1JxXJDYVB5Ej23S7GNULKPDY7TVkDqDKW/view?usp=sharing

First I thought that my code was the problem or my physical hardware, but then I try the AudioPassThrough and this code of sine wave generator with different Teensy 4.0, and I keep getting the same problem.

Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated code
AudioSynthWaveformSine   sine1;          //xy=493,348
AudioOutputI2S           i2s1;           //xy=713,128
AudioOutputUSB           usb1;           //xy=806,345
AudioConnection          patchCord1(sine1, 0, usb1, 0);
AudioConnection          patchCord2(sine1, 0, usb1, 1);
AudioConnection          patchCord3(sine1, 0, i2s1, 0);
// GUItool: end automatically generated code

void setup() {

AudioMemory(20);

sine1.frequency(220);
sine1.amplitude(0.5);

}

void loop() {}

I already read and try things suggested at this thread:https://forum.pjrc.com/threads/54239-USB-Audio-Clicking-Noise/page4
I tried on different motherboards, and the problem is present on every of them. What I notice is that at windows 11, I don't have problems with the streaming online (my laptop runs ubuntu 22 and windows 11, so I tested on the same device).
Also, I tried to change from pulseaudio to pipewire at Ubuntu 22 and nothing seems to fix the problem. If any have and idea to help me fix the problem, I will appreciate it a lot.

I apologize If this was not the category to post this problem.

Best regards,
Jacqueline
 
Back
Top