forked from GothAck/hifimems-kmod
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update instructions and build to work with the Pimoroni Speaker PHAT
- Loading branch information
Showing
4 changed files
with
105 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,61 @@ | ||
# AoSC Driver Simple I2S Hifiberry and ICS43432 MEMS | ||
|
||
> Use Hifiberry-dac / Adafruit Speaker Bonnet and ICS43432 / SPH0645 I2S MEMS Mic simultaneously | ||
> Use Hifiberry-dac and ICS43432 simultaneously | ||
Tested with: | ||
- [Adafruit I2S MEMS Microphone Breakout](https://www.adafruit.com/product/3421) | ||
- [Adafruit I2S 3W Stereo Speaker Bonnet for Raspberry Pi](https://www.adafruit.com/product/3346) | ||
- [Adafruit I2S MEMS Microphone Breakout](https://www.adafruit.com/product/3421) and [Pimoroni Speaker PHAT for Raspberry Pi Zero](https://www.adafruit.com/product/3401) | ||
- [Adafruit I2S MEMS Microphone Breakout](https://www.adafruit.com/product/3421) and [Adafruit I2S 3W Class D Amplifier Breakout](https://www.adafruit.com/product/3006) | ||
|
||
Based on googlevoicehat-{codec,soundcard}.c by Peter Malkin. | ||
|
||
## Install | ||
|
||
This was installed successfully on Linux 4.9.35+ on a Raspberry Pi Zero W | ||
This was installed successfully on Linux 4.9.59+ on a Raspberry Pi Zero W | ||
|
||
```sh | ||
sudo apt-get update | ||
sudo apt-get dist-upgrade | ||
sudo apt-get install raspberrypi-kernel-headers | ||
|
||
git clone https://github.com/GothAck/hifimems-kmod | ||
git clone https://github.com/Sarev0k/hifimems-kmod | ||
cd hifimems-kmod | ||
|
||
make KERNEL_SRC=/lib/modules/$(uname -r)/build all | ||
sudo make KERNEL_SRC=/lib/modules/$(uname -r)/build modules_install | ||
sudo make KERNEL_SRC=/lib/modules/$(uname -r)/build install | ||
``` | ||
|
||
## Boot Config Setup | ||
```sh | ||
sudo sed -i "/^#dtparam=i2s=on$/ s|#||" /boot/config.txt | ||
sudo sed -i "/^dtparam=audio=on$/ s|^|#|" /boot/config.txt | ||
echo "dtoverlay=hifimems-soundcard" | sudo tee -a /boot/config.txt | ||
``` | ||
|
||
## Audio Config Setup | ||
```sh | ||
sudo cp asound.conf /etc/asound.conf | ||
|
||
|
||
# Reduce speaker pops and crackles | ||
sudo apt-get install pulseaudio | ||
|
||
sudo sed -i "s/^.ifexists module-udev-detect.so\b/&.ignore/" /etc/pulse/default.pa | ||
sudo sed -i "s/^load-module module-native-protocol-unix\b/& auth-anonymous=1 socket=\/tmp\/pulseaudio.socket/" /etc/pulse/default.pa | ||
sudo sed -i "/^#load-module module-native-protocol-tcp$/ s|#||" /etc/pulse/default.pa | ||
sudo sed -i "s/^load-module module-native-protocol-tcp\b/& auth-ip-acl=127.0.0.1/" /etc/pulse/default.pa | ||
sudo sed -i "s/^load-module module-suspend-on-idle\b/& timeout=604800/" /etc/pulse/default.pa | ||
|
||
echo "autospawn = no" | sudo tee -a /etc/pulse/client.conf | ||
echo "default-server = unix:/tmp/pulseaudio.socket" | sudo tee -a /etc/pulse/client.conf | ||
|
||
echo "exit-idle-time = -1" | sudo tee -a /etc/pulse/daemon.conf | ||
echo "resample-method = ffmpeg" | sudo tee -a /etc/pulse/daemon.conf | ||
echo "enable-remixing = yes" | sudo tee -a /etc/pulse/daemon.conf | ||
echo "flat-volumes = no" | sudo tee -a /etc/pulse/daemon.conf | ||
echo "default-sample-rate = 48000" | sudo tee -a /etc/pulse/daemon.conf | ||
|
||
sudo cp pulseaudio.service /etc/systemd/system/pulseaudio.service | ||
sudo systemctl daemon-reload | ||
sudo systemctl enable pulseaudio | ||
sudo reboot | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
pcm.!default { | ||
type asym | ||
playback.pcm "playback" | ||
capture.pcm "capture" | ||
} | ||
|
||
pcm.playback { | ||
type plug | ||
slave.pcm "dmixer" | ||
} | ||
|
||
pcm.dmixer { | ||
type dmix | ||
ipc_key 1024 | ||
ipc_perm 0666 | ||
slave.pcm "speaker" | ||
bindings { | ||
0 0 | ||
1 1 | ||
} | ||
} | ||
|
||
ctl.dmixer { | ||
type hw | ||
card sndrpihifimemss | ||
} | ||
|
||
pcm.speaker { | ||
type hw | ||
card sndrpihifimemss | ||
} | ||
|
||
pcm.capture { | ||
type plug | ||
slave.pcm "microphone" | ||
} | ||
|
||
pcm.microphone { | ||
type hw | ||
card sndrpihifimemss | ||
channels 2 | ||
format S32_LE | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[Unit] | ||
Description=PulseAudio Daemon | ||
After=sound.target network.target | ||
Requires=sound.target | ||
|
||
[Install] | ||
WantedBy=default.target | ||
|
||
[Service] | ||
Restart=always | ||
Type=simple | ||
PrivateTmp=false | ||
ExecStart=/usr/bin/pulseaudio --realtime --disallow-exit --no-cpu-limit --log-target=syslog | ||
ExecStop=/usr/bin/pulseaudio --kill |