https://github.com/lordmauve/pyfxr
Sound effects generation for Python, in fast Cython code, compatible with Pygame and Pyglet.
https://github.com/lordmauve/pyfxr
gamedev python python-game-development synthesizer
Last synced: 2 months ago
JSON representation
Sound effects generation for Python, in fast Cython code, compatible with Pygame and Pyglet.
- Host: GitHub
- URL: https://github.com/lordmauve/pyfxr
- Owner: lordmauve
- License: bsd-3-clause
- Created: 2021-04-10T10:53:38.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-03-18T07:08:36.000Z (over 1 year ago)
- Last Synced: 2025-03-25T07:12:30.145Z (3 months ago)
- Topics: gamedev, python, python-game-development, synthesizer
- Language: Python
- Homepage: https://pyfxr.readthedocs.io/
- Size: 138 KB
- Stars: 19
- Watchers: 3
- Forks: 3
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pyfxr
Sound effects generation for Python, compatible with Pygame and Pyglet.
## Installation
`pyfxr` is on PyPI and pre-compiled for Mac, Windows and Linux. You can install
the library with```
pip install pyfxr
```## Documentation
[Full API documentation](https://pyfxr.readthedocs.io/)
## Pygame Usage
```
# Set mixer to 44kHz mono
pygame.mixer.pre_init(44100, channels=1)# Generate a sound
tone = pygame.mixer.Sound(
buffer=pyfxr.pluck(duration=1.0, pitch='A4')
)# Play it
tone.play()
```## Usage with Pyglet
```
# Generate a random explosion sound
explosion = pyglet.media.StaticSource(pyfxr.explosion())# Play it
explosion.play()
```## Usage with sounddevice
```
import sounddevice
import pyfxrsounddevice.play(pyfxr.jump(), pyfxr.SAMPLE_RATE)
```## GUI
A Pygame GUI is in development, to explore the feature set and create music!
To install the Pygame-based GUI along with the library, use:
```
pip install pyfxr[gui]
```Then you can run the GUI by running `pyfxr`.

