ConnorRigby

ConnorRigby

Nerves Core Team

Enabling audio on Nerves with Raspberry Pi

Preamble

As we don’t have “stickies” or “FAQs” sections yet, I’m posting this in “Discussions”.

Audio on Nerves Raspberry Pi

We’ve received a few questions about enabling/using audio on raspberry pi devices. We’ve had an issue on the RPI3 nerves_system open since late 2017, and we will likely at some point enable these features in the default systems in the future, but for anyone looking for a way to get started today can follow along here.

Setup

First We will need to follow the Customizing a Nerves System guide.

Raspberry Pi Kernel changes

Nerves currently enabled sound kernel modules on all the Raspberry Pi models. You should not need to modify anything here.

Raspberry Pi config.txt changes

We will need to follow the Boot partition overwrite guide for this step. We will be overwriting the config.txt file. You can read more about that file and its supported values here.

Find the lines

dtparam=i2c_arm=on,spi=on

and change the last to:

dtparam=i2c_arm=on,spi=on,audio=on

User packages for audio

Now we can simply enable any audio programs in Buildroot. Let’s setup espeak and alsa-utils for example.

Open the Buildroot configuration utility:

make menuconfig

You can use / to open the search menu. Look for espeak. Once found it can simply be enabled.
Do the same for aplay.

after saved we will end up with some new lines in nerves_defconfig:

BR2_PACKAGE_ALSA_UTILS=y
BR2_PACKAGE_ALSA_UTILS_AMIXER=y
BR2_PACKAGE_ALSA_UTILS_APLAY=y
BR2_PACKAGE_ALSA_UTILS_SPEAKER_TEST=y
BR2_PACKAGE_ESPEAK=y
BR2_PACKAGE_ESPEAK_AUDIO_BACKEND_ALSA=y

FIN

And that’s it. This is more an exercise in finding/enabling packages in Buildroot. Hopefully this will be useful to some.
This guide does apply to more than simply Raspberry Pi devices, but the config.txt part is Raspberry Pi specific.

Most Liked

dnsbty

dnsbty

I’ve been hoping for a guide for this for over a year now. Thank you very much!

fhunleth

fhunleth

Co-author of Nerves

I’ve heard from so many people on this topic. Thanks for all of the comments. My plan had been to update the official Raspberry Pi Nerves systems to Linux 4.14 (they’re still on 4.4) and then integrate at least aplay and make a release. Little did I know that we’d run into two fairly big issues with Linux 4.14. One is a flakiness with wired Ethernet on the 3 B+ (see Pi3b+: "kevent 4 may have been dropped" with lan78xx · Issue #2447 · raspberrypi/linux · GitHub). It seems fixed for me now, but… The other was a big change with Linux 4.14 on the BBB with how device tree overlays work, and that delayed work on the RPi. It’s working, but needs better docs. In better news, Google’s AIY voice kit’s audio hat only works with 4.14 and it’s been working well. Thanks everyone for the patience. I’ll post again soon.

Frank

ConnorRigby

ConnorRigby

Nerves Core Team

@AndyFrew Can you elaborate a bit? how are you trying to get audio out? aplay? espeak? Do you see any errors in your console? What rpi variant are you using? Audio goes through the 3.5mm connector by default, i think you can enable HDMI audio out in config.txt but i’ve never done it before.

Where Next?

Popular in Discussions Top

sergio
There’s a new TIOBE index report that came out that shows Elixir is still not in the top 50 used languages. It also goes on to call Elix...
New
MarioFlach
Hello, I want to share a project I’ve been working on for a while: https://github.com/almightycouch/gitgud Background Some time ago I ...
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
New
nburkley
AWS re:Invent is on at the moment with some interesting announcements. One new feature in particular is the Lambda Runtime API for AWS La...
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New

Other popular topics Top

vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 40042 209
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

We're in Beta

About us Mission Statement