0

Adafruit MAX98357 I2S Class-D Mono Amp: Popping!
Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Please be positive and constructive with your questions and comments.

Adafruit MAX98357 I2S Class-D Mono Amp: Popping!

by Buckler on Thu Sep 29, 2016 4:28 pm

Hi,

I recently bought this nice little amp/dac. ID 3006

When my pi is playing music (radiostream or mp3 file) it sounds loud and crispy but when I stop/start or skip to the next song there is a pop, some noise a second pop and then music!!

I am using the lastest Raspbian Jessie Lite and mpd/mpc to play the music. I have tried several setups with a B+ and a Zero and even with an ArchLinux-image (Archphile.org) but the same results, playing music is okay but don;t try to control the music :-)

Any tips/advice to get rid of this?

Kind regards

Harry

Buckler
 
Posts: 4
Joined: Thu Sep 22, 2016 3:05 am

Re: Adafruit MAX98357 I2S Class-D Mono Amp: Popping!

by adafruit_support_rick on Fri Sep 30, 2016 12:29 pm

It's something the Pi is doing. I don't know how to get rid of it.

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Adafruit MAX98357 I2S Class-D Mono Amp: Popping!

by adafruit2 on Fri Sep 30, 2016 4:54 pm

this is an effect of the linux audio system, what you want to do is reduce the audio on the track ending and then ramp up audio on the new track

adafruit2
Site Admin
 
Posts: 18598
Joined: Fri Mar 11, 2005 7:36 pm

Re: Adafruit MAX98357 I2S Class-D Mono Amp: Popping!

by Buckler on Sat Oct 01, 2016 7:00 am

Hi,

Will/can the problem with the Linux audio be solved?

I have found a tip about using Pulse-audio instead of ALSA?
I have got no idea how to test this setup with PA?

Kind regards

Harry

Buckler
 
Posts: 4
Joined: Thu Sep 22, 2016 3:05 am

Re: Adafruit MAX98357 I2S Class-D Mono Amp: Popping!

by sshumate on Tue Nov 29, 2016 12:48 pm

I also ran into this popping/clicking issue on the MAX98357 today. I put a logic analyzer on the I2S bus from the RaspPi and discovered that every time the I2S bit clock changes frequency, the MAX98357 emits an audible pop. I tried a number of audio players (sox, aplay, omxplayer, and mpg123) and they all exhibit this problem.

The workaround is to use a software mixer to output a fixed sample rate to the MAX98357 so the bit clock does not change. I use ALSA so I configured dmixer and I no longer have any pops or clicks. Note that the RaspPi I2S driver does not support dmixer by default and you must follow the instructions provided below to modify /boot/config.txt to load support:

https://support.hifiberry.com/hc/en-us/ ... io-sources

Hope that helps someone.

sshumate
 
Posts: 1
Joined: Tue Nov 29, 2016 12:26 pm

Re: Adafruit MAX98357 I2S Class-D Mono Amp: Popping!

by adafruit_support_mike on Wed Nov 30, 2016 1:55 am

That's good information.. thanks for posting it!

adafruit_support_mike
 
Posts: 58474
Joined: Thu Feb 11, 2010 2:51 pm

Re: Adafruit MAX98357 I2S Class-D Mono Amp: Popping!

by adafruit2 on Wed Nov 30, 2016 2:42 pm

cool thanks! added to the guide :)

adafruit2
Site Admin
 
Posts: 18598
Joined: Fri Mar 11, 2005 7:36 pm

Re: Adafruit MAX98357 I2S Class-D Mono Amp: Popping!

by Buckler on Thu Dec 01, 2016 4:46 am

Thanks for the guide!

I have changed my asound.conf but I still have those annoying pops.
Iam using mpd to play music so can someone tell me which adjustments i have to make to my mpd.conf file?

Code: Select all | TOGGLE FULL SIZE
###################################
##Archphile Default Configuration##


follow_outside_symlinks         "yes"
follow_inside_symlinks  "yes"
db_file         "/var/lib/mpd/mpd.db"
log_file        "/var/log/mpd.log"
pid_file        "/var/run/mpd/pid"
music_directory         "/var/lib/mpd/music"
playlist_directory      "/var/lib/mpd/playlists"
state_file              "/var/lib/mpd/mpdstate"
user    "mpd"
bind_to_address         "any"
port    "6600"
log_level       "default"
volume_normalization    "no"
audio_buffer_size       "2048"
buffer_before_play      "20%"
filesystem_charset      "UTF-8"
id3v1_encoding  "UTF-8"
gapless_mp3_playback    "yes"
auto_update     "no"
mixer_type      "software"
group   "audio"
max_connections "20"
restore_paused "no"

decoder {
                plugin "ffmpeg"
                enabled "no"
}

input {
                plugin "curl"
}

audio_output {
                enables "yes"
                type "alsa"
                name "HiFiBerry"
                device "hw:0,0"
                auto_resample   "no"
                auto_channels   "no"
                auto_format     "no"
}

 


Thnx

Harry

Buckler
 
Posts: 4
Joined: Thu Sep 22, 2016 3:05 am

Re: Adafruit MAX98357 I2S Class-D Mono Amp: Popping!

by lucadentella on Tue Mar 14, 2017 4:56 am

Hi! I've the same problem, even after the configuration of dmixer... I think we miss something:

use a software mixer to output a fixed sample rate to the MAX98357

with the change in /etc/asound.conf we can now mix two different tracks... but how to set the fixed sample rate?
thanks!

lucadentella
 
Posts: 3
Joined: Wed Feb 13, 2013 5:03 pm

Re: Adafruit MAX98357 I2S Class-D Mono Amp: Popping!

by lucadentella on Tue Mar 14, 2017 4:13 pm

Hi

I should have solved... from what I understood, with the amix configuration you're enabling the audio peripheral to output more than one track at a time.
To remove the pops, you have to continuously output a "silence" signal with a given sampling frequence, for example using the command:

Code: Select all | TOGGLE FULL SIZE
aplay -t raw -r 48000 -c 2 -f S16_LE /dev/zero &


this "plays" a silence track (/dev/zero) with a sample rate of 48KHz in the background (note the "&" at the end of the command)... after having issued this command, I can now play-stop-pause-resume any audio file with any player (well I tested mpv, mpg123 and some others) without the pops.

Give it a try and let me know if it solves also for you!

lucadentella
 
Posts: 3
Joined: Wed Feb 13, 2013 5:03 pm

Re: Adafruit MAX98357 I2S Class-D Mono Amp: Popping!

by ledzeper on Wed Jun 21, 2017 8:51 pm

lucadentella wrote:Hi

I should have solved... from what I understood, with the amix configuration you're enabling the audio peripheral to output more than one track at a time.
To remove the pops, you have to continuously output a "silence" signal with a given sampling frequence, for example using the command:

Code: Select all | TOGGLE FULL SIZE
aplay -t raw -r 48000 -c 2 -f S16_LE /dev/zero &


this "plays" a silence track (/dev/zero) with a sample rate of 48KHz in the background (note the "&" at the end of the command)... after having issued this command, I can now play-stop-pause-resume any audio file with any player (well I tested mpv, mpg123 and some others) without the pops.

Give it a try and let me know if it solves also for you!


This one solved my issue! Thanks a lot!!!

Lewis

ledzeper
 
Posts: 4
Joined: Thu Feb 18, 2016 4:05 pm

Re: Adafruit MAX98357 I2S Class-D Mono Amp: Popping!

by lucadentella on Fri Jun 30, 2017 9:11 am

glad it worked also for you!

Here's my tutorial about it --> http://www.lucadentella.it/en/2017/04/2 ... t-via-i2s/

lucadentella
 
Posts: 3
Joined: Wed Feb 13, 2013 5:03 pm

Re: Adafruit MAX98357 I2S Class-D Mono Amp: Popping!

by francesc on Thu Jul 13, 2017 6:51 pm

Hi!

Does this tutorial work in Raspberry Pi 2 (Model B)? I have installed the amp, and it works correctly - with the terrible pops.
I followed the tutorial, and modified /boot/config.txt and /etc/asound.conf, but after

aplay -t raw -r 48000 -c 2 -f S16_LE /dev/zero &

the device is "busy", and I can't play any other sound (i.e. the "mixer" is not working). For example, after the "aplay", if I write the command

speaker-test -c2 --test=wav -w /usr/share/sounds/alsa/Front_Center.wav

I get an error message saying the device is busy.

Any suggestion?

Best,
f.-

francesc
 
Posts: 3
Joined: Thu Jul 13, 2017 6:42 pm

Re: Adafruit MAX98357 I2S Class-D Mono Amp: Popping!

by darrenmsmith on Sat Jul 15, 2017 5:53 pm

I have a RPi 3 B and went through the tutorial and verified manually that the setup was correct. In Jessie I see a red X on the audio icon. If I go into the Audio device settings in Jessie I get this message: No ALSA audio device, or connect a USB or HAT audio device.

Clean build, April Release.

Thanks ahead of time for any clues.

Regards,
D..

darrenmsmith
 
Posts: 2
Joined: Thu Mar 23, 2017 11:02 pm

Re: Adafruit MAX98357 I2S Class-D Mono Amp: Popping!

by francesc on Sat Jul 15, 2017 6:34 pm

Hi there,

Continuing with the popping issue, I have tried with a Rasp 2, and Rasp 3 and it seems the "Reducing popping" instructions don't work anymore. At least, they don't work in my case.

Is it working for anyone with an updated Raspbian?

As noted before, the amp is working. With > $ aplay -l, I get

**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0

And the test (speaker-test) sounds good. It works. Any problem.

But the mixer is not working anymore. I'm playing videos, and every time I pause a video the amp makes a terrible and very loud pop. After

> aplay -t raw -r 48000 -c 2 -f S16_LE /dev/zero &

if I write

> speaker-test -c2 --test=wav -w /usr/share/sounds/alsa/Front_Center.wav

I get the message

speaker-test 1.0.28

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
WAV file(s)
Playback open error: -16,Device or resource busy

I would appreciate any suggestion!

Best,
f.-

francesc
 
Posts: 3
Joined: Thu Jul 13, 2017 6:42 pm

Please be positive and constructive with your questions and comments.