Skip to content

Commit f0504c7

Browse files
committed
Additions to audio HAT set up and configuration
Give specific mention to the presence of pwr indication when installing a HAT. Provide some guidance on the usage of .soundrc and offer advice on messages that can occur upon invocation of alsactl to load state files. Removal of set -e will ensure alsactl won't cause the example rc.local to exit prematurely with non-zero.
1 parent 385d10d commit f0504c7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

documentation/asciidoc/accessories/audio/configuration.adoc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ All the necessary mounting hardware including spacers, screws and connectors is
3737

3838
=== Hardware versions
3939

40-
There are multiple versions of the audio cards, and the version that you possess determines the actions required to configure it. Older IQaudIO-marked boards (black PCB) are electrically equivalent to the Raspberry Pi-branded boards (green PCB) but have different EEPROM contents. The following command can be used to confirm which version you have:
40+
There are multiple versions of the audio cards, and the version that you possess determines the actions required to configure it. Older IQaudIO-marked boards (black PCB) are electrically equivalent to the Raspberry Pi-branded boards (green PCB) but have different EEPROM contents. After attaching the HAT and applying power, if your audio card has an LED to indicate power make sure it is illuminated (for example, the PWR LED on the Codec Zero must be on). After establishing the card has power, the following command can be used to confirm which version you have:
4141

4242
[source,console]
4343
----
@@ -98,6 +98,8 @@ The following command will set your device to use the on-board MEMS microphone a
9898
$ sudo alsactl restore -f /home/<username>/Pi-Codec/Codec_Zero_OnboardMIC_record_and_SPK_playback.state
9999
----
100100

101+
It's possible that this command may result in erroneous messages such as "failed to import hw" or "No state is present for card". In most cases, these are just harmless warnings. Other errors such as "Remote I/O error" need to be given more attention because they are usually indicative of a hardware problem. In Linux I2C, a "Remote I/O error" (```REMOTEIO```) means the kernel can't communicate with an I2C device.
102+
101103
In order for your project to operate with your required settings when it is powered on, edit the `/etc/rc.local` file. The contents of this file are run at the end of every boot process, so it is ideal for this purpose. Edit the file:
102104

103105
[source,console]
@@ -109,7 +111,7 @@ Add the chosen script command above the exit 0 line and then *Ctrl X*, *Y* and *
109111

110112
[source,bash]
111113
----
112-
#!/bin/sh -e
114+
#!/bin/sh
113115
#
114116
# rc.local
115117
#
@@ -152,6 +154,8 @@ pcm.!default {
152154

153155
Press `Ctrl+X`, then the `Y` key, then *Enter* to save. Reboot once more to complete the configuration:
154156

157+
The desktop environment in modern Linux distributions such as Raspberry Pi OS will typically use PulseAudio or PipeWire for audio control. These frameworks are capable of mixing and switching audio from multiple sources and they provide a high level API for audio applications to use. Out of the box, a lot of audio apps use these frameworks by default which removes the need for them to interact directly with ALSA. Creating ```~/.asoundrc``` is only recommended if audio applications are communicating directly with ALSA or running in an environment where PulseAudio or PipeWire are not present. Usage of this file is not recommended if running the Raspberry Pi OS desktop environment because it can interfere with the UI's view of the underlying audio resources. The UI may take action to automatically clean up and remove this file if it exists so careful use of it is recommended, especially if it's intended to set any ALSA defaults.
158+
155159
[source,console]
156160
----
157161
$ sudo reboot

0 commit comments

Comments
 (0)