Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1277

Python • No sound using Pygame

$
0
0
Hey all, long time lurker, first time poster...

I am running a Rpi 3b+, with Bookworm 32bit installed. I am trying to use Pygame to play a simple MP3.

Code:

import pygame            output_file = "Hello.mp3"try:    pygame.mixer.init()    pygame.mixer.music.load(output_file)    pygame.mixer.music.play()    print("Playing...")    while pygame.mixer.get_busy():       pygame.time.wait(100)  # ms           print ("Finished.")except IOError as error:    print(error)

I do get the following output:

<frozen importlib._bootstrap>:241: RuntimeWarning: Your system is neon capable but pygame was not built with support for it. The performance of some of your blits could be adversely affected. Consider enabling compile time detection with environment variables like PYGAME_DETECT_AVX2=1 if you are compiling without cross compilation.
pygame 2.5.2 (SDL 2.26.5, Python 3.11.2)
Hello from the pygame community. https://www.pygame.org/contribute.html
Playing...
Finished.

The warning is suspicious but doesn't seem to effect playback. I am running headless, with audio routed to the 3.5mm jack.
I just get no sound... Any help would be appreciated.

Statistics: Posted by analoggus — Wed Mar 13, 2024 7:23 am



Viewing all articles
Browse latest Browse all 1277

Trending Articles