Merge branch 'main' of github.com:Ralim/PineBuds-Open-SDK

This commit is contained in:
Ben V. Brown 2022-12-30 23:19:45 +11:00
commit 2cc53ca4f5
2 changed files with 34 additions and 0 deletions

View File

@ -65,3 +65,11 @@ bestool write-image out/open_source/open_source.bin --port /dev/ttyACM1
- Hold : Previous track - Hold : Previous track
- Triple tap : Volume Up - Triple tap : Volume Up
- Quad tap : Volume Down - Quad tap : Volume Down
## Changing audio alerts
The audio alerts are stored in:
`config/_default_cfg_src_/res/en/`
You can convert these .txt files to .wav files by using the script `convert.sh` with the -T flag, the resulting file will be named `output.wav`.
If you want to change the alert to a custom sound use the -W flag on your wav file and then move the resulting `SOUND.txt` file to the place you want to replace (eg. `config/_default_cfg_src_/res/en/SOUND_POWER_ON.txt`)

26
convert.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/sh
txt_to_wav() {
xxd -r -p $args > out.raw
ffmpeg -f sbc -ac 1 -i ./out.raw output.wav
rm ./out.raw
}
wav_to_txt() {
ffmpeg -i $args -f sbc -ac 16000 -ac 1 -map_metadata -1 out.raw
xxd -i ./out.raw | head -n -2 \
| tail -n +2 | sed 's/ //g' \
| tr --delete '\n' \
| sed 's/,/\,\n/16; P; D' > SOUND.txt
rm ./out.raw
}
[ ${1} = "-T" ] || [ ${1} = "--txt-to-wav" ] && shift 1 && args=$@ && txt_to_wav && exit
[ ${1} = "-W" ] || [ ${1} = "--wav-to-txt" ] && shift 1 && args=$@ && wav_to_txt && exit
echo "
Sound format converter:
Usage:
./convert.sh [option] [input-file]
Options:
-T or --txt-to-wav Converts the text file to a wav audio file (output.wav)
-W or --wav-to-txt Converts a wav file to a file readable by the pinebuds firmware (SOUND.txt)
"