Skip to main content

PyPi library which allows you to play wav files or numpy arrays

Project description

play-music is a PyPi library which allows you to play wav files or numpy arrays

Installation

Use the package manager pip to install play-music.

pip install play-music

Usage

play music from wavfile:

import play-music

if __name__ == "__main__":
    process = play-music.playMusic("alarm.wav", loop=False, threaded=False)

play music on loop:

import play-music

if __name__ == "__main__":
    process = play-music.playMusic("alarm.wav", loop=True, threaded=True)

play music asynchronous:

import play-music

if __name__ == "__main__":
    process = play-music.playMusic("alarm.wav", loop=False, threaded=True)

stop all sounds:

import play-music, time

if __name__ == "__main__":
    process = play-music.playMusic("alarm.wav", loop=True, threaded=True)
    time.sleep(1)
    play-music.stopAllSounds()

stop specific sound:

import play-music, time

if __name__ == "__main__":
    process = play-music.playMusic("alarm.wav", loop=True, threaded=True)
    process2 = play-music.playMusic("alarm2.wav", loop=True, threaded=True)
    time.sleep(1)
    play-music.stopSpecificSound(process)

stop specific sounds:

import play-music, time

if __name__ == "__main__":
    sounds_to_stop = []
    process = play-music.playMusic("alarm.wav", loop=True, threaded=True)
    sounds_to_stop.append(process)
    process2 = play-music.playMusic("alarm2.wav", loop=True, threaded=True)
    sounds_to_stop.append(process2)
    process3 = play-music.playMusic("alarm2.wav", loop=True, threaded=True)
    time.sleep(1)
    play-music.stopSpecificSounds(sounds_to_stop)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

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

Source Distribution

play-music-1.0.tar.gz (2.9 kB view details)

Uploaded Source

File details

Details for the file play-music-1.0.tar.gz.

File metadata

  • Download URL: play-music-1.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for play-music-1.0.tar.gz
Algorithm Hash digest
SHA256 9c001e887d4ccbf07ffe568577c666cf91ad74fab3e041aeac312ce6cb250a57
MD5 9c6f5b156b62cac6de71ba9bd55d51b1
BLAKE2b-256 5df912dcaed64bb92ee7904bc9fb640278d38fedf174df2c1959ceb4d4d227ed

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