Controlling Volume on I2S Class-D Mono Amp

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/
Locked
User avatar
jtibau
 
Posts: 3
Joined: Mon Sep 07, 2015 6:07 pm

Controlling Volume on I2S Class-D Mono Amp

Post by jtibau »

I recently bought one of these (Adafruit MAX98357 I2S Class-D Mono Amp) to try to make a smart speaker device. After some initial success I got it to work and it sound great but it was a little loud. For unknown reasons it stopped working, and I've been at a loss in determine the why.

However, I have 2 more on the way and would like to figure out beforehand how to control the volume that they output. The instructions at (https://learn.adafruit.com/adafruit-max ... s?view=all) have no further suggestions into how it operates. If I go to alsamixer it does not recognize the device, although it did use to play music at the time.

Any pointers? Once I get the copies I'll be able to determine if the first one is busted, so I'm more interested in learning how to lower the volume?

User avatar
bbx10node
 
Posts: 147
Joined: Sun Feb 22, 2015 4:14 pm

Re: Controlling Volume on I2S Class-D Mono Amp

Post by bbx10node »

I used the same DAC+amplifier board on an ESP8266 project. There is no software volume control. However, the GAIN pin does control the volume as described in the tutorial.

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

Re: Controlling Volume on I2S Class-D Mono Amp

Post by Buckler »

Hi,

He recently bought this nice little board to upgrade a vintage radio from 1956 with a RPI.

@JTIBAU
Software volume control is no problem, I am using Raspbian Jessie and mpd/mpc:

Code: Select all

nano /etc/mpd.conf
and add/replace these lines:

Code: Select all

audio_output {
enables "yes"
type "alsa"
name "HiFiBerry"
device "hw:0,0"
auto_resample   "no"
auto_channels   "no"
auto_format     "no"
}
and set the mxier to software:

Code: Select all

mixer_type      "software"
ALSA settings:
create config-file:

Code: Select all

nano /etc/asound.conf
add these lines:

Code: Select all

pcm.!default  {
 type hw card 0
}
ctl.!default {
 type hw card 0
}
reboot the Pi and with mpc you can control the volume!

Problem!
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 some noise and two loud plops!!!

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 an even with an ArchLinux-image (Archphile) but the same results, playing music is okay but dont try to control the music :-)

Any tips/advice to get rid of this?

Kind regards

Harry

User avatar
bbx10node
 
Posts: 147
Joined: Sun Feb 22, 2015 4:14 pm

Re: Controlling Volume on I2S Class-D Mono Amp

Post by bbx10node »

Thanks, I will try to see if I can get volume control to work.

Locked
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/

Return to “Adafruit Raspberry Pi® accessories”