Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: FLAC routines similar to Pygame  (Read 5385 times)

0 Members and 1 Guest are viewing this topic.

rtp_burnsville

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 5
  • Last login:Today at 11:14:00 am
  • I want to build my own arcade controls!
FLAC routines similar to Pygame
« 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

10yard

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 137
  • Last login:Today at 11:46:56 am
  • L BREAK into program
    • DKAFE Frontend
Re: FLAC routines similar to Pygame
« Reply #1 on: September 14, 2021, 06:21:28 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

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. 

Code: [Select]
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.

« Last Edit: September 14, 2021, 06:27:10 pm by 10yard »
Check out my Donkey Kong Arcade Frontend at https://github.com/10yard/dkafe#readme


rtp_burnsville

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 5
  • Last login:Today at 11:14:00 am
  • I want to build my own arcade controls!
Re: FLAC routines similar to Pygame
« Reply #2 on: September 15, 2021, 11:58:59 am »
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.


rtp_burnsville

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 5
  • Last login:Today at 11:14:00 am
  • I want to build my own arcade controls!
Re: FLAC routines similar to Pygame
« Reply #3 on: September 28, 2021, 12:02:43 pm »
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

10yard

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 137
  • Last login:Today at 11:46:56 am
  • L BREAK into program
    • DKAFE Frontend
Re: FLAC routines similar to Pygame
« Reply #4 on: September 28, 2021, 03:37:59 pm »
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.

Code: [Select]
sudo apt-get install libsdl2-mixer-2.0-0 libsdl2-image-2.0-0 libsdl2-2.0-0 libsdl2-ttf-2.0-0

Check out my Donkey Kong Arcade Frontend at https://github.com/10yard/dkafe#readme


rtp_burnsville

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 5
  • Last login:Today at 11:14:00 am
  • I want to build my own arcade controls!
Re: FLAC routines similar to Pygame
« Reply #5 on: October 05, 2021, 11:33:28 am »
Thanks, I'll give it a try...