Cannot get Adafruit Stereo Bonnet to work

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/
User avatar
zq8blazer
 
Posts: 9
Joined: Thu Jun 22, 2017 9:25 pm

Cannot get Adafruit Stereo Bonnet to work

Post by zq8blazer »

I am trying to get the bonnet to work properly. I have it fully assembled and connected to a Raspberry pi 3. I've ran the setup found here https://learn.adafruit.com/adafruit-spe ... y-pi-usage. At the end this is what it says:
Do you wish to test your system now? [y/N] y
Testing...

speaker-test 1.0.28

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
WAV file(s)
Playback open error: -2,No such file or directory

All done!

Enjoy your new i2s amplifier!
I try to test them and the following is displayed:
speaker-test -c2

speaker-test 1.0.28

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Using 16 octaves of pink noise
Playback open error: -2,No such file or directory
The speaker never makes a sound, but when upon reboot it crackles when Raspbian is loading. What could the issue be?

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Cannot get Adafruit Stereo Bonnet to work

Post by adafruit_support_mike »

From the error messages, it looks like the test program is missing some files.

What OS image are you using?

User avatar
zq8blazer
 
Posts: 9
Joined: Thu Jun 22, 2017 9:25 pm

Re: Cannot get Adafruit Stereo Bonnet to work

Post by zq8blazer »

I am using Raspbian Jessie with PIXEL

User avatar
zq8blazer
 
Posts: 9
Joined: Thu Jun 22, 2017 9:25 pm

Re: Cannot get Adafruit Stereo Bonnet to work

Post by zq8blazer »

Also it is a fresh install with the latest update. The only thing it is running is the Alexa sample program.

User avatar
linux_author
 
Posts: 7
Joined: Fri Jun 23, 2017 7:22 pm

Re: Cannot get Adafruit Stereo Bonnet to work

Post by linux_author »

chances are good the bonnet is working - have you tried playing an .mp3 file? there are also .wav files under /usr/share/sounds/alsa

if you have alsa-utils installed, you can check your bonnet's status:

sudo apt install alsa-utils

alsamixer

or

amixer

if you have mpg321 installed:

sudo apt install mpg321

you can then test an .mp3 with:

mpg321 /usr/lib/python2.7/dist-packages/pygame/examples/data/house_lo.mp3

hth!

willie

User avatar
zq8blazer
 
Posts: 9
Joined: Thu Jun 22, 2017 9:25 pm

Re: Cannot get Adafruit Stereo Bonnet to work

Post by zq8blazer »

I ran
and now it is working good; however, the audio is very low. I looked in terminal and the master volume is at 100% The speaker is an 8ohm .5watt. I hooked up a pair of laptop speakers to it and it is still quiet. Any tips?

User avatar
linux_author
 
Posts: 7
Joined: Fri Jun 23, 2017 7:22 pm

Re: Cannot get Adafruit Stereo Bonnet to work

Post by linux_author »

that pimoroni script never worked for me... do you have software volume control via the PIXEL audio prefs?

User avatar
zq8blazer
 
Posts: 9
Joined: Thu Jun 22, 2017 9:25 pm

Re: Cannot get Adafruit Stereo Bonnet to work

Post by zq8blazer »

I do not. I purchased this off their Amazon site and one of the people who reviewed it posted how he got the volume control to show in gui.

User avatar
linux_author
 
Posts: 7
Joined: Fri Jun 23, 2017 7:22 pm

Re: Cannot get Adafruit Stereo Bonnet to work

Post by linux_author »

you need to modify your Alsa settings, then select the device, then select the controls and make them the default... the bonnet works great (i have it installed in two different boxes, one with an RPI3 and the other with a Zero wireless)

it took me quite a while to research the Alsa settings - they work, with older Raspbian releases and with the new PIXEL desktop...

the Pimoroni scripts are *broken* and the Adafruit info is *bad* - you will *not* be able to configure software volume control of this bonnet (which uses the hifiberry overlay) until you type in the text files as outlined on Amazon (and elsewhere)

i'm sorry you're having a hard time with this product - it really is wonderful, and at the moment is the *only* all-in-one solution for great audio and software volume control

regards

User avatar
zq8blazer
 
Posts: 9
Joined: Thu Jun 22, 2017 9:25 pm

Re: Cannot get Adafruit Stereo Bonnet to work

Post by zq8blazer »

So those text files will Not only put a volume control in the GUI but that control will be different than the master control that can be hanged in Linux which mine already says 100%?

User avatar
zq8blazer
 
Posts: 9
Joined: Thu Jun 22, 2017 9:25 pm

Re: Cannot get Adafruit Stereo Bonnet to work

Post by zq8blazer »

Does this look correct? Because after reboot it isn't working. EDIT: I had .asoundrc in the wrong directory and when I moved it the amp showed up in the gui and it plays audio(it was at 100% so that didn't help any. Could it just be my speakers or is this not powerful enough?). Now a new problem has arisen with Amazon Alexa, it is unable to find definition cards.HifiberryDac.pcm

:(
terminal windows
terminal windows
bonnet.png (23.13 KiB) Viewed 476 times

User avatar
cbs6f
 
Posts: 4
Joined: Sun Jun 18, 2017 9:38 pm

Re: Cannot get Adafruit Stereo Bonnet to work

Post by cbs6f »

First of all, thank you for directing me to your thread to help with my problem. Hopefully I can return the favor. To get software volume control on your speaker bonnet this is what I did:
  • This is the last entry on my /boot/config.txt file, you'll want to copy/paste this or type it, up to you.

Code: Select all

# Enable audio (loads snd_bcm2835)
#dtparam=audio=on
dtoverlay=hifiberry-dac
dtoverlay=i2s-mmap
  • Either delete /etc/asound.conf or ~/.asoundrc as .asoundrc will override asound.conf. I prefer to use /etc/asound.conf.
    Copy and paste the code below into /etc/asound.conf or ~/.asoundrc whichever you decided to use.

Code: Select all

pcm.hifiberry {
 type hw
 card 0
}
pcm.!default {
 type plug
 slave.pcm "softvol"
}
pcm.dmixer {
 type dmix
 ipc_key 1024
 slave {
  pcm "hifiberry"
  channels 2
 }
}
ctl.dmixer {
 type hw
 card 0
}
pcm.softvol {
 type softvol
 slave.pcm "dmixer"
 control.name "PCM"
 control.card 0
}
  • Reboot.
    Play an audio file with mpg321 or aplay
    Go into your audio device settings, the bonnet should show up, click the select controls button and tick PCM
Audio Device Settings
Audio Device Settings
Screen Shot 2017-06-25 at 1.36.15 AM.png (783.32 KiB) Viewed 465 times
Your volume should now be adjustable!
Now, if you have popping like most people do, that's the purpose of the software mixer in the code included above. The software mixer allows you to play more than one sound at a time. The idea is that you "play" a silent sound (when really nothing is being played at all) so that you can start and stop audio without it popping each time. The command I found for this is:

Code: Select all

aplay -t raw -r 48000 -c 2 -f S16_LE /dev/zero &
You'll probably want to execute this silent audio at boot for the sake of simplicity and ease.

I hope this helps!
PS...credits are coming soon, if I miss crediting someone I apologize!

User avatar
linux_author
 
Posts: 7
Joined: Fri Jun 23, 2017 7:22 pm

Re: Cannot get Adafruit Stereo Bonnet to work

Post by linux_author »

i hope the OP gets his bonnet working properly - it really is a brilliant solution (kudos to the designer)

here's a bonus bonnet solution (i banged my forehead against the PIXEL desktop for half a morning on this one [nyuk nyuk nyuk!]):

Problem:

after installing the bonnet, then configuring /boot/config.txt and /etc/asound.conf, selecting the proper audio prefs, making the controls the default, etc. - the bonnet was working great! i had software volume control for playing streaming or local music (i use cheap thrift store Sony bookshelf speakers and old Optimus Rat Shack speakers for my two systems)

my main entertainment system is an RPi3 in a Western Digital case, booting off a 300GB hard drive; the bonnet is installed, with leads going out to a set of four press-clip speaker wire connectors; the HDMI is hooked up to a 50" Visio, and i use a wireless Logitech K400 keyboard/touchmouse to control the desktop

i wanted to play movies, but not use OpenELEC or other specialized distros; and however, AFAIK, there is only one free, off-the-shelf video player capable of playing movies via an RPi3 - vlc, unless specially recompiled, won't do it - and that application is omxplayer, a command-line utility!

but when i tried playing movies, no matter i tried to do, the sound was routed through HDMI to the TV's speakers! after some research i finally found the proper 'incantation' to specify the bonnet's hardware to be used for a movie's audio playback! i created a shell script called doit:

Code: Select all

#!/bin/sh
/usr/bin/omxplayer -b -o alsa:hw:0.0 $1
i could then open a terminal and play a movie:

Code: Select all

doit manbearpig.mp4
this was kind off a pain, so i then used the file manager to right-click on a movie file, and chose open-with to create an association:

Image

(i needed to do this separately for all movie types, such as .mp4 or .mkv)

now i can sit on the couch, browse through my videos, and play them with a mouse-click - and the audio goes through the bonnet!

hth

User avatar
linux_author
 
Posts: 7
Joined: Fri Jun 23, 2017 7:22 pm

Re: Cannot get Adafruit Stereo Bonnet to work

Post by linux_author »

zq8blazer wrote:Does this look correct? Because after reboot it isn't working. EDIT: I had .asoundrc in the wrong directory and when I moved it the amp showed up in the gui and it plays audio(it was at 100% so that didn't help any. Could it just be my speakers or is this not powerful enough?). Now a new problem has arisen with Amazon Alexa, it is unable to find definition cards.HifiberryDac.pcm

:(
bonnet.png
here's my local .asoundrc:

Code: Select all

$ cat .asoundrc
pcm.hifiberry {
	type softvol
	slave.pcm "plughw:0"
	control.name "Master"
	control.card 0
}

pcm.!default {
	type plug
	slave.pcm "softvol"
}

pcm.softvol {
	slave {
		pcm "sysdefault"
	}
	control {
		name "softvol"
		card 0
	}
}
and here's my /etc/asound.conf:

Code: Select all

$ cat /etc/asound.conf
pcm.hifiberry {
	type softvol
	slave.pcm "plughw:0"
	control.name "Master"
	control.card 0
}

pcm.!default {
	type plug
	slave.pcm "softvol"
}

pcm.softvol {
	slave {
		pcm "sysdefault"
	}
	control {
		name "softvol"
		card 0
	}
}
and the pertinent portion of /boot/config.txt:

Code: Select all

# dac
dtoverlay=i2s-mmap
dtoverlay=hifiberry-dac
regards

User avatar
zq8blazer
 
Posts: 9
Joined: Thu Jun 22, 2017 9:25 pm

Re: Cannot get Adafruit Stereo Bonnet to work

Post by zq8blazer »

Thanks everyone! Especially to you cbs6f, that worked for me!

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”