Skip to main content

An utility to render note block songs to a variety of audio formats

Project description

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')

Compatibility with audio formats depends on your FFmpeg configuration.

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()

renderer.mix_song()

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

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

nbswave-0.2.2.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

nbswave-0.2.2-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file nbswave-0.2.2.tar.gz.

File metadata

  • Download URL: nbswave-0.2.2.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.10 Windows/10

File hashes

Hashes for nbswave-0.2.2.tar.gz
Algorithm Hash digest
SHA256 10a9c28fb352ec81867f08a798ae9bff4a8986ad4772f0d71af972fe704b5f36
MD5 d98e5e7fdf5b526d317aabc563ff179b
BLAKE2b-256 d2bf20782d0f91fcdc9dc71865c0759d5d9baef974e8c3a4b767ea6d4aaaecc2

See more details on using hashes here.

File details

Details for the file nbswave-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: nbswave-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.10 Windows/10

File hashes

Hashes for nbswave-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5827fad6d52beb55ff42055e0a4352c43810c2041595965fb494312958f8e484
MD5 a8cd25c97ad433fde8ead5179b2e5fbd
BLAKE2b-256 3379b3c01ec237268ab8eb908a26ecd758032db36b6c1a1fd06b201aa965e747

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page