Jump to content




Command Block Music Composition


15 replies to this topic

#1 reububble

  • Members
  • 72 posts
  • LocationBehind you

Posted 17 August 2013 - 11:21 AM

Composition Software for ComputerCraft

Command Block Computers, the new thing.


I don't have a new video of the current version of this software, but there are some older versions on youtube at my channel

With this program you can:
  • Create
  • Edit
  • Store
  • Play
  • Convert
Your music!

Version 9 June 2016 features:
  • CommandComputer support

    Previous methods of music playing are still supported, but my testing indicates that the commandBlock peripheral method is much slower, and isn't able to play as many notes per tick as the commandComputer. Iron note block has not been tested ( I don't have the mod anymore now that I don't need it ) but it should still work exactly as it did.
  • MusicBox

    This program was added to separate the peripheral sound playing methods from the composition software. This one program stores all the available methods for playing music, and selects the right one for you. It is designed to run as an API, in parallel to any other threads controlling the music, such as compose. You can use the MusicBox.load method to load a converted or created song, which can then be played with the MusicBox. This means you don't need the compose software to play songs, and you can create your own programs which use the MusicBox, after it has been setUp().

  • Parallel

    With the addition of MusicBox, the composition software is now able to operate parallel to the sounds being played, which means you can edit your files, while listening to music. To add control the play button on the main menu changes to a stop button if the selected song is being played
  • Speed control

    The nature of the MusicBox running parallel to the composition software has allowed for speed control, mid song. By scrolling you control the speed of the song. Scroll up to slow down the song, scroll down to speed it up (limits apply either way)
  • conV

    This program converts files ending in the ".mid" or ".nbs" format. You can select the file, or a folder in which every file (of a convertable type) underneath that folder will be converted. Runs very fast and produces smaller music files which the composition software and MusicBox understand.

  • installer

    A simple installer was added to ensure that people are receiving the correct files from pastebin, especially if any new files become important to the program. The installer allows you to select optional features such as the conversion software and the progression API

  • Progression API

    The progress API is a simple tool which runs parallel to a main program, which produces a progress bar or progress count on screen. It is used in compose when saving files, and in conV. For nbs files a progress bar is used, but for mid files, a progress count is used. The count displays which track of the mid file is currently being parsed. Some tracks are often larger than others.

  • Compose

    Compose is the main piece of software. In compose you are now able to view folders inside the songs directory, and files and folders in those folders, and so on. You are also now able to stop your playing songs from the main menu, and you can also "goto" any song by name or number. Editing the music, you are presented with a musical keyboard to click on to add notes to the song. You can press the 'c' key to toggle continuous mode, in which, each new note moves the time selector along. You can use the arrow keys to move the time selector, or to transpose the song up/down. Notes wrap around the top and bottom. There is a selection of the five instruments at the side, which you can use to change which instrument your notes will be added as. You can also type using the keyboard to add notes (try asdfghjk and more). Clicking on the song display moves the time selector to that position. You can also move the time selection by clicking in the top right hand and typing the time you wish to navigate to.

  • BUGS

    There are probably even more bugs that I haven't squished, but there have been so many that I've found and eliminated recently. If you find any, you are probably better able to contact me via youtube than these forums. I'm always happy to help. Here are some common "bugs" that aren't really bugs.

    1, http. You need to have the http allowed in your config file if you are downloading the software from pastebin using computercraft
    2, command block peripheral. If you are using the command block as a peripheral to play your songs (which is not suggested anymore, try the command computer) you need to have the command block peripheral allowed in your config file.
    3, conversion issues. If you have problems converting your mid files or nbs files, make sure they have the ".mid" or ".nbs" suffix relevant to them. Make sure you are using quotation marks if it has any spaces eg. conV "Fur Elise.nbs". Also make sure that they are proper and complete files, you could check with your own computer's music playing software. If all these do not work, then maybe there is a bug.
    4, speed jumpy. If the speed of the song is jumpy, it could be because your computer is overloaded with tasks, or because your connection to the server is laggy. Try playing single player, and with a minimum number of other applications open, to see if it is really a bug.
    5, speed too fast. In order for the timing to work correctly, day light cycle must be normal.

    If your issue wasn't listed here, there's a good chance it's a bug. Remember to let me know exactly what the issue is, any error code that might come with the issue, and what you were trying to do when the issue arose, if you want to seek my assistance.
pastebin get
  • installer - Mh521Gt8

Edited by reububble, 10 June 2016 - 08:16 AM.


#2 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 18 August 2013 - 02:33 PM

ooh this is cool
/me gets a bunch of cave story midis to convert

some things you should be aware of:

localization -- you wont think it makes your program faster, but it does
string.format("%X",number) -- number to hex
paintutils -- built in library, makes drawing things way easier
notepad++ -- the tabbing

#3 reububble

  • Members
  • 72 posts
  • LocationBehind you

Posted 19 August 2013 - 02:30 AM

View PostPixelToast, on 18 August 2013 - 02:33 PM, said:

ooh this is cool
/me gets a bunch of cave story midis to convert

some things you should be aware of:

localization -- you wont think it makes your program faster, but it does
string.format("%X",number) -- number to hex
paintutils -- built in library, makes drawing things way easier
notepad++ -- the tabbing

Thanks for those tipppss.
When I started writing the darn thing I didn't use localization, and I've been going through lately trying to fix up my mistakes.
as for hex - THANKS! I'm terrible at the whole knowing every function available to me thing. But I always find a way, normally an ugly one.
I think I used the paintutils, by memory. Edited it and inserted it in the code...
Notepad++? Well, whatever floats your boat! :D
If anybody else can point out something that can be made actually better, I'd REALLY appreciate it.

#4 JustPingo

  • Members
  • 108 posts
  • LocationFrance

Posted 02 September 2013 - 06:53 AM

OMG this is cool.
But, is it also compatible with Iron Note Blocks ?
And a suggestion : make a security if the player haven't enabled the CommandBlock functionsin the CC config file.
And in the NBS converter, line 94 add :

os.queueEvent("smthg")
os.pullEvent("smthg")

Else, it crash.
And, btw, when I try to play a song imported from a NBS, it crash at line 314.

#5 willwac

  • Members
  • 182 posts

Posted 01 October 2013 - 07:35 PM

convertnbs doesn't work for me! what's wrong?

#6 reububble

  • Members
  • 72 posts
  • LocationBehind you

Posted 06 October 2013 - 12:41 AM

View Postwillwac (NewCoolPC), on 01 October 2013 - 07:35 PM, said:

convertnbs doesn't work for me! what's wrong?

What seems to be the problem officer?

#7 willwac

  • Members
  • 182 posts

Posted 06 October 2013 - 09:07 AM

I got it fixed, I didn't know that we needed a progress API

Can i make you a simple installer?

#8 LBPHacker

  • Members
  • 766 posts
  • LocationBudapest, Hungary

Posted 06 October 2013 - 11:42 PM

Ewww... That NBS something... Is that the last music format for ComputerCraft? I'm asking because that turned out to be buggy (because ComputerCraft reads the CR characters as if they were LF characters when reading from a file).

#9 reububble

  • Members
  • 72 posts
  • LocationBehind you

Posted 07 October 2013 - 04:34 AM

I'm surprised I didn't fix that API necessity.

I would make a simple installer, but currently I am going to my final year of secondary schooling, and that means after today - the last day of holidays before the term begins - I will be in study mode.
Also my laptop I use is crummy but I expect a replacement under warranty sometime this week...
So sometime after November 21st, I might be able to work on CC.

LBPHacker, if by 'last' music format you mean the latest to be developed, I might own that title with the file format that the music is all converted to, FROM nbs and midi.
Buggy is not an unfamiliar word to me but I know my program parses the files correctly with how I've programmed it.

Glad to see people actually use some of my stuff.

#10 Kamefrede

  • Members
  • 30 posts
  • LocationPortugal,porto

Posted 07 October 2013 - 04:58 AM

i like it , you should add a randomizer(shuffle) or a play all on your program

#11 DerPonyFreund

  • New Members
  • 2 posts

Posted 13 January 2015 - 12:54 PM

Hey there!
I need help with your program.

I am playing on the direwolf20 pack (FTB) on MC 1.7.10 on a server.
I am admin and have access to the FTP, so submitting midi files is not a problem.

But everytime I am trying to play a (already converted) file, I get an error message.

So, I tried to do what jfmherokiller said, but it wont work.
I enabled Command Blocks in the config and I put one to the left of the computer.

My lines (ln 322 - 327) look like this:

else
function playNote(ins,no)
ins=(ins-1)
  man.playNote(ins,no)
end
end
I get an error at line 325, called compose:325: attempt to index ? (a nil value)

I would really LOVE this program, but I´m not very good at Lua.

I hope that you are able to fix this.

#12 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 13 January 2015 - 10:40 PM

The program is failing to find a command block.

Shut the MineCraft server down, double-check the config file it's using, relaunch, then try again.

If it's still having problems, run this in the Lua prompt:

print(peripheral.getType("left"))


#13 DerPonyFreund

  • New Members
  • 2 posts

Posted 14 January 2015 - 03:52 PM

View PostBomb Bloke, on 13 January 2015 - 10:40 PM, said:

The program is failing to find a command block.

Shut the MineCraft server down, double-check the config file it's using, relaunch, then try again.

If it's still having problems, run this in the Lua prompt:

print(peripheral.getType("left"))

So, I tried this as well in Singleplayer, I put a command block in Creative Mode next to the computer (to the left). I'm still getting the same error.
On the Server its the same.

I put that into the lua promt and I get:
(blank space)
1
as an answer. I hope that this is correct.

#14 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 14 January 2015 - 10:17 PM

View PostDerPonyFreund, on 14 January 2015 - 03:52 PM, said:

I put that into the lua promt and I get:
(blank space)
1
as an answer. I hope that this is correct.

That result indicates that the ComputerCraft config file is not set up to allow the use of Command Blocks as peripherals. Did you enable this in the ComputerCraft config, or did you merely enable Command Block placement in the MineCraft config? Again, make sure the game / server isn't running when you make these changes.

#15 Dartania Thorne

  • Members
  • 5 posts

Posted 21 April 2017 - 12:50 AM

I'm having problems with the installer, apparently. I run `pastebin run Mh521Gt8`, say 'Yes' To everything, and then try to compose. I get an error, MusicBox:136: attempt to call nil. I get the same error when I run lua and type `MusicBox.setUp()` Do you know why this is?

#16 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 22 April 2017 - 01:34 AM

A quick look at the code suggests that the script believes it is running on a Command Computer, but cannot find the "gamerule" function. Off the top of my head, that shouldn't be: all versions of ComputerCraft with Command Computers should have that one within the commands API.

reububble hasn't logged into the boards for quite some time, so you may be better off using a different music player, such as Note or wave-amp. Either of these should work for Command Computers, wave-amp alternatively handles MinimalPeripherals note blocks (and maybe others?), while Note additionally handles MoarPeripherals / Computronics / Plethora note blocks (and maybe others?).





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users