Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to play a mp3 file in python

from pygame import mixer#if this module in not installed then install it by pip install pygame
mixer.init()
mixer.music.load('alarm.mp3')
mixer.music.play()
Comment

how to play mp3 audio in python

#TO playsound in your python code you need to install play sound module.
# To install playsound moudule-
#(1). Open Terminal 
#(2). "In terminal only" type "pip install playsound"
# After installing playsound you need to write-
import playsound from playsound
# syntax of playsound command
playsound("C:file_linkfile_name")
# note: ````in python you need to specify path using double back slashes "",
# instead of single forward or back slash````
# please read the starting comment lines they are very useful(ignore if readed)
# Enjoy :)
Comment

play mp3 file python

from playsound import playsound
playsound(r"C:path	osong")
Comment

Python How To Play Mp3 File

import pygame
pygame.mixer.init()
pygame.mixer.music.load('sample.mp3')
pygame.mixer.music.play()
Comment

Play Mp3 Files With Python Using the playsound Package

# If you don’t have the playsound package installed on your system,
# you can install it with the command:

"""
$ pip install playsound
"""

import playsound

playsound.playsound('sample.mp3')
Comment

PREVIOUS NEXT
Code Example
Python :: python create dataframe by row 
Python :: how to change todays date formate in python 
Python :: logging.basicConfig() 
Python :: python spliting string into list 
Python :: hash with python 
Python :: four digit representation python 
Python :: lambda function dataframe 
Python :: check if string equals string in list python 
Python :: code folding vim python 
Python :: python start process in background and get pid 
Python :: how to change values of dictionary in python 
Python :: filter foreign fileds django_filters 
Python :: image resize in python 
Python :: hash python png 
Python :: python set workdir 
Python :: rust vs python 
Python :: python format strings 
Python :: pytest logcli to write to file 
Python :: concat dataframe pandas 
Python :: Python not readable file 
Python :: start python server 
Python :: range of y & x in scatter 
Python :: cv2.imwrite 
Python :: remove file os python 
Python :: randomly pick a value in the list 
Python :: how to pick everything after a character in python 
Python :: how to find index of maximum value in dataframe in python 
Python :: python input list of ints 
Python :: raw input example python 
Python :: socket programming python 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =