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 播放音效簡易版. 概述 - Kiwi lee
以下找了幾種方法,按照需求選擇,不一定我最後選擇的就是最好的。 playsound; pyAudio; pyGame; cvlc. 方法. playsound. 安裝方法: pip instal...
- 2Play sound in Python - GeeksforGeeks
Play sound in Python · The playsound module contains only a single function named playsound(). · ...
- 3playsound的简介、安装、使用方法之详细攻略 - CSDN博客
playsound的简介. 纯Python,跨平台,单功能模块,不依赖播放声音。 播放声音模块只包含一个东西——函数(也 ...
- 4Trying to play an MP3 through python with playsound. Not ...
#!/usr/bin/env python # import required module from playsound import playsound # for playing note...
- 5playsound - PyPI
Pure Python, cross platform, single function module with no dependencies for playing sounds.