The NEW Build Your Own Arcade Controls
Main => Audio/Jukebox/MP3 Forum => Topic started by: rtp_burnsville on September 14, 2021, 12:14:33 pm
-
Hi,
Does anyone happen to know of some FLAC routines for playing FLAC files using Python?
I am writing a Jukebox program using Python and it currently uses Pygame for MP3 files. My music library is FLAC files so would like to directly access those for higher quality music playback. Have searched for days and not finding much of anything useful to get me started.
Thanks
-
Hi,
Does anyone happen to know of some FLAC routines for playing FLAC files using Python?
I am writing a Jukebox program using Python and it currently uses Pygame for MP3 files. My music library is FLAC files so would like to directly access those for higher quality music playback. Have searched for days and not finding much of anything useful to get me started.
Thanks
Direct play of FLAC is supported in recent versions of pygame. I have tested this very simple script with pygame 2.0.12 successfully. Run the script and press the "any key" to play the FLAC file.
import pygame
pygame.init()
pygame.display.set_mode((640, 480))
pygame.mixer.music.load('foo.flac')
while True:
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
pygame.mixer.music.play()
pygame.display.update()
You should update your pygame if you can. Latest version is 2.0.1.
-
Thank you for the information on a Pygame update...... This would be great as I could use most of the current code I have. I'll check it out.
-
Have spent several hours trying to install pygame 2.0.x on my Raspberry Pi but no luck..... Some parts appear to install but the mixer portion appears not to work. Any suggestions would be much appreciated.
The May update of the OS still includes a very old version of pygame 1.9.x
Thanks
-
Have spent several hours trying to install pygame 2.0.x on my Raspberry Pi but no luck..... Some parts appear to install but the mixer portion appears not to work. Any suggestions would be much appreciated.
The May update of the OS still includes a very old version of pygame 1.9.x
Thanks
There are some dependencies for pygame (including mixer) which may or may not be installed depending on your OS version.
You can install them as follows.
sudo apt-get install libsdl2-mixer-2.0-0 libsdl2-image-2.0-0 libsdl2-2.0-0 libsdl2-ttf-2.0-0
-
Thanks, I'll give it a try...