Skip to main content

A small package for playing audio in python with file format independent methods for playback control

Project description

just_playback

A small library for playing audio files in python. Provides file format independent methods for loading audio files, playing, pausing, resuming, stopping, seeking, getting the current playback position, and changing the volume.

The package uses miniaudio for awesome cross-platform, dependency-free asynchronous audio playback that stays away from your main thread.

Installation

pip install just_playback

Usage

from just_playback import Playback
playback = Playback() # creates an object for managing playback of a single audio file
playback.load_file('music-files/sample.mp3')
# or just pass the filename directly to the constructor

playback.play() # plays loaded file from the beginning
playback.pause() # pauses playback. Has no effect if playback is already paused
playback.resume() # resumes playback. Has no effect if playback is playing
playback.stop() # stops playback. Has no effect if playback is not active

playback.seek(60) # positions playback at 1 minute from the start of the audio file
playback.set_volume(0.5) # sets the playback volume to 50% of the audio file's original value

playback.active # checks if playback is active i.e playing or paused
playback.curr_pos # returns the current absolute playback position in seconds from 
				  #	the start of the audio file (unlike pygame.mixer.get_pos). 
playback.paused # checks if playback is paused.
playback.duration # returns the length of the audio file in seconds. 
playback.volume # returns current playback volume

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

just_playback-0.1.3.tar.gz (498.4 kB view details)

Uploaded Source

File details

Details for the file just_playback-0.1.3.tar.gz.

File metadata

  • Download URL: just_playback-0.1.3.tar.gz
  • Upload date:
  • Size: 498.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/56.1.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.7.9

File hashes

Hashes for just_playback-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d8ec6e49012e8c68b6285305b75eff243e6f0ed90e49a2e21c6adeb9e9e39a51
MD5 41688351eeea8eaece0540f806fb8358
BLAKE2b-256 7c11dfc95152a17dad97c3107646f22e5f4d1f6e5e4dde83d7f049db5e964857

See more details on using hashes here.

Supported by

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