PyBASS wrapper
LICENSING
The PyBass PYTHON wrapper is licensed under the MIT license. Meanwhile the BASS C Library is dual licensed as free to use for non-commercial development but requires a license for paid/commercial work. Please see http://un4seen.com
BASS library documentation
Purpose and notes
A simple wrapper around un4seen.com's BASS audio library to enable playing various format media files from python.
Stock python usage
from argparse import ArgumentParser
from pybass3 import Song
import time
def main(song_file):
song = Song(song_file)
song.play()
len_bytes = song.duration_bytes
position_bytes = song.position_bytes
print("Playing: ", song_file)
print(f"Bytes: {len_bytes=}")
while position_bytes < len_bytes:
print(song.position, song.duration)
time.sleep(1)
if __name__ == "__main__":
parser = ArgumentParser()
parser.add_argument("song_file")
args = parser.parse_args()
main(args.song_file)
Windows playlist example
import pathlib
import time
import argparse
import msvcrt
from pybass3 import Song
from pybass3.playlist import Playlist
def kbfunc():
x = msvcrt.kbhit()
if x:
ret = ord(msvcrt.getch())
else:
ret = 0
return ret
def main(dir_path):
dir_path = pathlib.Path(dir_path)
playlist = Playlist()
playlist.add_directory(dir_path, recurse=True)
playlist.play()
play_indefinitely = True
while play_indefinitely:
try:
print(playlist.current.file_path.name, playlist.current.position, playlist.current.duration)
playlist.tick()
key = kbfunc()
if key:
if key == 122: # Z
print("Previous")
playlist.previous()
elif key == 98: # B
print("Next")
playlist.next()
elif key == 120: # X
print("Play")
playlist.play()
elif key == 99: # c
print("Pause")
playlist.pause()
elif key == 118: # v
print("Stop")
playlist.stop()
else:
time.sleep(1)
except KeyboardInterrupt:
playlist.free()
play_indefinitely = False
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("song_dir")
args = parser.parse_args()
main(args.song_dir)
Metadata
Release files for PyBASS3 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| PyBASS3-0.2.0.tar.gz | 213.5 kB | Without provenance | Details for PyBASS3-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| PyBASS3-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for PyBASS3-0.2.0-py3-none-any.whl |
Total release size: 432.3 kB
Release files / PyBASS3-0.2.0.tar.gz
| Download URL | PyBASS3-0.2.0.tar.gz |
|---|---|
| Size | 213.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee2438480f1413cd04df10f083cae7260cb5e5ac0aa5a6b24ebdc99dafe1e894
|
|
BLAKE2b-256 checksum How to use checksums |
f064846abd06e17ba90929db62143139ed9e904393b73a83619687fcb4bd23f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2
|
Release files / PyBASS3-0.2.0-py3-none-any.whl
| Download URL | PyBASS3-0.2.0-py3-none-any.whl |
|---|---|
| Size | 218.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2515f5390dc38591361448d730455d9906b4c89c912f214077ff57d4c1e75948
|
|
BLAKE2b-256 checksum How to use checksums |
68683e454bec43a57d9f589456ca28c89c6be133f09281010090b3d36c310c74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2
|
Security for PyBASS3 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.