Hello friends,
Can anyone help me to play a song file in .mp3 or .wav using the native library called audioop?
I dont wanto to use external libraris because some places we dont have permissions to install packages.
I only need a simple example about play a song file. I have searched it for a long time and still not found an example using audioop.
Thanks!!!
There are a number of examples here
https://www.programcreek.com/python/index/771/audioop, look through them and see if any match your needs. If you cannot find any that match your exact needs, post the code you have (using the proper code tags) and what you are trying to do.
(Mar-13-2018, 07:51 PM)IvanSilva Wrote: [ -> ]Can anyone help me to play a song file in .mp3 or .wav using the native library called audioop?
audioop is not a music player.
(Mar-13-2018, 07:51 PM)IvanSilva Wrote: [ -> ]I dont wanto to use external libraris because some places we dont have permissions to install packages.
As far as i now there is no module in standard library that play mp3.
One trick is to use what already on the OS.
Example opening a file with its associated application(this is Windows only).
import os
os.startfile('my_mp3.mp3')
Use subprocess(this can be used Windows a Linux).
import subprocess
player_path = r"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe"
mp3_path = r"C:\my_mp3\Clean Bandit.mp3"
subprocess.run([player_path, mp3_path])
Linux.
import subprocess
player_path = "nvlc"
mp3_path = '/home/mint/Downloads/sky.mp3'
subprocess.run([player_path, mp3_path])
Use browser.
import webbrowser
webbrowser.open(r"C:\my_mp3\Clean Bandit.mp3")