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 hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page