Thanks for this suggestion. I have decided to do this up in Perl instead of C. For those interested in this, here is my initial code. It works, but does not look nice. You will have to install the Tk and MIDI Perl modules.

#!/usr/bin/perl -w
   use Tk;
   use Tk::Optionmenu;
   use Tk::FBox;
   use Tk::MsgBox;
   use MIDI;
   use strict;

   my $mw = MainWindow->new;
   my $lbsel;

   $mw->Label(-text => 'Convert to type:')->pack;
   my $lb = $mw->Optionmenu(
       -options => ['0', '1'],
       -variable => \$lbsel
   )->pack;
   $mw->Button(
       -text    => 'Convert',
       -command => sub {doConvert() }
   )->pack;
   $mw->Button(
       -text    => 'Quit',
       -command => sub { exit }
   )->pack;
   MainLoop;
sub doConvert {
   my $ffile = $mw->FBox(
       -type => 'open',
       -filetypes => [[ 'midi files', '.mid' ]],
       -title => 'Select MIDI file to convert...'
   )->Show;
   if ($ffile ne "") {
       my $tfile = $mw->FBox(
           -type => 'save',
           -filetypes => [[ 'midi files', '.mid' ]],
           -title => 'Save converted file as...'
       )->Show;
       if ($tfile ne "") {
my $opus = MIDI::Opus->new({ 'from_file' => $ffile, 'no_parse' => 1 }); $mw->MsgBox(-title => "converting...", -detail => "converting to type: $lbsel", -type => 'ok')->Show;
           $opus->format($lbsel);
           $opus->write_to_file($tfile);
       }
   }
}


Michael Gerdau wrote:
Thanks for that link.  It appears that it will do the job (and there are
a few other programs there that might be helpful as well), but I would
prefer a native Linux app, if one exists.

If you have at least basic C coding skills you could try these MIDI
utilities (i.e. the corresponding MIDI file library):
http://www.sreal.com/~div/midi-utilities/

A format conversion to MIDI type 0 program would look something like
this (not tested - meant as primitive sketch).


#include "midifile.h"
int main(int argc, char **argv)
{
  MidiFile_t myMidiFile = MidiFile_load("some_path_to_midifile");
  MidiFile_setFileFormat(myMidiFile, 0);
  return MidiFile_save(myMidiFile, "some_other_path_to_midifile");
}


Look at the other utilities and their Makefiles to see how to add
this to the whole set. Or just create a project on your own.

Of course you could add some cmdline parameter handling to parameterize
filenames, format and you could add other stuff like changing resolution
etc.

HTH,
Michael
------------------------------------------------------------------------

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
------------------------------------------------------------------------

_______________________________________________
Rosegarden-user mailing list
Rosegarden-user@lists.sourceforge.net - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-user
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Rosegarden-user mailing list
Rosegarden-user@lists.sourceforge.net - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-user

Reply via email to