Skip to main content

Pure Python, cross platform, single function module with no dependencies for playing sounds.

Project description

Pure Python, cross platform, single function module with no dependencies for playing sounds.

Installation

Install via pip:

$ pip install playsound

Done.

If you insist on the (slightly) harder way of installing, from source, you know how to do it already and don’t need my help.

The latest version of the source code can be found at: https://github.com/TaylorSMarks/playsound

Quick Start

Once you’ve installed, you can really quickly verified that it works with just this:

>>> from playsound import playsound
>>> playsound('/path/to/a/sound/file/you/want/to/play.mp3')

Documentation

The playsound module contains only one thing - the function (also named) playsound.

It requires one argument - the path to the file with the sound you’d like to play. This may be a local file, or a URL.

There’s an optional second argument, block, which is set to True by default. Setting it to False makes the function run asynchronously.

On Windows, uses windll.winmm. WAVE and MP3 have been tested and are known to work. Other file formats may work as well.

On OS X, uses AppKit.NSSound. WAVE and MP3 have been tested and are known to work. In general, anything QuickTime can play, playsound should be able to play, for OS X.

On Linux, uses ossaudiodev. I don’t have a machine with Linux, so this hasn’t been tested at all. Theoretically, it plays WAVE files. Any other file format working would surprise me. The block argument is not used on Linux - I do not know whether the function blocks on Linux or not.

Requirements

I’ve only tested playsound it with Python 2.7 on Windows 7 and OS X 10.11, but I expect that it should work on Windows XP thru 10 at least, OS X 10.5 and newer, all versions of Linux, and Python 2.3 and newer.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

playsound-1.2.0.tar.gz (4.8 kB view details)

Uploaded Source

File details

Details for the file playsound-1.2.0.tar.gz.

File metadata

  • Download URL: playsound-1.2.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for playsound-1.2.0.tar.gz
Algorithm Hash digest
SHA256 427cc2c56946af70e3bcf09b86f5ee76ecb62e770e63b9a1a040a0b1b8a62dc0
MD5 40c277fbc543fa2eeeddeb23aaeb55d7
BLAKE2b-256 c10dba4fd990ad1ef161f0592b85f157b940b8e246b68fcbcfd0a776b619971d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page