This is an old revision of the document!


Audio Injector Installation

Audio Injector is a audio hat for the Raspberry Pi. This sound card comes with two inputs and two outputs, plus a build in microphone.

Installation

This manual is made for an Raspberry Pi 4 running Raspian Buster on it.
After connecting the Audio Injector to the Raspberry Pi change some configurations, in:

 $ sudo nano /boot/config.txt

Comment out:

 # dtparam=audio=on

And type in:

 dtoverlay=audioinjector-wm8731-audio

ctl + o for saving, press return and ctl + x to leave.
Reboot your Raspberry Pi:

 $ sudo reboot


After the reboot download:

 $ wget https://github.com/Audio-Injector/stereo-and-zero/archive/master.zip

Unpack it:

 $ unzip master.zip

go into the folder:

 $ cd stereo-and-zero-master/

and run:

 $ alsactl --file asound.state.MIC.thru.test restore
 $ alsactl --file asound.state.RCA.thru.test restore

Test

For the 10 kHz test follow the instructions on https://github.com/Audio-Injector/stereo-and-zero.
Then install sox:

 $ sudo apt install sox

In /home/pi/stereo-and-zero-master/ run:

 $ sudo chmod 755 audioInjector-test.sh
 $ ./audioInjector-test.sh

Simple Play and Record

Recording:

 $ arecord -r 48000 -f S16_LE -c 2 -d 20 test.wav

Playing back:

 $ aplay test.wav

I2S Pins

Beside the power and ground the I2S bus needs the following pins:

 GPIO 18 (Pin12)    BITCLOCK;
 GPIO 19 (Pin 35)   LRCLOCK;
 GPIO 20 (Pin 38)   DATA IN;
 GPIO 21 (Pin 40)   DATA OUT;

And the I2C bus needs these pins:

 GPIO 02 (pin 02)   SDIN 
 GPIO 03 (pin 03)   SCLK

graphic from: https://hifiduino.wordpress.com/2014/11/13/raspberry-pi-b-digital-audio/