Python Forum
How to play a song .wav or .mp3 with audioop native library
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to play a song .wav or .mp3 with audioop native library
#1
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!!!
Reply
#2
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.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#3
Also see the audio section here: https://github.com/vinta/awesome-python#audio
Reply
#4
(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")
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How can I send a .mp3 to play through my mic? ejected 20 19,813 Sep-01-2022, 02:38 AM
Last Post: victormayer
  Play the next music in a list Pymax 0 1,181 Jul-28-2021, 07:27 PM
Last Post: Pymax
  how do i play an mp3 from a list gr3yali3n 3 2,073 Dec-01-2020, 08:50 AM
Last Post: Axel_Erfurt
  View and extend native python class PythonDev 2 1,614 Oct-24-2020, 08:59 PM
Last Post: Gribouillis
  Song Modifying Program Starting Point BadenJaden 1 1,830 Mar-27-2020, 11:36 AM
Last Post: pyzyx3qwerty
  How To Unload Windows Native Extension ( .pyd )? zicklag 3 3,984 Mar-18-2020, 09:52 AM
Last Post: lexielightmap
  splitting a random song Unknown_Relic 3 2,301 Nov-15-2019, 01:04 PM
Last Post: baquerik
  random selection of song and artist not working Unknown_Relic 2 2,317 Nov-08-2019, 02:06 PM
Last Post: perfringo
  How to play against the computer Help_me_Please 4 3,988 Aug-29-2019, 03:37 PM
Last Post: ThomasL
  Native support for array-slicing syntax? nxs 1 2,224 Apr-22-2019, 02:34 AM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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