https://github.com/openscilab/nava
🎵 Playing Sounds in Python
https://github.com/openscilab/nava
accessibility audio audio-player audio-player-lib audio-player-library music music-player player sound sound-player wave wave-player winsound
Last synced: about 1 year ago
JSON representation
🎵 Playing Sounds in Python
- Host: GitHub
- URL: https://github.com/openscilab/nava
- Owner: openscilab
- License: mit
- Created: 2023-05-29T07:07:04.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-15T06:00:09.000Z (about 1 year ago)
- Last Synced: 2025-05-13T23:14:58.435Z (about 1 year ago)
- Topics: accessibility, audio, audio-player, audio-player-lib, audio-player-library, music, music-player, player, sound, sound-player, wave, wave-player, winsound
- Language: Python
- Homepage:
- Size: 1.04 MB
- Stars: 140
- Watchers: 2
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: SECURITY.md
- Authors: AUTHORS.md
Awesome Lists containing this project
README
## Overview
Nava is a Python library that allows users to play sound in Python without any dependencies or platform restrictions. It is a cross-platform solution that runs on any operating system, including Windows, macOS, and Linux. Its lightweight and easy-to-use design makes Nava an ideal choice for developers looking to add sound functionality to their Python programs.
Branch
main
dev
Linux CI
Windows CI
macOS CI
## Installation
### PyPI
- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
- Run `pip install nava==0.7`
### Source code
- Download [Version 0.7](https://github.com/openscilab/nava/archive/v0.7.zip) or [Latest Source](https://github.com/openscilab/nava/archive/dev.zip)
- Run `pip install .`
### Conda
- Check [Conda Managing Package](https://conda.io/)
- Update Conda using `conda update conda`
- Run `conda install -c openscilab nava`
## Usage
### Basic
```python
from nava import play
play("alarm.wav")
```
### Async mode
⚠️ The `async_mode` parameter has a default value of `False`
```python
import time
from nava import play, stop
sound_id = play("alarm.wav", async_mode=True)
time.sleep(4)
stop(sound_id)
```
### Loop mode
⚠️ The `loop` parameter has a default value of `False`
⚠️ You should always set `async_mode` flag when you are using `loop`
```python
from nava import play, stop
sound_id = play("alarm.wav", async_mode=True, loop=True)
time.sleep(100)
stop(sound_id)
```
### Error
```python
from nava import play, NavaBaseError
try:
play("alarm.wav")
except NavaBaseError as e:
print(str(e))
```
### Engine
⚠️ The `engine` parameter has a default value of `AUTO`
```python
from nava import play, Engine
sound_id = play("alarm.wav", engine=Engine.AFPLAY)
```
### CLI
```bash
$ nava [--file FILE_PATH] [--loop] FILE_PATH
```
## Engines list
List of different platforms and the corresponding engines that are used for sound playing.
Engine
Platform
References
Supported Formats
ALSA
Linux
Advanced Linux Sound Architecture
.wav
WINSOUND
Windows
Winsound
.wav
AFPLAY
macOS
Audio File Play
.wav,.mp3
## Issues & bug reports
Just fill an issue and describe it. We'll check it ASAP! or send an email to [nava@openscilab.com](mailto:nava@openscilab.com "nava@openscilab.com").
- Please complete the issue template
You can also join our discord server
## Show your support
Star this repo
Give a ⭐️ if this project helped you!
Donate to our project
If you do like our project and we hope that you do, can you please support us? Our project is not and is never going to be working for profit. We need the money just so we can continue doing what we do ;-) .
