playsound - PyPI
文章推薦指數: 80 %
Pure Python, cross platform, single function module with no dependencies for playing sounds.
Skiptomaincontent
Switchtomobileversion
SearchPyPI
Search
playsound1.3.0
pipinstallplaysound
CopyPIPinstructions
Latestversion
Released:
Jul24,2021
PurePython,crossplatform,singlefunctionmodulewithnodependenciesforplayingsounds.
Navigation
Projectdescription
Releasehistory
Downloadfiles
Projectlinks
Homepage
Statistics
GitHubstatistics:
Stars:
Forks:
Openissues/PRs:
ViewstatisticsforthisprojectviaLibraries.io,orbyusingourpublicdatasetonGoogleBigQuery
Meta
License:MITLicense(MIT)
Author:TaylorMarks
Tags
sound,
playsound,
music,
wave,
wav,
mp3,
media,
song,
play,
audio
Maintainers
TaylorSMarks
Classifiers
DevelopmentStatus
5-Production/Stable
IntendedAudience
Developers
License
OSIApproved::MITLicense
OperatingSystem
OSIndependent
ProgrammingLanguage
Python::2
Python::2.3
Python::2.4
Python::2.5
Python::2.6
Python::2.7
Python::3
Python::3.1
Python::3.2
Python::3.3
Python::3.4
Python::3.5
Python::3.6
Python::3.7
Python::3.8
Python::3.9
Topic
Multimedia::Sound/Audio::MIDI
Multimedia::Sound/Audio::Players
Multimedia::Sound/Audio::Players::MP3
Projectdescription
Projectdetails
Releasehistory
Downloadfiles
Projectdescription
PurePython,crossplatform,singlefunctionmodulewithnodependenciesforplayingsounds.
Installation
Installviapip:
$pipinstallplaysound
Done.
Ifyouinsistonthe(slightly)harderwayofinstalling,fromsource,
youknowhowtodoitalreadyanddon’tneedmyhelp.
Thelatestversionofthesourcecodecanbefoundat:
https://github.com/TaylorSMarks/playsound
QuickStart
Onceyou’veinstalled,youcanreallyquicklyverifiedthatitworkswithjustthis:
>>>fromplaysoundimportplaysound
>>>playsound('/path/to/a/sound/file/you/want/to/play.mp3')
Documentation
Theplaysoundmodulecontainsonlyonething-thefunction(alsonamed)playsound.
Itrequiresoneargument-thepathtothefilewiththesoundyou’dliketoplay.Thismaybealocalfile,oraURL.
There’sanoptionalsecondargument,block,whichissettoTruebydefault.SettingittoFalsemakesthefunctionrunasynchronously.
OnWindows,useswindll.winmm.WAVEandMP3havebeentestedandareknowntowork.Otherfileformatsmayworkaswell.
OnOSX,usesAppKit.NSSound.WAVEandMP3havebeentestedandareknowntowork.Ingeneral,anythingQuickTimecanplay,playsoundshouldbeabletoplay,forOSX.
OnLinux,usesGStreamer.KnowntoworkonUbuntu14.04andElementaryOSLoki.IexpectanyLinuxdistrowithastandardgnomedesktopexperienceshouldwork.
Ifyou’dlikeotherLinuxdistros(oranyotherOS)towork,submitaPRaddinginsupportforit,butpleasemakesureitpassesthetests(seebelow).
Testing
Playsoundincludesasmallsetoftests-ifyou’remakingaPR,pleaseensurethatyouhavenoregressionsandallthetestspassonyourlocalsystem.
AlsomakesurethatTravis-CI,whichrunsthesetestsagainstWindowsServer2016,macOS10.11(ElCapitan,2015)and11.3(BigSur,2020),Ubuntu14(Trusty),andUbuntu18(Bionic),forbothPython2.7and3.9,fullypasses.
YoucanchecktheTravis-CIstatusforPlaysoundhere:https://travis-ci.com/github/TaylorSMarks/playsound/builds
Copyright
ThissoftwareisCopyright(c)2021TaylorMarks
延伸文章資訊
- 1Python playsound - play mp3 sound files - CodersLegacy
The Python playsound library offers an easy and simple way to play sound files in Python. From al...
- 2Python 播放音效簡易版. 概述 - Kiwi lee
以下找了幾種方法,按照需求選擇,不一定我最後選擇的就是最好的。 playsound; pyAudio; pyGame; cvlc. 方法. playsound. 安裝方法: pip instal...
- 3python-playsound-git - AUR (en) - Arch Linux
Package Details: python-playsound-git 1.3.0-5 ... Description: Pure Python, cross platform, singl...
- 4Play sound in Python - GeeksforGeeks
Play sound in Python · The playsound module contains only a single function named playsound(). · ...
- 5Python实用模块(二十九)playsound - 迷途小书童的Note - 编程
playsound 支持多平台,仅仅依赖于 python 。 安装. 官方给出的安装方法是 pip install playsound. 但是我在执行的时候, ...