Skip to content

jongs12/Midi2Logic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

94 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

개발 μ€‘λ‹¨λœ λ²„μ „μž…λ‹ˆλ‹€. μ—¬κΈ°λ‘œ κ°€μ„Έμš”.

[KO]

λ―Έλ”” νŒŒμΌμ„ μ½μ–΄μ„œ κ²Œμž„ 'Mindustry'의 λͺ¨λ“œ 쀑 ν•˜λ‚˜μΈ 'Betamindy'의 λ…ΈνŠΈλΈ”λŸ­μ„ μ—°μ£Όν•˜λŠ” 둜직 μ½”λ“œλ₯Ό μ§œμ£ΌλŠ” ν”„λ‘œκ·Έλž¨μž…λ‹ˆλ‹€. μ‚¬μš©ν•  λ•ŒλŠ” 'Infinite Processor' λͺ¨λ“œλ₯Ό ν•¨κ»˜ μ‚¬μš©ν•˜λŠ” 것을 ꢌμž₯ν•©λ‹ˆλ‹€. λ―Όλ”μŠ€νŠΈλ¦¬μ™€ νŒŒμ΄μ¬μ— λŒ€ν•΄ μ–΄λŠ 정도 기초적인 지식이 있으면 μ‚¬μš©ν•˜λŠ” 데 도움이 될 κ²λ‹ˆλ‹€.

이 ν”„λ‘œκ·Έλž¨μ„ μ‚¬μš©ν•˜λ €λ©΄ 파이썬과 mido λͺ¨λ“ˆ(ν˜„μž¬ 1.2.10)이 ν•„μš”ν•©λ‹ˆλ‹€. λ˜ν•œ, IDLE둜 μ‹€ν–‰ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.

1

IDLE둜 μ‹€ν–‰ν•œλ‹€λŠ” 것은 ν•œ 쀄씩 μ‹€ν–‰ν•œλ‹€λŠ” 것이 μ•„λ‹ˆλΌ, μ…Έ μ°½μ—μ„œ 'File -> Open'으둜 νŒŒμΌμ„ μ—° λ‹€μŒ F5둜 ν•œλ²ˆμ— μ‹€ν–‰ν•œλ‹€λŠ” μ˜λ―Έμž…λ‹ˆλ‹€. (ν˜„μž¬λŠ” μ—…λ°μ΄νŠΈλ‘œ IDLE 없이 κ·Έλƒ₯ 파이썬 νŒŒμΌμ„ λ°”λ‘œ 싀행해도 문제 μ—†μŠ΅λ‹ˆλ‹€.)

2

mido λͺ¨λ“ˆμ„ μ„€μΉ˜ν•˜λ €λ©΄ λͺ…λ Ή ν”„λ‘¬ν”„νŠΈμ— λ”°μ˜΄ν‘œ 없이 'pip install mido'라고 μž…λ ₯ν•˜μ„Έμš”. μ„€μΉ˜μ— μ„±κ³΅ν•˜λ©΄ 파일 κ²½λ‘œκ°€ λœ¨λŠ”λ°, μ œλŒ€λ‘œ μ„€μΉ˜λλŠ”μ§€ 확인해 μ£Όμ„Έμš”.

3

이 ν”„λ‘œκ·Έλž¨μ—μ„œλŠ” 이 ν”„λ‘œκ·Έλž¨κ³Ό 같은 폴더에 λ“€μ–΄ μžˆλŠ” 파일둜 읽기 및 μ“°κΈ°λ₯Ό ν•©λ‹ˆλ‹€. λ”°λΌμ„œ λ―Έλ”” 파일이 이 ν”„λ‘œκ·Έλž¨κ³Ό 같은 폴더 μ•ˆμ— λ“€μ–΄ μžˆμ–΄μ•Ό ν•©λ‹ˆλ‹€. λ―Έλ””.txt 파일과 둜직.txt νŒŒμΌμ—λŠ” μ“°κΈ°λ₯Ό ν•©λ‹ˆλ‹€. μ΄λ•Œ κΈ°μ‘΄ 파일 λ‚΄μš©μ€ μ§€μ›Œμ§€λ‹ˆ μ£Όμ˜ν•˜μ„Έμš”.

4

가끔씩 인코딩 μ—λŸ¬κ°€ λ‚˜μ„œ μ €λŸ° λ©”μ‹œμ§€κ°€ 뜰 λ•Œκ°€ μžˆλŠ”λ°, set_tempo / note_on / note_off 처럼 μŒμ•… 전체에 영ν–₯을 쀄 수 μžˆλŠ” 라인만 μ•„λ‹ˆλ©΄ κ·Έλƒ₯ λ¬΄μ‹œν•˜μ…”λ„ λ©λ‹ˆλ‹€.

6

λ³€ν™˜ μ™„λ£Œ μ‹œ μ…Έ 창에 blocks와 linesκ°€ ν‘œμ‹œλ˜λŠ”λ° blocksλŠ” λ―Έλ””λ₯Ό μ˜¨μ „νžˆ μ—°μ£Όν•˜λŠ” 데 ν•„μš”ν•œ λ…ΈνŠΈ λΈ”λ‘μ˜ 수이고 linesλŠ” μ—°μ£Ό'μ—λ§Œ' ν•„μš”ν•œ μ½”λ“œ 쀄 μˆ˜μž…λ‹ˆλ‹€. (μŠ€μœ„μΉ˜ μƒνƒœ 감지, λ©”λͺ¨λ¦¬ μ…€ μž…μΆœλ ₯ 등은 μ œμ™Έ) 84개의 λ…ΈνŠΈ 블둝이 각각 ν•œ κ°€μ§€ 음만 μ—°μ£Όν•˜λŠ” 건반 λͺ¨λ“œκ°€ 켜져 있으면 blocksλŠ” 84둜 κ³ μ •λ©λ‹ˆλ‹€.

λ³€ν™˜ν•  λ•Œ μ—°μ£Ό μ½”λ“œκ°€ 900쀄이 λ„˜μœΌλ©΄ μ—¬λŸ¬ νŽ˜μ΄μ§€λ‘œ λ‚˜λ‰˜μ–΄ 좜λ ₯λ˜λŠ”λ°, ν•œ ν”„λ‘œμ„Έμ„œμ— μ΅œλŒ€ 999μ€„κΉŒμ§€ λ“€μ–΄κ°ˆ 수 있기 λ•Œλ¬Έμ— 그런 κ²ƒμœΌλ‘œ νŽ˜μ΄μ§€ 수만큼의 ν”„λ‘œμ„Έμ„œλ₯Ό μ€€λΉ„ν•΄μ„œ 각 νŽ˜μ΄μ§€ λ‚΄μš© 전체λ₯Ό λ³΅λΆ™ν•΄μ£Όμ‹œλ©΄ λ©λ‹ˆλ‹€.

7

λ…ΈνŠΈ 블둝을 μ—°μ£Όν•˜λŠ” λͺ¨λ“  ν”„λ‘œμ„Έμ„œλŠ” λͺ¨λ“  λ…ΈνŠΈ 블둝(block1, block2...)κ³Ό 1개의 λ©”λͺ¨λ¦¬ μ…€(cell1)에 μ—°κ²°λ˜μ–΄ μžˆμ–΄μ•Ό ν•˜λ©°, 특히 첫 λ²ˆμ§Έμ™€ λ§ˆμ§€λ§‰ ν”„λ‘œμ„Έμ„œλŠ” 1개의 μŠ€μœ„μΉ˜(switch1)에도 μ—°κ²°λ˜μ–΄ μžˆμ–΄μ•Ό ν•©λ‹ˆλ‹€. μ—°κ²°λœ λ©”λͺ¨λ¦¬ μ…€μ˜ 0번 칸은 0~9의 숫자λ₯Ό μž…λ ₯ν•˜λ©΄ μ—°μ£Όν•  μ•…κΈ°λ₯Ό κ²°μ •ν•  수 있고, 1번 칸은 μ—°μ£Όν•  파트λ₯Ό κ²°μ •ν•˜κΈ° λ•Œλ¬Έμ— ν•¨λΆ€λ‘œ μˆ˜μ •ν•˜λ‹€κ°„ 곑이 뒀죽박죽이 될 μˆ˜λ„ μžˆμŠ΅λ‹ˆλ‹€.

8

그럼 건반 λͺ¨λ“œλŠ” 88개의 블둝에 μ—°κ²°ν•΄μ•Ό ν•˜λŠ” 것 μ•„λ‹ˆλƒκ³ μš”? κ·Έλ ‡μŠ΅λ‹ˆλ‹€! λ„ˆλ¬΄ νž˜λ“  일 μ•„λ‹ˆλƒκ³ μš”? κ·Έλž˜μ„œ 건반 λͺ¨λ“œ μ „μš© 맡도 μ€€λΉ„ν–ˆμŠ΅λ‹ˆλ‹€. piano.msavλ₯Ό 확인해 λ³΄μ„Έμš”!

이런 글을 써본 적이 λ³„λ‘œ μ—†μ–΄μ„œ 많이 λ‚œμž‘ν•΄λ„ μ–‘ν•΄ λΆ€νƒλ“œλ €μš”.

비둝 λ‚˜μ€‘μ— 더 쒋은 ν”„λ‘œκ·Έλž¨μ΄ λ‚˜μ˜¨λ‹€κ³  해도, μ œκ°€ 이런 것을 μ‹œλ„ν–ˆλ‹€λŠ” 것을 κΈ°μ–΅ν•΄ μ£Όμ„Έμš”...

[EN]

(Translator is used)

This is a program that reads a midi file and creates a logic code to play the note block of 'Betamindy,' one of the mods of the game 'Mindustry.' Recommend 'Infinite Processor' mod when using. If you have some basic knowledge of Mindustry and Python, it will help you use it.

Python and mido module(currently 1.2.10) are required to use this program. Also, it is recommended to run with IDLE. Running with IDLE does not mean running one line at a time, but opens the file with 'File -> Open' in the shell window and then runs it at once with F5. To install the mido module, type 'pip install mido' without quotes at the command prompt.

This program reads and writes to files in the same folder as this program. The corresponding file is as follows. Just in case, please check to prevent accidents in which existing files are deleted: λ―Έλ””.txt(read/write), 둜직.txt(write only), (midi name).mid(receives input in program, read only)

Sometimes it can't read the midi file automatically(i think there is an encoding error). In that case, copy the part that says Squeezed text and paste it to λ―Έλ””.txt(in the same folder as the program) and save. If you try to force the process without pasting it, an error occurs because the file is empty.

When the conversion is completed, blocks and lines are displayed in the shell window. 'blocks' is the number of note blocks required to fully play the midi. 'lines' is the number of code lines required only for 'play'(except switch state detection, memory cell input/output, etc.). If keyboard mode, in which 84 note blocks each play only one note, is turned on, the blocks are fixed at 84.

When converting, if the playing code exceeds 900 lines, it is divided into several pages and output. Because it can fit up to 999 lines in one processor. You need to prepare as many processors as the number of pages and copy and paste the entire contents of each page.

All processors playing the note block must be connected to all note blocks(block1, block2...) and a memory cell (cell1). In particular, the first and last processors must also be connected to the switch(switch1). The 0th column of the memory cell determines the instrument to play(available from 0 to 9), and the 1st column determines the part to play(starting from 0, automatically managed).

It's my first time using Github, so I ask for your understanding even if it's very chaotic.

Even if a better program comes out later, please remember that I tried this...

About

python code that converts midi file to Mindustry logic code

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages