Midi2PLAY - Converting MIDI files to MSX-BASIC

Страница 2/3
1 | | 3

By meits

Scribe (6572)

Аватар пользователя meits

11-12-2018, 09:26

MSX Audio has 9 channels + 1 adpcm channel.

Something that would make it possible to get as close to the source as possible is conversion to Moonsound: 24 channels and a Yamaha General MIDI ROM on board.

By rodrivas78

Resident (33)

Аватар пользователя rodrivas78

11-12-2018, 20:42

Thanks TheKid, my initial goal was to make a converter compatible with psg, which as we know has the limitation of three voices, so if the midi file has more than 3 channels the user should select only 3 of these. If you want a conversion to more channels (to use in interfaces that support more channels like msx-audio) you just have to convert from 3 to 3 and then put everything together in the code. This is very simple since you only have to change the arrays variables and the numbers of the lines in the output file.

By rodrivas78

Resident (33)

Аватар пользователя rodrivas78

11-12-2018, 20:53

Hi Grauw, thanks for the suggestion. Yes, soon I will make a video (I'm postponing this because I'm not good at it, believe me Big smile ), for now I'll try to post here a use guide as succinct as possible ok? I would like to point out that in the executable folder (present in the link I reported) I included a somewhat comprehensive manual. Smile

By rodrivas78

Resident (33)

Аватар пользователя rodrivas78

11-12-2018, 21:32

Let's go! Midi2PLAY succinctly Wink

1) Choose the midi file you want to convert.
2) Open this file in 3ML Editor (download link from 3ML Editor: http://3ml.jp/download.html).

File > Import Standar MIDI file

3) Now write down the octave of the first note of each "track". This information can be obtained rovering the mouse pointer over the first note of each "track" on the grid, on the right side of the window (see image below).

You can see in the image that the file has 3 tracks, each one with a differente color.
When you hover over a note, a balloon (in the "same color" of the track) will appear with the octave number after the letter "o". In this image you can see this data: "o4 V8 Gate72" , this means that the note is in octave 4 ("o4").
After getting (taking note) the first note of each track proceed.

4) Export the MML (as type "MabiMML Compatible Format") to the clipboard ("File> Export MML to Clipboard"). Select (in the export window on the left) the tracks that will be exported.
5) Paste the file into the notepad and save it as "mml.txt".
6) Move this file ("mml.txt") to the folder where Midi2PLAY.exe is.
7) It is now necessary to make a quick formatation in the file so that it can be converted correctly by Midi2PLAY.

By rodrivas78

Resident (33)

Аватар пользователя rodrivas78

11-12-2018, 22:27

(continuing)
Formatting consists of two steps:

8) Remove from the file "mml.txt" anything other than the strings and "[Channel]" (see image below)

9) Erase the duplicate measure indications (if has any) as below.

10) Do not forget to keep the character "]" at the end of the document.
Now below we see how the document should be:

That's it. The formatting process is over!

11) Save the file (as "mml.txt").
12) Run Midi2PLAY and enter the data as the program requests: whether or not you want to concatenate the bars (select 'No', see the manual for details on this) and then enter the octaves (just the numbers) in which each channel starts. Just enter each value and hit ENTER.
13) The result can be seen in the file "play.txt":

[Channel1]
10 A$(1)="o4g8.a8o5c16o4b8.g8.o5c8.d8"
20 A$(2)="f16e8.d8.d+8.d8c16o4a+8."
30 A$(3)="o5d+8.a+8.g8d+16d8.g8e4"
40 A$(4)="e16"
[Channel2]
50 B$(1)="o5e8o4g16o5d8o4a16o5c8o4g16a8o5c16e8o4g16o5d8"
60 B$(2)="o4a16o5c8o4g16o5c8g16g+8g16f8d+16d8"
70 B$(3)="c16o4a+8o5d16d+8f16d+8c16f16d16o4a16o5d16o4b16a4"
80 B$(4)="a16"
[Channel3]
90 C$(1)="o4g8o5c16d8f16e8c16d8a16g8c16d8"
100 C$(2)="f16e8c16g8b16o6c8o5a+16g+8g16f8"
110 C$(3)="d+16d8o4a+16o5a+8o6c16o5a+8g16a16f16d16g16e16d4"
120 C$(4)="d16"

14) Finally, delete the "[Channel_]" indications and initialize the arrays and loop (for / next):

5 DIM A$(4): DIM B$(4): DIM C$(4)
7 T$="s9m50000t100"
10 A$(1)="o4g8.a8o5c16o4b8.g8.o5c8.d8"
20 A$(2)="f16e8.d8.d+8.d8c16o4a+8."
30 A$(3)="o5d+8.a+8.g8d+16d8.g8e4"
40 A$(4)="e16"
50 B$(1)="o5e8o4g16o5d8o4a16o5c8o4g16a8o5c16e8o4g16o5d8"
60 B$(2)="o4a16o5c8o4g16o5c8g16g+8g16f8d+16d8"
70 B$(3)="c16o4a+8o5d16d+8f16d+8c16f16d16o4a16o5d16o4b16a4"
80 B$(4)="a16"
90 C$(1)="o4g8o5c16d8f16e8c16d8a16g8c16d8"
100 C$(2)="f16e8c16g8b16o6c8o5a+16g+8g16f8"
110 C$(3)="d+16d8o4a+16o5a+8o6c16o5a+8g16a16f16d16g16e16d4"
120 C$(4)="d16" 
130 PLAY T$, T$, T$
140 FOR X=1 to 4
150 PLAY A$(X), B$(X), C$(X)
160 NEXT X

I think it's this :)
Please let me know if there was anything that was not clear.
p.s.: Not all ".mid" files are usable. Depending on the file the channels may be truncated which will cause the 3ML Editor not to open it properly. Look for files that contain the separate voices (such as at this link: http://stringsound.com/Page12.html).

By rodrivas78

Resident (33)

Аватар пользователя rodrivas78

11-12-2018, 22:30

I recognize that there is an excess of non-automatic processes in the conversion. In the next versions I intend to make everything simpler for the user. Smile

By popolony2k

Hero (544)

Аватар пользователя popolony2k

12-12-2018, 00:54

rodrivas78 wrote:

I recognize that there is an excess of non-automatic processes in the conversion. In the next versions I intend to make everything simpler for the user. Smile

Hi rodrivas78, 7 years ago I wrote a similar program like you did now, but the main difference is that my software convert MML file (using the same 3ML editor like you're using), to MSD MusicA player format.

My software execute all these non-automatic conversion, automagically Smile, so if you want you can use part of it to help your project, since it's GPLv3.

Please check all related articles on my website.

http://www.popolony2k.com.br/?p=713
http://www.popolony2k.com.br/?p=742
http://www.popolony2k.com.br/?p=808
http://www.popolony2k.com.br/?p=859

[]'s
PopolonY2k

By rodrivas78

Resident (33)

Аватар пользователя rodrivas78

14-12-2018, 20:39

Hi polopony2k, thanks for the support! My program is indeed very simple, I did only as a tool for myself. Then I decided to post here because I thought it might be useful for someone...before it was even less user-friendly than it is now lol.
While I was working on the code, I looked for something similar and found your program. Unfortunately (or fortunately) your software was not compatible with the PSG so I preferred to start from scratch.
Your project is very interesting and without doubt I will still take a closer look at the code.
Meanwhile, you're welcome to use your magic and improve mine that's on GitHub. Smile
[]'s

By gdx

Enlighted (6436)

Аватар пользователя gdx

29-04-2020, 10:50

I tried to convert the MIDI file below but both converters seem do not work on Windows 10 64bit.

http://www2s.biglobe.ne.jp/~occhan/bgm/pooyan.lzh

By rodrivas78

Resident (33)

Аватар пользователя rodrivas78

30-04-2020, 23:41

gdx wrote:

I tried to convert the MIDI file below but both converters seem do not work on Windows 10 64bit.

I didn't know about this problem. I’ll do an update today. As soon as it’s ready I’ll let you know here.

Страница 2/3
1 | | 3