Git Product home page Git Product logo

nbs-converter's Introduction

🎶 NBS Converter for Music Machine 🎶

This repo contains some Python scripts to convert .nbs files into a schematic that can be pasted into your Minecraft world. This is specifically designed to work with jazziiRed and Mooncatcher's Music Machine, featured in this YouTube video and downloadable here. Basically, it can take any .nbs song and translate it into several sequences of music discs stored inside chests, so you an enjoy any song you want in our machine!

An .nbs song is a note block song file that is generated by Open Note Block Studio, a program commonly used by Minecraft musicians to compose note block songs.

Disclaimer: This is not the most professional code in the world, as most of it was written by me on a plane. You will need a basic understanding of how to run Python scripts using the command line, but don't worry, I will provide you with resources in the below sections.

Note: I will not be proactively updating this code unless I feel the need to. I will also not provide any tech support to those of you who are having technical troubles with Python. This is nothing against you, I just don't have the bandwidth. Hopefully the resources I provide will be enough to guide you through any technical issues you have.

Getting Started

Installing Open Note Block Studio

Let's start off with installing Open Note Block Studio, the program used to create, edit, and listen to .nbs songs. This is optional, but it'll help a lot when it comes to previewing your songs before and after formatting to make sure that they'll sound good in the machine.

Note: This program does not currently work with MacOS. Sorry Mac users... The good news is that the scripts will still work on your Mac - you just won't be able to preview your songs before importing them into the game.

Installing Python

Now for the technical stuff. First off, you need to have Python installed on your computer in order to run these scripts. If you've never done this, simply go to the Python download page and install the latest version of Python for your operating system. If you are on macOS, you may also use Homebrew.

When installing Python, make sure to check the box that says "Add Python to PATH" (or something similar). This will allow you to run Python scripts from the command line.

Whatever operating system you have and whatever method you choose, just make sure that Python installed properly by running one of the following in your Command Prompt (Windows) or Terminal (MacOS or Linux):

py --version
python --version
python3 --version

This should spit out the version of Python that was installed on your system.

Note: python3 can be replaced with whatever major version of Python you just installed, i.e. python2 or python4, if you're from the future.

If none of these commands work, Google your error message. There are plenty of online forums such as stackoverflow that may contain the answer to your issues. Failing everything, simply uninstall and reinstall Python. Sometimes that works.

Once one of these commands work, take note of which one (py, python, or python3) worked on your system. This will be the command used to run Python scripts moving forward.

Installing Packages

The two Python scripts in this repo make use of two existing Python libraries: pynbs and mcschematic. The first is used to parse, edit, and create .nbs files, and the second is used to create and edit Minecraft schematics. Run the following two commands to install them. You can also go to their respective repos for more details.

pip install pynbs
pip install mcschematic

Both of these libraries can be installed using pip, which should be automatically installed for you alongside Python. If you are on Windows, this should have been a checkbox during installation.

pip is a package manager used to install Python libraries that other people have written. These libraries contain code that you can use to easily do things that might take a long time to do from scratch, like parsing an .nbs file.

If you have issues with pip, please look up your error message on Google. You might need to use pip3 (or whatever version). Just like with Python, you can check your version of pip using either of the following commands:

pip --version
pip3 --version

If pip doesn't work, you can also try the following (make sure to replace python with whatever command worked for you in Installing Python):

python -m pip install pynbs
python -m pip install mcschematic

Once you have these installed, the hard part is over! 🎉

Now for the fun part...

Running the Scripts

So in order to run the scripts, you need to have them on your computer. You can either clone this repository using git, or you can simply download the following three files and put them all in the same folder.

  • constants.py
  • nbs_format_song.py
  • nbs_generate_schematic.py

Once you've done this, you're ready to convert any .nbs song you wish! Download or compose any song you like (I have some good ones in the example_songs folder.), and drop them into the same folder as the three .py files.

Formatting the Song

The first thing that you will want to do is format your song. However you decide to build the final configuration of the music machine, it will not be able to play every .nbs song as is, due to chord size limitations, length, illegal notes, etc. So this first script is designed to format the .nbs song so that our machine can actually play it.

But before you run the script, you might want to tweak some settings. To do so, open constants.py in a text editor of your choice (even notepad is fine) and take a look at any of the variables marked with EDITABLE SETTING. DO NOT edit any of the variables marked with DO NOT EDIT (unless you want to, I'm not your mom).

FYI - If you're just using this script for the machine in the world download, all the default settings will work fine. In fact, I would advise against editing this file if this is the case.

Once you've made the edits that you want, make sure to save the file. Now it's time to actually run the script!

Running the Formatting Script

First, navigate to the folder that your scripts are stored in using either Command Prompt (Windows) or Terminal (macOS or Linux). To do so, use the cd command (This works in Windows, MacOS, and Linux.). So if, for example, the path to your folder is C:\Users\username\Documents\nbs-converter, you would need to type

cd C:\Users\username\Documents\nbs-converter

Once there, run the following command:

py nbs_format_song.py

or whatever Python command worked for you in Installing Python.

Follow the instructions that the script gives you, and at the end it should spit out a brand new .nbs file that's correctly formatted! Take a listen to this to see if it still sounds good, and once you're satisfied, it's time to move on to the next step!

Generating the Schematic

Now that you have a formatted .nbs song that sounds great, it's time to transform it into a form that can be pasted into Minecraft!

This part's really easy. Again using either Command Prompt or Terminal, run the following:

py nbs_generate_schematic.py

or whatever Python command worked for you in Installing Python.

Follow the instructions that the script gives you, and at the end it should spit out a brand new .schem file that you can paste into your world!

Pasting the Song into Minecraft

Ok, full transparency - this part requires you to have worldedit or some other mod that can handle .schem files in Minecraft. I'm not going to get into how to install this, as there are several great tutorials out there for installing and using worldedit. I'll link a couple here, but feel free to look around to find one that makes sense to you.

Once you're ready, simply load up the world. If you're using the world download, follow the instructions on the signs for exactly where to paste the song. The song will paste into your world as a straight row of chests labelled with signs.

Note: You will probably also want to download and use the Silent_Discs resource pack in this repo. This replaces all the music disc songs with silence, so you can only hear the note blocks while the machine is running. It's pretty obnoxious without it.

Then, all you have to do is start it up and enjoy the music! 🎧🎶

nbs-converter's People

Contributors

jazziired avatar miclol avatar ihasbone avatar qexat avatar

Stargazers

Lyric's avatar  avatar  avatar  avatar zinx avatar Laura Kirsch avatar Luiz Guilherme S. Munhoz ✨ avatar Rory Hayes avatar Rhonda D'Vine avatar Stellarus avatar Luis Jiménez avatar João Pedro Bittencourt da Cruz Silva avatar NCraftIngEnetTM avatar gladly-hyphenated-21 avatar Radbardur avatar Pau avatar Yoojun Zhou avatar Ahmed Asi avatar HugoGhesquiere avatar Jose Manuel Tarula Gomez avatar Kiril Zadgorski avatar Jonas avatar dhaviaron avatar  avatar Aaron Woodhouse avatar  avatar Whisper avatar Ethan Mahlke avatar Lucas Bubner avatar  avatar  avatar SlimyRedstone avatar Lakz avatar Appuchia avatar  avatar  avatar Thomas Liebig avatar  avatar Bernardo Costa avatar rikorick avatar Hidey Boi avatar Mitchell Stankovski avatar HearingSubset19 avatar Enno Schnackenberg avatar KylerianHD avatar Poundcake avatar Starshine avatar Yakedo avatar MRGalaxy avatar Joel Robert Justiawan avatar velo avatar Svene avatar Tobias Franz avatar sponglebong avatar Milo avatar TOwInOK#nqcq avatar Jonathan avatar Shaun Chong avatar Rubens Mariuzzo avatar Wayne Norman avatar  avatar  avatar Nuclear Pasta avatar Filip Chovanec avatar  avatar  avatar  avatar  avatar Noah Pilarski avatar dubs avatar koutsie avatar Cado avatar  avatar WhiteTapeti avatar Isaac Zhang avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar Krafting avatar  avatar Nino K avatar Sven Fehler avatar

Watchers

Wayne Norman avatar dhaviaron avatar Mitchell Stankovski avatar  avatar

nbs-converter's Issues

Sneaky trailing comma

Hello! I've watched your video, and the project is awesome!

I am currently attempting to add type hints and related stuff, and while I was doing so, I noticed a sneaky trailing comma in this file.

NAME_DISCS = 0,

This makes NAME_DISCS a tuple[int] instead of an int (although I think it probably should be a bool), which can lead to unintended behavior/bugs...

Here's what you probably wanted:

NAME_DISCS = 0

I made a PR (#3) to fix that.

Have a good day!

FileNotFoundError

So I was following the instructions on how to convert the nbs file into the .schem file. everything was going smoothly until when doing the .schem process i got an error messege. "FileNotFoundError: [Errno 2] No such file or directory: 'c:\users\****\minecraft_note_block_studio\songs\nyan_cat_formatted.schem'

Python virtual env

Create a script that will run a program from a virtual environment (venv) and install the necessary libraries.

Upload it to Google Colab or things similar

Google Colab is a service based on Jupyter Notebook, and it can automatically setup the environment, making it easier to use without downloading Python etc.
Maybe I'll make a PR one day.

Survival Mode

I know this probably isn't the place for this but Youtube comments are even worse and Jazzi doesn't have a Discord so I'm putting this here.

Is it possible to build the machine featured in the video and use it in survival? The main challenges I see with this are:

  1. Obtaining the music discs and unstackables
  2. Placing and ordering the items into the shulker boxes
  3. Loading the shulkers into the machine

#1 isn't that bad, it just requires building a huge music disc farm and a wood farm (if you use wooden shovels like in the video).
#2 is probably the hardest part, though there's probably a way to do this with schematics (I don't use them that much so I don't know if it's possible).
#3 involves figuring out where each group of shulkers is supposed to go. Poking around the world download a little, the place the command blocks clone the schematic-generated chests seems to correspond with the instruments assigned to each one, and since the schematic places a sign with the instrument on each chest, I don't think this would be too difficult, just tedious.

Let me know what you guys think, and do note that I don't have much experience in redstone or schematics, so some of my assumptions might be wrong.

Skipping notes

I have everything set up and got the data pack but when I play songs it shows a disk inserted but sometimes doesn't play the note if anyone could help it would be appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.