A simple 8bit-style music library
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
8bit-music-lib (English)
This is a Python library for playing 8-bit style chiptune music.
- Compatible with Jupyter Notebook, so it can also run on Google Colaboratory.
- Recommended for those who want to quickly try playing 8-bit music.
- In the future, support for importing and exporting MML and MIDI files is planned.
Note
Waveforms are quantized to 8-bit resolution, but for compatibility with playback libraries,
the output format is 16-bit PCM array.
File Structure
8bit-music-lib
├── music8bit
│ ├── __init__.py
│ ├── mixer.py
│ ├── notes.py
│ ├── part.py
│ ├── utils.py
│ └── wave.py
├── .gitignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── README_ja.md
└── setup.py
Installation
It is recommended to install with a playback library.
Recommended: via sounddevice (Windows/macOS/Linux)
pip install 8bit-music-lib[sounddevice]
Alternative: via simpleaudio (requires C++ build tools on Windows)
pip install 8bit-music-lib[simpleaudio]
Jupyter Notebook / Google Colaboratory
Useful for playing audio and displaying waveforms directly in the notebook.
On Colab, add ! at the beginning of the command:
pip install 8bit-music-lib[jupyter]
Minimal installation
pip install 8bit-music-lib
Only waveform generation is available; audio playback is not supported.
Importing
Simple import:
from music8bit import *
To avoid conflicts with other modules:
import music8bit as m8
Example (Simple Demo: Twinkle Twinkle Little Star)
import music8bit as m8
# Define notes
notes = [
(['C5'],1), (['C5'],1), (['G5'],1), (['G5'],1),
(['A5'],1), (['A5'],1), (['G5'],2),
(['F5'],1), (['F5'],1), (['E5'],1), (['E5'],1),
(['D5'],1), (['D5'],1), (['C5'],2)
]
# Define a part
part1 = m8.Part(
melody=notes,
volume=0.5,
generator=m8.SquareWave(),
first_bpm=120
)
# Create a song
song = m8.SongMixer([part1])
# Play
song.play()
Detailed usage, complex examples, and explanations of each class are summarized in the Wiki.
Afterword
This library was created out of the developer's personal desire to play music on Google Colab,
and turned into a library that anyone can use.
Honestly, the usability and completeness are limited.
For creating proper music, using MML or a DAW is much easier.
If you can run Pygame, convenient external libraries like Musicpy are also available in Python.
To those who still enjoy using this library, I hope you have a good 8-bit life.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file 8bit_music_lib-0.2.2.tar.gz.
File metadata
- Download URL: 8bit_music_lib-0.2.2.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69e5d2a0afb43527deab539a61e55a286e162f75023ccf6eb1e097238de8d93b
|
|
| MD5 |
fad09e229121a6dc59dcfe313e5689cf
|
|
| BLAKE2b-256 |
b45e156407a6c6b1a01a577c8dc7d7abaee00efca59fddf7ad1b2df59d651529
|
File details
Details for the file 8bit_music_lib-0.2.2-py3-none-any.whl.
File metadata
- Download URL: 8bit_music_lib-0.2.2-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a08683004c9e2678dcc2014da09a45dddffbc50de4432a01a7e1228743420e64
|
|
| MD5 |
e448f517ff24666797e70a4bcd34b0ad
|
|
| BLAKE2b-256 |
0b82fd6a59cc23a2241ca0f6297635ddf619b40139574efdd40d457cb0b2ef50
|