Forums => Tips & Tricks => User Tools => Topic started by: Rick G. on 2011-05-26 06:36 AM
Title: Pause aware MIDI conversion - rg_toMIDI.php
Post by: Rick G. on 2011-05-26 06:36 AM
The attached NWC 2.5+ User Tool will export MIDI files that sound like NWC playback even if the song file contains Fermata, Breath Mark, and/or Caesura pauses.
NWC 2.5 (currently beta) is available to registered users <here> (https://forum.noteworthycomposer.com/?topic=7323.0). The tool requires the 2.5 User Tool Starter Kit available <here> (http://www.noteworthysoftware.com/nwc2/usertools/).
The tool requires installation of these 2 packages from http://www.midiox.com/
http://www.midiox.com/zip/Midi2Mtx-Installer.zip
http://www.midiox.com/zip/Mtx2Midi-Installer.zip
Installation Save the attachment to your User Tool scripts folder as: rg_toMIDI.php Open (http://ntworthy.com/nwc2/help/MNU_FILEOPEN.htm) a song into NWC 2.5.
Press ALT+F8, click on 'New...' For 'Name:', I simply called it 'to MIDI' Click on 'Browse...' and open rg_toMIDI.php from the list. Add ' -v' to the end. It should look something like:
Quote
php\php.exe Scripts\rg_toMIDI.php -v
Under 'Input Type', select 'File Text' Under 'Options', check 'Prompts for User Input'.
Use
It is best to start with a small file. These will typically convert in less than a second.
Conversion of moonlite.nwc takes about 2 seconds. If you add a pause to 1812.nwc, conversion will take about 6 seconds.
If you remove ' -v' (VERBOSE mode) from the command, the closing screen will not appear unless there is an error.
Comments welcome. I am unable to test this on anything but XP Pro and am eager to read that it will work on other Windows versions.
Note: the tool creates some temporary files. If the tool errs, these may not be deleted. If this happens, remove them manually. 2011May31 edit: update to version 1.1 2012Jan08 edit: update toolkit link
Title: Re: Pause aware MIDI conversion - rg_toMIDI.php
Post by: Richard Woodroffe on 2011-05-26 08:25 PM
Attempting to run using Windows 7 64 bit machine.
This version of windows has two different program areas.
The program areas that are 64 bit programs all get installed into c:\Program Files
whereas any 32 bit (or less) program gets installed into
c:\Program Files (x86)
When your program runs, it is assuming that the Midi2Mtx and Mtx2Midi programs are in c:\Program Files. But on a 64bit windows 7 machine, they will be in C:\Program Files (x86)
So the procedure fails.
After editing your php file so that the early definitions point to the correct program folder, the program ran without error.
Here is the output screen for the first attempt
Quote
15 477464 0.000 main (449024) 212 496768 0.232 main (484272) 219 0 0.003 fcopy (Resource id #1,user.nwctxt) 220 0 0.554 nwcConv (user.nwctxt,user.mid,-1) 222 16400 0.001 hasPause (Resource id #1) 229 0 0.006 fcopy (user.mid,Calypso.mid) 233 519936 0.803 main (497248)
The pause due to the fermata was successfully generated in the midi file.
Excellent!
Rich.
Title: Re: Pause aware MIDI conversion - rg_toMIDI.php
Post by: Richard Woodroffe on 2011-05-27 09:31 AM
Rick
Thanks for the amendment that finds Midi2Mtx and Mtx2Midi whichever windows program area they reside in.
I have tested this a number of times now including using Van Basco as the midi player to test karaoke and all is as expected.
This is an excellent solution for those nwc users that have been asking for midi export of fermata and the like. Note that I said solution rather than work around. It is just as easy to run your user tool as it is to export to midi. An inovative approach if I am reading your process correctly: Roughly : Export to midi - convert midi to txt - convert nwc to nwctxt - find out where the fermata etc are - work out the timings - put this into the text midi file as appropriate - convert the textmidi file back to midi.
Impressive.
One point I think that you may want to include is to put in a routine that detects if the output midi file name already exists. At the moment, if it already exists, it is overwritten without a dialogue box. That does not happen with a straight midi export.
Not a great problem for me, but may be for others so thought I would mention it.
Title: Re: Pause aware MIDI conversion - rg_toMIDI.php
Post by: Rick G. on 2011-05-27 10:05 AM
One point I think that you may want to include is to put in a routine that detects if the output midi file name already exists. At the moment, if it already exists, it is overwritten without a dialogue box. That does not happen with a straight midi export.