Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Playing mp3 from variable
#2
That is not how you pass a  variable value to a system command. mpg123 is looking for file with name play_sound while the song has a name 'song1.mp3' for example.

os.system('mpg123 -q {}'.format(play_sound))
should work. I use mplayer or mpv

subprocess module offers more powerful tools to run system commands.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Messages In This Thread
Playing mp3 from variable - by mstone326 - Aug-31-2017, 01:06 AM
RE: Playing mp3 from variable - by wavic - Aug-31-2017, 08:18 AM
RE: Playing mp3 from variable - by mstone326 - Aug-31-2017, 11:48 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  pyAudio playing variable Talking2442 3 4,160 Dec-01-2020, 06:20 PM
Last Post: Talking2442

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020