Author Topic: Listing things  (Read 4570 times)

I want to re-create Walt Disney's Carousel of Progress in Blockland from Walt Disney World
Suggestion. Make or find a MIDI parser outside of Blockland that can turn the .mid file into one that is more readable (I've never looked at a .mid file in a text editor; is it plaintext or encoded?)

Suggestion. Make or find a MIDI parser outside of Blockland that can turn the .mid file into one that is more readable (I've never looked at a .mid file in a text editor; is it plaintext or encoded?)
This is what tune.mid looks like when opened in Notepad. (some test song, and a short one too)
Code: [Select]
MThd     MTrk   # X`   A   w  Q  / MTrk  x     ] J d
 [; J G G G G H H E E E E C C@G G@J J J J G G G G H H E E E E C C@G G@C C C C G G G G H H E E E E C C@G G@J J J J G G G G H H E E E E C C@G G@C C / MTrk   @     ] d
 [; Jd Jd Cd Cd Jd Jd Cd Cd / MTrk        d / MTrk       
 d / MTrk    d / MTrk    d / MTrk    d / MTrk    d / MTrk    d / MTrk    d / MTrk    d / MTrk    / MTrk    / MTrk    / MTrk    /
Doesn't look like note on or off events, but it looks like that. If you look, it does give the note played, I think.

Midi is a binary file. You can not read it with torkscript. You need to (externally) convert it to a text-based format first.

Midi is a binary file. You can not read it with torkscript. You need to (externally) convert it to a text-based format first.
This.
You could use a format such as ABC (there are multiple programs that can convert midi to abc)
Then write an ABC interpreter in torquescript, bundled with a bunch of single note sounds

This.
You could use a format such as ABC (there are multiple programs that can convert midi to abc)
Then write an ABC interpreter in torquescript, bundled with a bunch of single note sounds
So instead of
Code: [Select]
function MIDI_SongList(%midi)
 {
   //
   %pattern = "Add-Ons/MIDI_MIDI_Files/*.mid";
   
   $MIDI::numMIDIs = 0;
   
   %file = findFirstFile(%pattern);
   while(%file !$= "")
   {
      $MIDI::Song[$MIDI::numMIDIs] = %file;
      $MIDI::numMIDIs++;

      %file = findNextFile(%pattern);
   }
 }

RegisterOutputEvent(fxDTSBrick,"Set_MIDI_pref","int 1 16 1\tint 0 127 60",1);
RegisterOutputEvent(fxDTSBrick,"Play_MIDI_file","list $MIDI" TAB "bool");
//The MIDI Preferences are Channel, then note. The Play MIDI file bool is for
//whether or not the song will be played or stopped.

function MIDI_note_is_on()
{
}
RegisterInputEvent(fxDTSBrick,"MIDI_note_is_on","Self fxDTSBrick");

function MIDI_note_is_off()
{
}
RegisterInputEvent(fxDTSBrick,"MIDI_note_is_off","Self fxDTSBrick");

It would be
Code: [Select]
function MIDI_SongList(%midi)
 {
   //
   %pattern = "Add-Ons/MIDI_MIDI_Files/*.abc";
   
   $MIDI::numMIDIs = 0;
   
   %file = findFirstFile(%pattern);
   while(%file !$= "")
   {
      $MIDI::Song[$MIDI::numMIDIs] = %file;
      $MIDI::numMIDIs++;

      %file = findNextFile(%pattern);
   }
 }

RegisterOutputEvent(fxDTSBrick,"Set_MIDI_pref","int 1 16 1\tint 0 127 60",1);
RegisterOutputEvent(fxDTSBrick,"Play_MIDI_file","list $MIDI" TAB "bool");
//The MIDI Preferences are Channel, then note. The Play MIDI file bool is for
//whether or not the song will be played or stopped.

function MIDI_note_is_on()
{
}
RegisterInputEvent(fxDTSBrick,"MIDI_note_is_on","Self fxDTSBrick");

function MIDI_note_is_off()
{
}
RegisterInputEvent(fxDTSBrick,"MIDI_note_is_off","Self fxDTSBrick");

First off, you don't need to post a giant code block twice if you're only changing one line.

Second, changing the file extension really doesn't actually mean anything. You can use the .mid extension on an ABC notated file if you really wanted. The difference would be in how it's processed. Earlier someone mentioned that Port made an ABC parser, so I'd start by asking him for that code.

Third, you need to explain to us what you're trying to do better. MIDI files are commonly associated with containing musical data, so pretty much everyone here is assuming that you're trying to input musical data into Blockland. Since Blockland can't read MIDI files, they're suggesting you convert into a different music file format: ABC. I get the feeling that what you're trying to do is almost entirely unrelated to music, and you're using MIDI data that's also unrelated to music. Explain to us what you want to do with the MIDI file in more detail.

First off, you don't need to post a giant code block twice if you're only changing one line.

Second, changing the file extension really doesn't actually mean anything. You can use the .mid extension on an ABC notated file if you really wanted. The difference would be in how it's processed. Earlier someone mentioned that Port made an ABC parser, so I'd start by asking him for that code.

Third, you need to explain to us what you're trying to do better. MIDI files are commonly associated with containing musical data, so pretty much everyone here is assuming that you're trying to input musical data into Blockland. Since Blockland can't read MIDI files, they're suggesting you convert into a different music file format: ABC. I get the feeling that what you're trying to do is almost entirely unrelated to music, and you're using MIDI data that's also unrelated to music. Explain to us what you want to do with the MIDI file in more detail.
1. yeah I should have done that
2.Would you think he still has the code?
3. I want to re-create Walt Disney's Carousel of Progress in Blockland from Walt Disney World. The proper reason is that I want a sorta low brick count, and not the hours of seeing if I got the Delay Timing right

2: I assume he does.

3: How are you planning on accomplishing that with midi data? What exactly does your midi file contain?

I'm thinking he wants to use midi files to make events happen instead of using delays. Which kinda makes sense but I have no clue where he got the idea to use MIDI from.

Can you link, if one

https://youtube.com/watch?v=oU1t5ADGWyE

Would you think he still has the code?

Yes. I might fix it up a bit and publish it if there is enough demand.

Yes. I might fix it up a bit and publish it if there is enough demand.

What's the total size of all the individual files clients have to load? It would certainly be in demand if that size is low.

What's the total size of all the individual files clients have to load? It would certainly be in demand if that size is low.

Technically, there are no files to load as a client. The video above simply reads ABC files on the server and plays them back using serverPlay2D. The sound packs with note sounds, however, are pretty big (~30 sounds per instrument and about 8-10 instruments, if I remember correctly). One could upload ABC files to clients and have them play them back for better timing during lag, though.

Regardless, ABC files are pretty small.
And unreadable, unless you understand the format. Here's an example:

X:1
T: Super Mario Theme
Z: Devire
M: 4/4
L: 1/8
Q:1/4=105
K:G
e/2eec/2e g/2z3z/2|c/2zG/2 zE/2zAB^A/2=A|(3Geg a=f/2gec/2 d/2B/2z|c/2zG/2 zE/2zAB^A/2=A|
(3Geg a=f/2gec/2 d/2B/2z|zg/2^f/2 =f/2^de^G/2A/2cA/2c/2=d/2|zg/2^f/2 =f/2^dec'c'/2 c'/2z3/2|zg/2^f/2 =f/2^de^G/2A/2cA/2c/2=d/2|
z^d/2z=d/2z c/2z3z/2|zg/2^f/2 =f/2^de^G/2A/2cA/2c/2=d/2|zg/2^f/2 =f/2^dec'c'/2 c'/2z3/2|zg/2^f/2 =f/2^de^G/2A/2cA/2c/2=d/2|
z^d/2z=d/2z c/2z3z/2|c/2ccc/2d e/2cA/2 =G/2z3/2|c/2ccc/2d/2e/2 z4|c/2ccc/2d e/2cA/2 G/2z3/2|
e/2eec/2e g/2z3z/2|c/2zG/2 zE/2zAB^A/2=A|(3Geg a=f/2gec/2 d/2B/2z|c/2zG/2 zE/2zAB^A/2=A|
(3Geg a=f/2gec/2 d/2B/2z|e/2cG/2 z^G A/2=f=f/2 A/2z3/2|(3Baa (3ag=f e/2cA/2 =G/2z3/2|e/2cG/2 z^G A/2=f=f/2 A/2z3/2|
B/2=f(3=f=fed/2 c/2z3z/2|e/2c=G/2 z^G A/2=f=f/2 A/2z3/2|(3Baa (3ag=f e/2cA/2 =G/2z3/2|e/2cG/2 z^G A/2=f=f/2 A/2z3/2|
B/2=f(3=f=fed/2 c/2z3z/2|c/2ccc/2d e/2cA/2 =G/2z3/2|c/2ccc/2d/2e/2 z4|c/2ccc/2d e/2cA/2 G/2z3/2|
e/2eec/2e g/2z3z/2|e/2cG/2 z^G A/2=f=f/2 A/2z3/2|(3Baa (3ag=f e/2cA/2 =G/2z3/2|e/2cG/2 z^G A/2=f=f/2 A/2z3/2|
B/2=f(3=f=fed/2 c/2

Technically, there are no files to load as a client. The video above simply reads ABC files on the server and plays them back using serverPlay2D. The sound packs with note sounds, however, are pretty big (~30 sounds per instrument and about 8-10 instruments, if I remember correctly). One could upload ABC files to clients and have them play them back for better timing during lag, though.

Sorry, the sound files are what I was referring to, not the ABC files.