This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
クデル's profile picture

MIDI Capabilities

Started by クデル, 19 May 2015 - 09:39 AM
クデル #1
Posted 19 May 2015 - 11:39 AM
Just wondering, would it be feasible to interpret midi signals using ComputerCraft through something such as an external peripheral in the game, or perhaps even a signal-system communicating over something such as HTTP.
Bomb Bloke #2
Posted 19 May 2015 - 12:32 PM
Conventional wisdom has been to use NBS files - these are typically MIDIs that've been converted through Note Block Studio specifically for use with note blocks. ComputerCraft can interact with note blocks, and therefore can play NBS files.

A few ComputerCraft NBS players have been made over time. I'm of course going to plug the one TheOriginalBIT and I made - Note. It uses Iron Note Blocks from his MoarPeripherals mod, allowing you to play at a faster pace than you can using redstone signals, and using fewer blocks to do it, too.

Plus you can load it as an API, making it relatively easy to add its playback capabilities to other scripts. For example:

Spoilerhttp://www.youtube.com/watch?v=9dHwvWWfV-0
クデル #3
Posted 19 May 2015 - 01:15 PM
Hmm interesting, I have seen NBS files before, never knew they were midi. But however, would realtime midi signal interpreting be possible? I would love to use a midi controller with noteblocks - for the "cool" factor… :P/>
Bomb Bloke #4
Posted 19 May 2015 - 01:24 PM
Well, this was pointed out to me the other day - to my understanding, it's a MIDI parser for OpenComputers. Haven't tried it, myself.
InDieTasten #5
Posted 20 May 2015 - 01:56 PM
Well, MIDI files and MIDI signals are quite different. The OP is talking about the signal, the ansers on the other hand on files.

So if you want to pass midi-signals from your keyboard(for example) to your computer in real-time, you will notice that computercraft is not able to listen to those really efficiently without DOS'ing your host. You can make this work with special status codes of the servers, so that the request will be able to answer the moment the next signal comes in. But even then I think you wouldn't be able to play something while you are hearing it, since the delay of the "instrument" will confuse your inner rhythm.

You could potentially reverse this to having a computercraft keyboard ingame, and some output device at the host. Sending requests at the correct point would then be easier to return responses at the right point of time, but still would involve some delay.(this version would be far easier to implement on the host side).

If you are actually just trying to read midi files, then ignore this post immediately and don't tell me, since I would begin to cry about my wasted time D':

Have fun coding
Edited on 20 May 2015 - 11:58 AM
クデル #6
Posted 21 May 2015 - 08:47 AM
Thanks a bunch, it really helped, I will be definitely be going with the second route.