current position:Home>Python utility module playsound
Python utility module playsound
2022-01-31 12:16:45 【Notes of the lost schoolboy】
This is my participation 11 The fourth of the yuegengwen challenge 12 God , Check out the activity details :2021 One last more challenge
Environmental Science
- windows 10 64 position
- anaconda with python 3.8
- playsound 1.3.0
Preface
above Python Text voice broadcast Introduced the use of Library pyttsx3
To realize voice broadcasting .pyttsx3
It's a string , That is the text , This article introduces another library playsound
, It broadcasts content from voice files , such as mp3
file .playsound
Support for multiple platforms , Only depend on python
.
install
The official installation method is
pip install playsound
Copy code
But when I was executing , I found the wrong report , Prompt to download the corresponding source package
Then download it , Unzip after completion , I installed... Here git
Tools for , All can be used directly git shell
To operate the , It simulates linux
Environment , You can use it directly tar
Command to decompress
then , Let's switch to the target python
A virtual environment , Enter the source directory , Use command
pip install .
Copy code
Installation
Use
After installed , It's very simple to use
from playsound import playsound
playsound('play.mp3')
Copy code
playsound
Method also has an optional parameter block
, It's a boolean type , The default is True
, If it is False
, Represents asynchronous execution
principle
Because the underlying audio playing mechanism of each platform is different ,playsound
It is also the method of calling the respective platform itself , No new mechanism has been introduced
-
windows
It uses
windll.winmm
, The formats that have passed the test includewav
andmp3
-
macos
It uses
AppKit.NSSound
, The formats that have passed the test includewav
andmp3
, In general ,QuickTime
Can broadcast ,playsound
Can also broadcast -
linux
It uses
GStreamer
, becauselinux
There are too many distributions , The author also said that there was no complete test , If you have questions, you can submitissue
orpr
Python Practical module topic
More useful python
modular , Please move
Reference material
copyright notice
author[Notes of the lost schoolboy],Please bring the original link to reprint, thank you.
https://en.pythonmana.com/2022/01/202201311216426135.html
The sidebar is recommended
- [algorithm learning] 1108 IP address invalidation (Java / C / C + + / Python / go / trust)
- Test platform series (71) Python timed task scheme
- Java AES / ECB / pkcs5padding encryption conversion Python 3
- Loguru: the ultimate Python log solution
- Blurring and anonymizing faces using OpenCV and python
- How fast Python sync and async execute
- Python interface automation test framework (basic) -- common data types list & set ()
- Python crawler actual combat, requests module, python realizes capturing video barrage comments of station B
- Python: several implementation methods of multi process
- Sword finger offer II 054 Sum of all values greater than or equal to nodes | 538 | 1038 (Java / C / C + + / Python / go / trust)
guess what you like
-
How IOS developers learn python programming 3-operator 2
-
How IOS developers learn python programming 2-operator 1
-
[Python applet] 8 lines of code to realize file de duplication
-
Python uses the pynvml tool to obtain the working status of GPU
-
Data mining: Python actual combat multi factor analysis
-
Manually compile opencv on MacOS and Linux and add it to Python / C + + / Java as a dependency
-
Use Python VTK to batch read 2D slices and display 3D models
-
Complete image cutting using Python version VTK
-
Python interface automation test framework (basic) -- common data types Dict
-
Django (make an epidemic data report)
Random recommended
- Python specific text extraction in actual combat challenges the first step of efficient office
- Daily python, Part 8 - if statement
- Django model class 1
- The same Python code draws many different cherry trees. Which one do you like?
- Python code reading (Chapter 54): Fibonacci sequence
- Django model class 2
- Python crawler Basics
- Mapping 3D model surface distances using Python VTK
- How to implement encrypted message signature and verification in Python -- HMAC
- leetcode 1945. Sum of Digits of String After Convert(python)
- leetcode 2062. Count Vowel Substrings of a String(python)
- Analysis of Matplotlib module of Python visualization
- Django permission management
- Python integrated programming -- visual hot search list and new epidemic situation map
- [Python data collection] scripy realizes picture download
- Python interface automation test framework (basic part) -- loop statement of process control for & while
- Daily python, Chapter 9, while loop
- Van * Python | save the crawled data with docx and PDF
- Five life saving Python tips
- Django frequency control
- Python - convert Matplotlib image to numpy Array or PIL Image
- Python and Java crawl personal blog information and export it to excel
- Using class decorators in Python
- Untested Python code is not far from crashing
- Python efficient derivation (8)
- Python requests Library
- leetcode 2047. Number of Valid Words in a Sentence(python)
- leetcode 2027. Minimum Moves to Convert String(python)
- How IOS developers learn Python Programming 5 - data types 2
- leetcode 1971. Find if Path Exists in Graph(python)
- leetcode 1984. Minimum Difference Between Highest and Lowest of K Scores(python)
- Python interface automation test framework (basic) -- basic syntax
- Detailed explanation of Python derivation
- Python reptile lesson 2-9 Chinese monster database. It is found that there is a classification of color (he) desire (Xie) monsters during operation
- A brief note on the method of creating Python virtual environment in Intranet Environment
- [worth collecting] for Python beginners, sort out the common errors of beginners + Python Mini applet! (code attached)
- [Python souvenir book] two people in one room have three meals and four seasons: 'how many years is it only XX years away from a hundred years of good marriage' ~?? Just come in and have a look.
- The unknown side of Python functions
- Python based interface automation test project, complete actual project, with source code sharing
- A python artifact handles automatic chart color matching