Need help getting I2S audio to work
-
So I've been trying to get I2S audio to work using https://learn.adafruit.com/adafruit-max98357-i2s-class-d-mono-amp and I think the hardware part is correct when I boot up the pi I hear a quick crackle from my speaker. I can't get it to work past that though. when I try to go to audio settings I get the error "On-board audio disabled or not present". When I try to run the command "alsamixer" it says "cannot open mixer: No such file or directory" I also followed the steps on the adafruit website to set it up but no luck. I've been referring to this to try to solve my problem https://retropie.org.uk/forum/topic/30389/on-board-audio-disabled-or-not-present but still no luck. What am I doing wrong? Is it a hardware problem?
I am using a raspberry pi model b
-
@Jackslayerr said in Need help getting I2S audio to work:
When I try to run the command "alsamixer" it says "cannot open mixer: No such file or directory" I also followed the steps on the adafruit website to set it up but no luck.
...The instructions on the site (particularly this page) show how to add a software mixer, so that
alsamixer
doesn't error out.
Did you create the/etc/asound.conf
with the contents give on that page ? Does running thespeaker-test
command produce sound ? -
@mitu My "asound.conf" file looks the same as the one on that page. I also have an asound.conf.old file that's identical and doing the speaker test plays no sound. The only time I've heard anything from the speaker was on boot where it makes a quick crackle noise.
-
Can you run
aplay -l aplay -L
and post the output ?
-
@mitu Here is what I got
pi@retropie:~ $ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 [HifiBerry DAC HiFi pcm5102a-hifi-0] Subdevices: 0/1 Subdevice #0: subdevice #0
pi@retropie:~ $ aplay -L null Discard all samples (playback) or generate zero samples (capture) speakerbonnet dmixer softvol default output sysdefault:CARD=sndrpihifiberry snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0 Default Audio Device dmix:CARD=sndrpihifiberry,DEV=0 snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0 Direct sample mixing device dsnoop:CARD=sndrpihifiberry,DEV=0 snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0 Direct sample snooping device hw:CARD=sndrpihifiberry,DEV=0 snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0 Direct hardware device without any conversions plughw:CARD=sndrpihifiberry,DEV=0 snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0 Hardware device with all software conversions
-
The output looks ok, seems the configuration is applied. Can you run
amixer scontents
and post the output ? Make sure you don't have any
$HOME/.asoundrc
file present, if it's there then delete it. -
@mitu said in Need help getting I2S audio to work:
amixer scontents
Ok, got rid of the file and ran the command.
pi@retropie:~ $ amixer scontents Simple mixer control 'PCM',0 Capabilities: volume Playback channels: Front Left - Front Right Capture channels: Front Left - Front Right Limits: 0 - 255 Front Left: 255 [100%] Front Right: 255 [100%]
-
The output seems correct, does
alsamixer
still throws an error ? -
@mitu Now it does work and the audio is at 100. The sound card is set to default and the speaker test says it's doing something but I don't hear anything
pi@retropie:~ $ speaker-test speaker-test 1.1.8 Playback device is default Stream parameters are 48000Hz, S16_LE, 1 channels Using 16 octaves of pink noise Rate set to 48000Hz (requested 48000Hz) Buffer size range from 2229 to 8916 Period size range from 1114 to 1115 Using max buffer size 8916 Periods = 4 was set period_size = 1114 was set buffer_size = 8916 0 - Front Left Time per period = 2.834187 0 - Front Left Time per period = 2.995269 0 - Front Left Time per period = 2.995473 0 - Front Left
and it keeps on doing that. Maybe my speaker itself is bad? Here are the specs of it
Size: 20x30x7mm
Impedance:8ohm
Rate Input Power: 1.5W
Max Input Power: 2.0W
Wire Length: 10cm -
speaker-test
would output just some white-noise, but at 100% volume it should be audible.
As for the speaker - if it works with other sources, then it should be ok. Don't have experience with the I2S hardware, so can't help here I'm afraid. As far as the software configuration is concerned, you're fine. -
@mitu When I used this speaker before I had another audio module that worked with an audio jack and it worked. So this is a hardware problem? If it is then I don't know what I'm doing wrong because everything looks fine
-
@Jackslayerr said in Need help getting I2S audio to work:
So this is a hardware problem?
Could be, as I said everything else on the Pi side looks fine.
You can try an audio-oriented distro like Volumio, which has an easier to cofigure UI for all kind of models of I2S chips. Flash the image on your sdcard and set-it up, then test to see if it's working.
EDIT: it could be that the configuration is correct, but the AMP needs a different overlay configuration - without
hifiberry-dac
. The doc is dated 2017 and could be dated. -
@mitu How would I give the AMP a different overlay configuration?
-
@Jackslayerr There's an overlay called
max98357
which might be of help. See here.
On the other hand, you say you have a _ raspberry pi model b_ - is this a Pi1 ? -
@mitu Pi4 and I’ll check it out
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.