Compare commits
3 Commits
74aea45d73
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 5016ca5567 | |||
| a22b2158e1 | |||
| 00e3d27774 |
@@ -1,9 +1,3 @@
|
|||||||
#pcm.!default {
|
|
||||||
# type hw
|
|
||||||
# card Zero
|
|
||||||
## card USB
|
|
||||||
#}
|
|
||||||
|
|
||||||
pcm.hw0mix {
|
pcm.hw0mix {
|
||||||
type dmix
|
type dmix
|
||||||
ipc_key 1939 # must be unique
|
ipc_key 1939 # must be unique
|
||||||
|
|||||||
38
README.md
38
README.md
@@ -12,7 +12,12 @@ Hardware
|
|||||||
- Buttons connected to the Raspberry pi GPIO as shown in the schema to debounce noisy contacts
|
- Buttons connected to the Raspberry pi GPIO as shown in the schema to debounce noisy contacts
|
||||||

|

|
||||||
|
|
||||||
- USB speaker with a microphone e.g. [Jabra Speak 410](https://www.jabra.com/_/media/Jabra_VXi_Product-Documentation/Jabra-SPEAK-410-Series/technical-specifications/RevB/Jabra-Speak-410-Techsheet-A4-290420-Web.pdf)
|
- USB speaker with a microphone e.g. [Jabra Speak 410](https://www.jabra.com/_/media/Jabra_VXi_Product-Documentation/Jabra-SPEAK-410-Series/technical-specifications/RevB/Jabra-Speak-410-Techsheet-A4-290420-Web.pdf) or [Codec Zero](https://www.raspberrypi.com/products/codec-zero/)
|
||||||
|
|
||||||
|
- for the `Codec Zero` make follwoing changes
|
||||||
|
> `sudo nano /boot/config.txt`
|
||||||
|
`#dtparam=audio=on`
|
||||||
|
`dtoverlay=rpi-codeczero`
|
||||||
|
|
||||||
- microSD card 8GB
|
- microSD card 8GB
|
||||||
|
|
||||||
@@ -22,7 +27,7 @@ Operating system
|
|||||||
----------------
|
----------------
|
||||||
Install [Raspberry Pi Imager](https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility/) into your notebook. Launch it and choose `Raspberry Pi OS Lite` to write into the microSD card
|
Install [Raspberry Pi Imager](https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility/) into your notebook. Launch it and choose `Raspberry Pi OS Lite` to write into the microSD card
|
||||||
|
|
||||||
Power on the Raspberry pi and finish the installation process. Log into its console using either:
|
Power on the `Raspberry Pi` and finish the installation process. Log into its console using either:
|
||||||
- ethernet/wifi from your notebook: `ssh pi@raspberrypi`
|
- ethernet/wifi from your notebook: `ssh pi@raspberrypi`
|
||||||
- connected keyboard and monitor
|
- connected keyboard and monitor
|
||||||
- serial port
|
- serial port
|
||||||
@@ -33,7 +38,7 @@ Once you are logged into the `Raspberry pi` console update your system
|
|||||||
> `sudo apt update`
|
> `sudo apt update`
|
||||||
`sudo apt upgrade`
|
`sudo apt upgrade`
|
||||||
|
|
||||||
and install `git`. It will be used to download the `dog-trainer`
|
Install `git`. It will be used to download the `dog-trainer`
|
||||||
> `sudo apt install -y git`
|
> `sudo apt install -y git`
|
||||||
|
|
||||||
Recordings must be edited a little bit therefore some audio processing tool is needed. Install `ffmpeg` which will do the job
|
Recordings must be edited a little bit therefore some audio processing tool is needed. Install `ffmpeg` which will do the job
|
||||||
@@ -52,13 +57,17 @@ Go into the newly created directory
|
|||||||
Configuration
|
Configuration
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
First try using default audio device for playback and recording. Edit `dog-trainer.py` and activate `PLAY_DEVICE="default"` and `REC_DEVICE="default"`
|
Check your Raspberry pi board pin layout and make sure your buttons GPIOs match `PINS = [17, 22, 27]` from `dog-trainer.py`
|
||||||
|
> `pinout`
|
||||||
|
|
||||||
|
Try using default audio device for playback and recording. Edit `dog-trainer.py` and activate `PLAY_DEVICE="default"` and `REC_DEVICE="default"`
|
||||||
> `nano dog-trainer.py`
|
> `nano dog-trainer.py`
|
||||||
|
|
||||||
Skip to the next section `Run it!`. If either playback or recording does not work check your sound cards
|
Skip to the next section `Run it!`. If either playback or recording does not work check your sound cards
|
||||||
> `aplay -L | grep ^hw:CARD=`
|
> `aplay -L | grep ^hw:CARD=`
|
||||||
|
`arecord -L | grep ^hw:CARD=`
|
||||||
|
|
||||||
If your sound device is other then `USB` then change the line `card USB` in ALSA config
|
Put your sound device name `"hw:Zero"` or `"hw:USB"` into the ALSA config file
|
||||||
> `nano .asoundrc`
|
> `nano .asoundrc`
|
||||||
|
|
||||||
Install the ALSA config file
|
Install the ALSA config file
|
||||||
@@ -82,14 +91,18 @@ If your username and group is other then `pi` and `pi` then also run
|
|||||||
> `sed -i "s#User=pi#User=$USER#" dog-trainer.service`
|
> `sed -i "s#User=pi#User=$USER#" dog-trainer.service`
|
||||||
`sed -i "s#Group=pi#Group=$(id -gn)#" dog-trainer.service`
|
`sed -i "s#Group=pi#Group=$(id -gn)#" dog-trainer.service`
|
||||||
|
|
||||||
Install the systemd service file
|
> `sed -i "s#User=pi#User=$USER#" sound-init.service`
|
||||||
> `sudo mv dog-trainer.service /etc/systemd/system/`
|
`sed -i "s#Group=pi#Group=$(id -gn)#" sound-init.service`
|
||||||
|
|
||||||
|
Install the systemd service files
|
||||||
|
> `sudo mv dog-trainer.service /etc/systemd/system/`
|
||||||
|
`sudo mv sound-init.service /etc/systemd/system/`
|
||||||
|
|
||||||
Reload systemd manager configuration
|
Reload systemd manager configuration
|
||||||
> `systemctl daemon-reload`
|
> `sudo systemctl daemon-reload`
|
||||||
|
|
||||||
Enable the `dog-trainer` service at boot time and also run it
|
Enable the `dog-trainer` service at boot time and also run it
|
||||||
> `systemctl enable --now dog-trainer`
|
> `sudo systemctl enable --now dog-trainer`
|
||||||
|
|
||||||
If it does not work check logs
|
If it does not work check logs
|
||||||
> `journalctl -f -u dog-trainer`
|
> `journalctl -f -u dog-trainer`
|
||||||
@@ -100,4 +113,7 @@ Set volume for playback and recording
|
|||||||
Launch soundcard mixer
|
Launch soundcard mixer
|
||||||
> `alsamixer`
|
> `alsamixer`
|
||||||
|
|
||||||
Press F6 to select a soundcard. Find your USB sound device in the list e.g. `Jabra Speak 410 USB`. Press F4 and use up/down arrow keys to set recording volume and repeat also for the playback (F3). Make sure it is not muted. Press (m) to toggle mute. Press ESC to exit.
|
Press F6 to select a soundcard. Find your USB sound device in the list e.g. `Jabra Speak 410 USB`. Press F4 and use up/down arrow keys to set recording volume and repeat also for the playback (F3). Make sure it is not muted. Press (m) to toggle mute. Press ESC to exit.
|
||||||
|
|
||||||
|
To preserve audio setting after the boot run
|
||||||
|
> `sudo alsactl store`
|
||||||
Reference in New Issue
Block a user