Installation PI5 / PI4 / ZERO (recommended)
Be sure to have your Pi OS to the last version then:
git clone https://github.com/RASPIAUDIO/ultra_install.git
cd ultra_install
sudo bash ultra_install.sh
sudo reboot
- To test, open a terminal window and type:
speaker-test -l5 -c2 -t wav
- Recording Audio:
- Volume control is managed by PulseAudio in Raspberry Pi OS, serving as middleware between the hardware and software. Enable PulseAudio in the
raspi-config
menu in Advanced - Audio Config:
sudo raspi-config
- To record audio on the Pulse device, type:
arecord -D pulse -f S16_LE -r 48000 -c 1 -d 10 test.wav
- To play back the recording, use:
aplay test.wav
Alternative Lightweight Automatic Installation Without Driver (Zero or lite OS version)
This method works without a driver by sending IĀ²C commands to initialize the codec at startup. It is ideal for lightweight installations, such as on the Raspberry Pi Zero series, you will only have basic control with this method : microphone, speaker and jack out but without fine control.
Steps:
-
Open a terminal and run the following commands:
git clone https://github.com/RASPIAUDIO/ULTRA.git cd ULTRA bash install.sh
-
Enable IĀ²C in
raspi-config
:- Navigate to 3-Interface Options > 5 IĀ²C.
- Select Enable.
- Reboot your system.
you should have this on the desktop
Playing Audio:
- After rebooting, check if your sound cards are recognized. You should see the speaker icon on the desktop.
Alternative Lightweight Manual Installation Without Driver (Zero or lite OS version) (If the Auto-Install Script Failed)
-
Clone the GitHub repository:
git clone https://github.com/RASPIAUDIO/ULTRA.git
-
Copy the file to execute at startup:
cd ULTRA gcc -o ultra ultra.c chmod 777 ultra cp ultra /etc
check if the script run as it should:
/etc/ultra
you should see this :
-
Set the script to execute at startup:
-
Open
rc.local
for editing:sudo nano /etc/rc.local
-
Modify the file to look like this:
-
```
- Configure the sound card:
-
Open
config.txt
:sudo nano /boot/firmware/config.txt
-
Comment out the existing audio line by adding
#
in front:#dtparam=audio=on
-
Add the overlay for the sound card:
dtoverlay=googlevoicehat-soundcard
-
Save the file and reboot your system.
-
Pinout:
GPIO | PIN | FUNCTION |
GPIO2 | PIN3 | I2C SDA |
GPIO3 | PIN5 | I2C SCL |
GPIO25 | PIN22 | LED |
PIN17 | 3.3v | |
PIN25 39 6 14 | GND | |
GPIO19 | PIN35 | I2S LRCLK |
PIN2 4 | 5v | |
GPIO18 | PIN12 | I2S CLK |
GPIO20 | PIN38 | I2S ADC |
GPIO21 | PIN40 | I2S DAC |
GPIO23 | PIN16 | BUTTON (this pin as an external pull up) |
Device number
this will be usefull in the alsa mixer to understand what input is connected to which microphones
Onbard microphones:
Linput1
Rinput1
External microphone jack input:
Linput2
Rinput2
Line input
Linput3
Rinput3
External speakers/speaker output:
SPK_L
SPK_R
Presets
You will notice that alsamixer have a LOT of settings with that dac so it could be confusing at first to do what you want. So I made a few basic scripts to select different devices, these Alasa presets are here : GitHub - RASPIAUDIO/WM8960-Audio-HAT: The drivers of [WM8960 Audio HAT] for Raspberry Pi look for the preset_* files
For example download this Onboard microphones input and headphones output:
For example to only enable the headphones and onboard speakers :
alsactl --file preset_onboard_microphones_input1 restore 0
sudo arecord -f cd -Dhw:0
Here are others scripts I have made:
External microphone input and headphones output:
preset_external_jack_microphone_input2
Onboard microphones input and headphones output:
preset_onboard_microphones_input1
Onboard microphones with high gain input and headphones output:
preset_onboard_microphones_input1_alotofgain
Headphones output:
preset_headphone_jack_output_only
External line input and headphones output:
preset_lineIN-jack_input3
Headphones ans speakers output:
preset_onboard_Speakers_and_headphone_jack_output
To save your own preset:
alsactl --file Mycustom_presets store
To restore your own preset:
alsactl --file Mycustom_presets restore