Slight tick / pop at the start and end of a sound using a PCM5102a DAC (with workaround)

I'm working on a polyphonic synthesizer project using a Teensy 4.1 and a PCM5102a DAC (the small cheap purple boards from AliExpress). I noticed a slight tick / pop at the beginning of each note when using a slow attack / release. The volume of the each oscillator is relatively low because it's a polyphonic multi-oscillator synthesizer, which makes the tick / pop more audible.

After digging through the datasheet I figured that it is probably the DAC entering / exiting power save mode. Using an oscilloscope I see that BCK and LCK on the DAC board keep their constant frequency but DIN gets a constant 0 volt when audio turns off. If I understand the datasheet correctly, this shouldn't trigger the DAC to go into power saving, but I hear a tick / pop nonetheless.

I made a sketch to reproduce the issue (see below).

The workaround I found is to add a -1 integer (=-1.0f / 32768.0f in float) offset to the audio stream (using a mixer and DC). This can be reproduced by un-commenting the following line in the sketch:
C:
//dc1.amplitude(-1.0f/32768.0f);
The offset is so minute that it shouldn't have an impact on the audio output. This makes the tick / pop disappear completely.

I hope this workaround is of use to anyone else experiencing the same problem...

Does anyone perhaps know what exactly is going on here and if a better solution exists?

Code to reproduce the issue (volume is quite low on purpose, please remember to turn the volume of your headphones or speakers down again after testing this sketch):
C:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated code
AudioSynthWaveform       waveform1;      //xy=219,160
AudioEffectEnvelope      envelope1;      //xy=421,160
AudioSynthWaveformDc     dc1;            //xy=430,260
AudioMixer4              mixer1;         //xy=650,220
AudioOutputI2S           i2s1;           //xy=850,220
AudioConnection          patchCord1(waveform1, envelope1);
AudioConnection          patchCord2(envelope1, 0, mixer1, 0);
AudioConnection          patchCord3(dc1, 0, mixer1, 1);
AudioConnection          patchCord4(mixer1, 0, i2s1, 0);
AudioConnection          patchCord5(mixer1, 0, i2s1, 1);
// GUItool: end automatically generated code

void setup() {
  AudioMemory(10);

  envelope1.attack(1000.0f);
  envelope1.decay(2000.0f);
  envelope1.sustain(1.0f);
  envelope1.release(1000.0f);

  waveform1.begin(0.001f, 880.0f, WAVEFORM_SINE);

  // add a 1 bit DC offset to prevent a pop / tick sound whenever the envelope becomes silent, probably due to the DAC switching to power-saving mode
  //dc1.amplitude(-1.0f/32768.0f);
}

void loop() {
  envelope1.noteOn();
  delay(1000);
  envelope1.noteOff();
  delay(3000);
}
 
Doesn't seem to be anything to do with the chip, which only enters power-save if the I2S clocks go away or are wrong.

Adding a constant fixed offset to output _after_ the envelope shouldn't have any effect on the sound as the output is AC coupled, so something mysterious is happening.
 
Except … a “small cheap purple board from AliExpress” might, just possibly, have a knock-off copy of the PCM5102 which doesn’t comply with the official datasheet…
 
PCM5102a datasheet tells that there is "Intelligent Muting System; Soft Up or Down Ramp and Analog Mute For 120-dB Mute SNR". Maybe it's that?
 
Then there’s the Zero Data Detect mode, documented on p22 right before Power Save Mode (but not mentioned by @phjanderson). Sounds like the [small cheap purple] PCM5102 isn’t doing a great job of getting out of analog mute…
 
I have an "audio bonnet" made for a raspberry pi that I got from adafruit that uses the PCM5102. It has exactly the same popping issue so I don't think the aliexpress connection has any relevance.
 
OK, that says to me the Zero Data Detect mode doesn’t work very well, for some reason. Did you have the option to bodge round it on the RPi? I think I’d be inclined to mix in some 1-bit noise rather than DC, just in case you got the rest of the source outputting a constant -1 somehow…
 
@phjanderson : do you have this board?
1715627748739.png

You are probably not using the SCK pin, if so you do need to GND it, see this thread from message #37 onwards.
See the SCK pin grounded on this yellow PCM5102A board:
1715628260881.png

By the way: we are talking about the PCM5102A, not the PCM5102.

Paul
 
Did you configure the hardware jumpers on your board?
Attached is a reference for doing that.
On the front of the board just below the letters SCK there are two rectangular solder points, when soldered together that will short the SCK to ground which is needed if you are not sending SCK to this board.

Regards,
Ed
PCM 5102 DAC board Configuration.png
 
Back
Top