A few months ago I bought a RasPi 3 B+ to act as an overglorified doorbell using reed switches to tell the Pi to play a custom MP3 with the "Playsound" Module into the Company's PA system.

It worked flawlessly up until 2 days ago when we experienced a power outage. The Pi and PA system are on battery back up until we got power back so no damage should have been sustained. I've troubleshot all of the wires, switches, audio plugs and all non Pi hardware and they all work fine. I have the Pi set to use analog instead of HDMI even though it doesn't have a monitor plugged into it just to be safe. I can get YouTube videos and the raw .mp3 itself to play on VLC through the A/V port without any problems but but my Python script no longer plays sound through it, but the script WILL play sound through HDMI.

Safe to say I've spent way too many hours trying things to get it work and I've exhausted them all. I just don't understand why it would work flawlessly for so long and then just stop. I haven't even updated Python or any of the libraries required to make it work.

Any insight would be greatly appreciated!

My spaghetti Code run on Python3.5:

import RPi.GPIO as GPIO #import the GPIO library
import time
from playsound import playsound

GPIO.setup(12, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(36, GPIO.IN, pull_up_down=GPIO.PUD_UP)

name = "Admin"
print("Hello " + name)
chime = "chime.mp3"

while True:
       if GPIO.input(12):
              print("Front door is closed")
       if GPIO.input(12) == False:
              print("Front door is open")

       if GPIO.input(36):
              print("Back door is closed")
       if GPIO.input(36) == False:
              print("Back door is open")

1 Answer 1


playsound uses Gstreamer library for playback, which should normally rely on PulseAudio (although other plugins do exist) using the default audio sink. I would start by running pavucontrol and check that the A/V port is selected as default audio sink, and set it as default if it isn't.

This question has an answer with a much more detailed troubleshooting instructions in case changing the default audio sink doesn't 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.