Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hay/bbgen
A Python library for generative music
https://github.com/hay/bbgen
Last synced: 28 days ago
JSON representation
A Python library for generative music
- Host: GitHub
- URL: https://github.com/hay/bbgen
- Owner: hay
- License: mit
- Created: 2023-11-29T15:22:14.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-04T11:38:07.000Z (about 2 months ago)
- Last Synced: 2024-11-04T12:40:39.302Z (about 2 months ago)
- Language: Python
- Homepage:
- Size: 27.3 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bbgen
> A Python library for generative musicBy [Hay Kranen](http://www.haykranen.nl)
## Introduction
bbgen is a Python library that allows you to make generative music. It is designed for non-realtime use: you shouldn't be using this library for a performance.bbgen is a wrapper around a couple of other libraries that perform most of the heavy lifting, this includes [pydub](https://pydub.com/) for composing / editing audio files, [pedalboard](https://spotify.github.io/pedalboard/index.html) for effects, [dawdreamer](https://github.com/DBraun/DawDreamer) for rendering midi and [isobar](https://ideoforms.github.io/isobar/) for generating the music.
bbgen is most definitely a work in progress, and it desperately needs documentation which i haven't written yet. But you can look in the `test` folder for a couple of examples.
I have ran bbgen on macOS 14.6.1 on an Apple M1 processor, and it also works on Linux (Ubuntu 22.04 LTS). I haven't tested on Windows yet.
Render a MIDI file using a sampler like this:
```python
from bbgen.dreampler import Dreampler
from mido import MidiFile, Message
from pydub import AudioSegmentmidi = MidiFile("satie.mid")
clarinet = AudioSegment.from_wav("clarinet.wav")Dreampler(clarinet).render_midi(midi).export("satie-dreampler.mp3")
```## Install
You probably need to install [Fluidsynth](https://www.fluidsynth.org/) and i guess ffmpeg as well.I've tested bbgen on Python 3.10. It might run on newer versions as well but i haven't tested that yet.
This is should work:
1. Clone this repo
```bash
git clone https://github.com/hay/bbgen.git
```2. Make a virtual environment and install the `requirements.txt`
```bash
python -m venv env
source env/bin/activate
pip install -r requirements.txt
```3. Try running the `samplers.py` example in `test` to showcase the three different samples available in bbgen:
```bash
cd test
python samplers.py
```## Things to do:
* Documentation
* Speed up the samplers (esp. `Dreampler` and `Dreamstrument` are very slow)## License
MIT © [Hay Kranen](http://www.haykranen.nl)