0

This is my first question on this site, so please excuse (and point out) any mistakes I make in my post.

I'm running Bookworm on a Rpi4.

I need audio for a project that I'm doing, so I decided to use the Rpi HiFi AMP Hat made by InnoMaker (https://www.inno-maker.com/product/hifi-amp-hat/). My project is controlled by a simple shell script:

#!/bin/bash

voice=$(python3 voice.py)
face=$(python3 face.py)
finger=$(python3 finger.py)

cd assets
echo $voice > nameTemp.txt
cd ..

if [[ "$voice" != "None" ]]; then
    python3 open.py
else
    python3 deny.py
fi

The first time I run this script, it runs perfectly. However, if I try to run it again, no audio plays. What's really weird is that I can play audio multiple times just fine by clicking on audio files, but when I run this shell script, it stops working after the first time. After running the script, no audio plays from the Pi (including clicking on files, etc.). If I run the python scripts individually, nothing goes wrong, the issue only occurs when running the shell script.

I thought the problem was the DAC/amp, so I switched it out for Adafruit's Sound Bonnet, but that had the same problem. I then thought maybe there is an issue with what I did in my /boot/config.txt file, but I don't know what could be the issue. The only lines I modified are:

dtparam=i2s=on
#dtparam=audio=on
dtoverlay=hifiberry-amp
dtoverlay=vc4-kms-v3d,noaudio

Does anyone have any ideas as to what is causing this problem? Please let me know if more details are needed.

2
  • What does your python code do? Personally I would have one Python program handling everything rather than shell scripts.
    – CoderMike
    Jan 2 at 18:53
  • You need to start by contacting your "HAT" vendor for troubleshooting help.
    – Seamus
    Jan 2 at 19:18

1 Answer 1

0

I listened to @CoderMike's advice and used Python rather than a shell script. From there, I was able to narrow down the problem to one script. I realized I made a stupid mistake and was using a GPIO pin that the DAC/amp was using to power a different device. Thanks for the advice and the help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.