This is a project to allow the creation of custom songs that can then be sent to remote client speakers using the Computercraft: Tweaked Minecraft mod.
We are not sponsored by, or affiliated with Mojang, Computercraft: Tweaked, or any other mentioned projects or resources.
All songs are stored on a main Computercraft computer that acts as a server. This server then sends the song files to linked client computers that play the song's notes through their attached speakers.
If the song being played has only one note being played at a time (aka a monophonic song,) then the default client scripts will play every note and you will only need one speaker. However, if the song has more than one note being played at a time in chords, harmonies, etc. (aka a polyphonic song,) then you will need to examine the song file and find the largest speaker number listed. That will tell you the minimum number of speakers you need, and you will need to set at least one speaker to each speaker number in its client file in order to fully play a song.
Each song file is made of several parts.
track
array is initiallized with track = {}
track
array at index i
using the following format:
3
is default. See ComputerCraft: Tweaked for more info.)1
is default)
track[ i ] = {instrument, volume, note, duration, speaker}
track
is default)1
is default)true
if the song file uses music notation like "F#1" or false
if the Minecraft note block numbers 0-24 are used.message = {songName, track, tempoMultiplier, notationBoolean}
The server.lua script allows you to send a song to multiple client computers once a redstone signal is recieved. You can configure which songfile and client group are used when the script is run. group
is the default group name.
shell.run("server.lua", "path/to/songfile.lua", "groupName").
The server_pocket.lua script can be used if you wish to have the server automatically transmit the song on startup.
The client.lua script allows a client computer to recieve the streamed message from the server, apply the decoder script to it if the song uses note notation instead of Minecraft note block numbers, and then play the song to a connected speaker.
This script also allows you to recieve and run code sent to the client from the server for updates etc.
The server is the computer that will send information to other client computers. To do this, you will need to attach a modem to the computer.
The server.lua script also needs an external redstone signal to trigger the process of sending data to the client. This can come from a basic button, lever, or any other redstone signal that can turn on and off. You can find more advanced redstone circuit information on the Minecraft Wiki for specialized configurations.
Each client will need to be a seperate computer and have a modem to recive information from the server.
Clients will also need to be connected to speakers in order to play music.
This GitHub also contains a midi converter written in python that can automatically format MIDI files to make them playable using these scripts.
Currently the script is offered with a command line interface only, however we plan to create a graphical version. This script will automatically check if the song meets the note range requirements.