Skip to content

Latest commit

 

History

History
140 lines (89 loc) · 5.89 KB

README.md

File metadata and controls

140 lines (89 loc) · 5.89 KB

Galaxy Jukebox

Schematic exporter for Minecraft Note Block Studio, making a galaxy-shaped redstone jukebox, that plays the song.

Works with old and new versions of the NBS format, and outputs Sponge schematic (WorldEdit can load it, for example).

There is a short and a long YouTube video showing it in action.

See Galaxy Jukebox GUI for the graphical interface.

The project is available on PyPI.

See the PyPI page for the screenshots!

screenshot from above

screenshot from the front

Comparison with the traditional walking design

Advantages of this design

  • you don't need to move
  • supports 20 tps, and every other tps (with the scaffolding thing)
  • you can actually see the noteblocks that play (and there are also optional redstone lamps)
  • looks like a colorful galaxy, pretty cool
  • sand doesn't fall (neither does concrete powder)

Drawbacks

  • pretty huge compared to the walking design
  • quite slow, sodium+lithium or a fast PC is strongly recommended for medium-to-large pieces
  • you need quite high render distances, so that all the redstone is loaded
  • most probably it doesn't work properly for pocket edition, though not tested

Installation

You can install the project via pip, if you have Python3 installed:

pip3 install galaxy-jukebox

Usage

From command line

You can convert a single file with:

python3 -m galaxy_jukebox input.nbs output.schem

or by using the dedicated command:

galaxy-jukebox input.nbs output.schem

The 2 conversion options (redstone lamp (bool), and side count / sides mode (-1, 1, 2 or 3)) described later, can also be used here:

galaxy-jukebox input.nbs output.schem False 2

From script

I'll show you how to use it with an example: this script batch converts all the nbs files from the current directory:

#!/usr/bin/env python3

from galaxy_jukebox import convert
from os import listdir

for filename in listdir():
    if filename[-4:] == ".nbs":
        convert(filename, filename[:-4] + ".schem")

This is the header for the convert function:

convert(song, out_path, use_redstone_lamp=True, sides_mode=-1)

Song is either pynbs.File, or a string (input path).

Output path is string.

Use redstone lamp: whether or not to place redstone lamp next to the note block (it looks cooler with lamp, but playback performance may be compromised).

Sides mode is how many sides the noteblocks should have (-1, or between 1 and 3):

  • -1 (automatic): using one of the following 3 based on noteblock count
  • 1: 2n wide, n high rectangle in front
  • 2: 2n×n rectangle to the right, and another in front
  • 3: 2n×n rectangles on all 3 sides

Feedback

Be sure to tell me if something ain't right, e.g. by opening an issue!

How it works

If you're interested in how it works, you can read the documentation locally (or on GitHub), where I try to describe the ideas behind the conversion.

Minecraft version

The program needs 1.14 for:

  • scaffolding (for the 1gt delay, there are other designs too, but this seems the best)
  • smooth granite/andesite slab (aesthetics)
  • birch sign (because we need 1.14, the sign has to have a woodtype)
  • all 16 noteblock sounds (there isn't any check present, whether they are available)
  • 1.13 is probably needed for the .schem support (and blockstates), when pasting the schematic
  • 1.13 for jungle wood (root)

Conversion performance

It is fine in my opinion, it takes 12 seconds to convert the 10 minute version of Genesis of the End on my machine (not a beast).

Improvements that could be made

We could use the volume and panning information, to place the note block at just the right position, so that the volume and panning sounds like it should. Then there would be holes in the wall of note blocks. The work required is first to split the lines/note blocks further (same pitch, different volume needs a different note block this way), and also store the additional information in the note lines. The hardest part would be the algorithm for calculating the best position, taking all the other note lines into account as well (so the note blocks are overall as close to their preferred position, as they can be).

Another idea would be to use command blocks with /playsound instead of note blocks where it makes sense: then we could support custom instruments, and pitch fine tuning (cents).

Huge thanks to these projects!

  • OpenNBS, the program for creating note block music
  • PyNBS, the library for interacting with NBS files
  • MCSchematic, for creating the output schematic file
  • Lithium, Sodium and Phosphor for optimizing the game enough for it to be able to play more complex pieces

Related links