Midi2Zsm Script

Post Reply
User avatar
ahenry3068
Posts: 1136
Joined: Tue Apr 04, 2023 9:57 pm

Midi2Zsm Script

Post by ahenry3068 »

This is a link to a Windows MIDI2VGM Convertor. It supports a few different sound chips but defaults to YM2151 :)..

MID2VGM (Windows)
https://www.vogons.org/download/file.php?id=173907

This is a link to ZeroBytes zsm library repository.
For this script to work you need to download his vgm2zsm tool. This tool needs php installed to work.

Zerobytes zsound repo
https://github.com/ZeroByteOrg/zsound

You only need vgm2zsm for my script but there are other useful tools there also. (recommend zsmtool if you want to make the output files of my script have a loop point)

vgm2zsm will probably have to have the execute bit set after you download it. and put it somewhere in your path (I put it in /usr/local/bin)


Finally my Linux script that puts the above 2 together to implement mid2zsm.
When run the resulting file name is mout.zsm which can then be renamed.

Now the script. You will have to modify to fit your system. You must change to the directory for the Windows program before executing it otherwise it cannot find its supporting files. On my system it resides in /home/ahenry3068/Desktop/MIDI2VGM. You should edit this script to reflect where you have it stored. pushd changes to the directory while storing the current one on a directory "stack". popd restores last directory. Wine must also be installed since we are calling a Windows program.

Paste my script code into a text editor. Save it as mid2zsm. Set the execute bit and copy it somewhere in your path i.e. /usr/local/bin

HERES THE SCRIPT

Code: Select all

#!/bin/bash
echo $1
cp $1 /home/ahenry3068/Desktop/MIDI2VGM
pushd /home/ahenry3068/Desktop/MIDI2VGM  > /dev/null
echo .
echo ..
echo ... Converting $1 to .vgm
echo ..
echo .
wine mid2vgm.exe $1 -d3
popd > /dev/null
cp /home/ahenry3068/Desktop/MIDI2VGM/mout.vgm ./mout.vgm
echo .
echo ..
echo ... Converting mout.vgm to mout.zsm
echo ..
echo .
vgm2zsm mout.vgm
Last edited by ahenry3068 on Thu Nov 30, 2023 11:05 pm, edited 1 time in total.
User avatar
ahenry3068
Posts: 1136
Joined: Tue Apr 04, 2023 9:57 pm

Re: Midi2Zsm Script

Post by ahenry3068 »

ahenry3068 wrote: Thu Nov 23, 2023 9:11 am This is a link to a Windows MIDI2VGM Convertor. It supports a few different sound chips but defaults to YM2151 :)..

MID2VGM (Windows)
https://www.vogons.org/download/file.php?id=173907



This is a link to ZeroBytes zsm library repository.
For this script to work you need to download his vgm2zsm tool. This tool needs php installed to work.

Zerobytes zsound repo
https://github.com/ZeroByteOrg/zsound

You only need vgm2zsm for my script but there are other useful tools there also. (recommend zsmtool if you want to make the output files of my script have a loop point)

vgm2zsm will probably have to have the execute bit set after you download it. and put it somewhere in your path (I put it in /usr/local/bin)


Finally my Linux script that puts the above 2 together to implement mid2zsm.
When run the resulting file name is mout.zsm which can then be renamed.

Now the script. You will have to modify to fit your system. You must change to the directory for the Windows program before executing it otherwise it cannot find its supporting files. On my system it resides in /home/ahenry3068/Desktop/MIDI2VGM. You should edit this script to reflect where you have it stored. pushd changes to the directory while storing the current one on a directory "stack". popd restores last directory. Wine must also be installed since we are calling a Windows program.

Paste my script code into a text editor. Save it as mid2zsm. Set the execute bit and copy it somewhere in your path i.e. /usr/local/bin


I've kind of realized this leaves Windows users a little in the cold. Anyone that's good with Powershell or just plain .BAT files should go ahead and post a windows version of this script. It might be easier in Windows as everything will be native. I'm having to use wine.
Post Reply