Apr-12-2022, 05:07 PM
Newish guy here wanting to use a headless RPi3B running MXRPi to play a list of MP3s randomly. This will be my first attempt to play MP3s using RPi and Python.
First order was to determine what Python player works best on a MXRPi RPi3B+. What I found confused me some.
I tried python-vlc, playsound & pygames. When they ran from Thonny, the playback was very undesirably slooooow. I couldn't tell from the documentation that there was something to pass to speed up the playback. Also when attempting to run the programs from the terminal, there was no sound at all (no errors, took a moment to complete, but no sound).
Lastly, I can successfully play these mp3s using both the music and the multimedia players that come with MXRPi but I can't run them headlesly (at least I don't think so).
What must I do to get any one of these to play back, and at normal speed when run from terminal, so I can decide on which one I want to continue to work with?
Here are the 3 programs:
First order was to determine what Python player works best on a MXRPi RPi3B+. What I found confused me some.
I tried python-vlc, playsound & pygames. When they ran from Thonny, the playback was very undesirably slooooow. I couldn't tell from the documentation that there was something to pass to speed up the playback. Also when attempting to run the programs from the terminal, there was no sound at all (no errors, took a moment to complete, but no sound).
Lastly, I can successfully play these mp3s using both the music and the multimedia players that come with MXRPi but I can't run them headlesly (at least I don't think so).
What must I do to get any one of these to play back, and at normal speed when run from terminal, so I can decide on which one I want to continue to work with?
Here are the 3 programs:
import vlc song = vlc.MediaPlayer("file.mp3'") song.play()
import playsound playsound.playsound('file.mp3')
import pygame pygame.mixer.init() pygame.mixer.music.load('file.mp3') pygame.mixer.music.play()