Skip to main content

nbswave

A Python package to render note block songs to a variety of audio formats.

Overview

nbswave is a Python package aimed at rendering note block songs from Open Note Block Studio to audio tracks. Supports many common audio formats, both for loading custom sounds as well as exporting tracks.

Setup

The package can be installed with pip.

$ pip install nbswave

In order to use the package, FFmpeg must be available:

  1. Download precompiled binaries for ffmpeg and ffprobe here.
  2. Add the destination folder to your PATH, or, alternatively, place both executables in the root folder of the project.

Usage

from nbswave import *

render_audio("song.nbs", "output.mp3")

The output format will be detected automatically based on the file extension. You can still specify it explicitly if you'd like:

from nbswave import *

render_audio("song.nbs", "output", format='wav')

Custom instruments

In order to render songs with custom instruments, you have a few options:

  1. Copy the sounds manually to the sounds folder

  2. Pass the path to a folder (or ZIP file) containing custom sounds:

from pathlib import Path

nbs_sounds_folder = Path.home() / "Minecraft Note Block Studio" / "Data" / "Sounds"
render_audio("song.nbs", "output.mp3", custom_sound_path=nbs_sounds_folder)

If any sound file used in the song is not found in that location, a MissingInstrumentException will be raised. This behavior can be suppressed with the following argument:

render_audio("song.nbs", "output.mp3", ignore_missing_instruments=True)

Advanced usage

For more advanced use cases where you might need more control over the export process, it's possible to use the SongRenderer class. This will allow you to load custom instruments from multiple sources, as well as query which instruments are still missing:

from nbswave import *

renderer = SongRenderer("song.nbs")

renderer.load_instruments(nbs_sounds_folder)
renderer.load_instruments("some_more_instruments.zip")

renderer.missing_instruments()

track = renderer.mix_song()

track.save("song.mp3")

Contributing

Contributions are welcome! Make sure to open an issue discussing the problem or feature suggestion before creating a pull request.

This project uses poetry for managing dependencies. Make sure to install it, and run:

$ poetry install

This project follows the black code style. Import statements are sorted with isort.

$ poetry run isort nbswave
$ poetry run black nbswave
$ poetry run black --check nbswave

License - MIT

Metadata

Release files for nbswave 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nbswave 0.4.0
File Size Uploaded
nbswave-0.4.0.tar.gz 9.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nbswave 0.4.0
File Interpreter ABI Platform
nbswave-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.0 kB

Release files / nbswave-0.4.0.tar.gz

Download URL nbswave-0.4.0.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
dbac8353cfa8603356ad3ec41d2ba0247cb6530a36fd076d503c67bff9056fa5
BLAKE2b-256 checksum
How to use checksums
8cada5e4d0ba18f53b091118b36b90529d6cfc4aba8f1b55f6eba29c9779d6c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.10 Windows/10

Release files / nbswave-0.4.0-py3-none-any.whl

Download URL nbswave-0.4.0-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0a583cbb0c6406e62ca82a6caeb499731c6a59d2765a9bc803a82b3ec9334d0
BLAKE2b-256 checksum
How to use checksums
fe4b0ff33812780b29c56de1148c2ab2b0530676cf9ebe15eea35f5626b882c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.10 Windows/10

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page