1

I have tried using Pygame to play a .wav file over Bluetooth on my Raspberry Pi 4 Model B, and I am not hearing any sound when running the script. It plays normally when I open the wav file from the folder, but not from script. Very confused as I have ran the exact same code from 3 Model B+ and it works all fine..??

I get no error message and the version of pygame has been updated recently.

Here is the code and I would very much appreciate your help:

import pygame
from pygame.mixer import Sound
import os
from time import sleep
pygame.init()
pygame.mixer.init()
print(os.getcwd())

soundObj=pygame.mixer.Sound("hello.wav")
soundObj.play()
sleep(12)
soundObj.stop()
aropemaker
  • 11
  • 2
  • You're sure that your default audio output is to the bluetooth? – Random Davis Sep 17 '20 at 16:45
  • I'm not sure, I am new to Rasperry Pi and am unsure how to change this though. How do I check? – aropemaker Sep 17 '20 at 19:19
  • So I have managed to find out how to change the audio output, however, I only have two options. HDMI and Headphones. I have plugged in my headphones and it works fine. How do I add Bluetooth to the system? – aropemaker Sep 17 '20 at 19:49
  • How do you normally output to bluetooth? If you can play audio to it via whatever media player you use when opening the .wav directly, how's that outputting to bluetooth? – Random Davis Sep 17 '20 at 20:18

0 Answers0