Difference between revisions of "Quicktime"

From CCARH Wiki
Jump to navigation Jump to search
(Created page with " Playing MIDI files in recent versions of OS X is complicated... Here are instructions for getting everything set up. The main problem is that QuickTime Player 10 (and later)...")
 
 
(4 intermediate revisions by the same user not shown)
Line 16: Line 16:
 
configuration for your computer:
 
configuration for your computer:
 
       http://support.apple.com/downloads/#quicktime
 
       http://support.apple.com/downloads/#quicktime
 +
or
 +
      https://support.apple.com/kb/dl923?locale=en_US
  
 
(2) After installing QT Player 7 from the .dmg download file, you will
 
(2) After installing QT Player 7 from the .dmg download file, you will
Line 51: Line 53:
  
 
If your MIDI file is correct a playing console should appear and you
 
If your MIDI file is correct a playing console should appear and you
can click on the play button to listen to the file.
+
can click on the play button to listen to the file:
 +
 
 +
[[Image:Twinkletwinkle.png]]
 +
 
 +
 
 +
== Converting MIDI into MP3 files ==
 +
 
 +
Alternatively, you can convert MIDI files to MP3 files for easier playback of the MIDI files in a audio player.  One way is to use [https://sourceforge.net/projects/timidity timidity] to convert the MIDI file to audio, such as a WAVE file, and then use [https://lame.sourceforge.io/ lame] to convert the WAVE file to an MP3.
 +
 
 +
To do this in MacOS, install [https://brew.sh Homebrew], and then install these two packages:
 +
 
 +
  brew install timidity lame
 +
 
 +
Then to convert a MIDI file into an MP3, run the command:
 +
 
 +
  timidity file.mid -Ow - | lame - -b 64 file.mp3
 +
 
 +
where "-Ow" means create a WAVE file.  This is then passed to lame, and "-b 64" will create a 64 kbit/sec/chnanel MP3 file.
 +
 
 +
 
 +
Once timidity and lame are installed, you can use the following script to convert MIDI files to MP3 files without needing to remember the command options:
 +
 
 +
<pre>
 +
#!/usr/bin/perl
 +
use strict;
 +
chomp (my $timidity = `which timidity`);
 +
chomp (my $lame = `which lame`);
 +
die "Cannot find timidity command\n" if $timidity =~ /^\s*$/;
 +
die "Cannot find lame command\n" if $lame =~ /^\s*$/;
 +
foreach my $file (@ARGV) {
 +
my $base = $file;
 +
$base =~ s/\.midi?$//i;
 +
next if $base eq $file;
 +
print "Converting $file...\n";
 +
my $result = `timidity $file -Ow -o - 2> /dev/null | $lame - -b 64 $base.mp3 2> /dev/null`;
 +
}
 +
</pre>
 +
 
 +
For example, save to "/usr/local/bin/midi2mp3" and set the permissions:
 +
 
 +
    chmod 0755 /usr/local/bin/midi2mp3
 +
 
 +
and then to convert a MIDI file:
 +
 
 +
    midi2mp3 file.mid
 +
 
 +
To convert all MIDI files in a directory:
 +
 
 +
    midi2mp3 *.mid

Latest revision as of 00:47, 30 January 2020

Playing MIDI files in recent versions of OS X is complicated... Here are instructions for getting everything set up.

The main problem is that QuickTime Player 10 (and later) which comes with OS X Mavericks (and later; or version 9 or even perhaps version 8) does not play MIDI files. Any MIDI file you give it will cause the QT Player to choke, both correctly formed MIDI files as well as MIDI files with errors in them.

To solve the problem, you must installed QuickTime Player 7 and then associate QT Player 7 with MIDI files. Here are the installation steps:

(1) Download QT Player 7 from this website, choosing the correct configuration for your computer:

     http://support.apple.com/downloads/#quicktime

or

      https://support.apple.com/kb/dl923?locale=en_US

(2) After installing QT Player 7 from the .dmg download file, you will need to associate MIDI files with QuickTime 7 rather than v10. To do this is a long involved process:

(2a) Go to the File Browser and select a MIDI file.

(2b) Then type command-i to open up information about the file.

(2c) For the "Open with..." field in the window that comes up, select "Other..." and choose /Applications/Utilities/QuickTime Player 7.app

(2d) Click the box "Always Open With".

(2e) Press Add.

(2f) Press the "Change All..." button in the command-i window.

(2g) And then press "Continue" to finally associate QuickTime Player 7.app with MIDI files.

Now you should be able to open MIDI files in QT Player 7 by either of these two methods:

(1) Double click on them in the file browser. (2) In the terminal, you can type

        open file.mid

where "file.mid" is the name of the file you want to listen to.

If there is a syntax error in your compiled MIDI file, QT Player 7 will display the unhelpful error message:

    "The movie could not be opened.  The operation couldn't be
     completed. (OSStatus error -208.)"

If your MIDI file is correct a playing console should appear and you can click on the play button to listen to the file:

Twinkletwinkle.png


Converting MIDI into MP3 files

Alternatively, you can convert MIDI files to MP3 files for easier playback of the MIDI files in a audio player. One way is to use timidity to convert the MIDI file to audio, such as a WAVE file, and then use lame to convert the WAVE file to an MP3.

To do this in MacOS, install Homebrew, and then install these two packages:

  brew install timidity lame

Then to convert a MIDI file into an MP3, run the command:

  timidity file.mid -Ow - | lame - -b 64 file.mp3

where "-Ow" means create a WAVE file. This is then passed to lame, and "-b 64" will create a 64 kbit/sec/chnanel MP3 file.


Once timidity and lame are installed, you can use the following script to convert MIDI files to MP3 files without needing to remember the command options:

#!/usr/bin/perl
use strict;
chomp (my $timidity = `which timidity`);
chomp (my $lame = `which lame`);
die "Cannot find timidity command\n" if $timidity =~ /^\s*$/;
die "Cannot find lame command\n" if $lame =~ /^\s*$/;
foreach my $file (@ARGV) {
	my $base = $file;
	$base =~ s/\.midi?$//i;
	next if $base eq $file;
	print "Converting $file...\n";
	my $result = `timidity $file -Ow -o - 2> /dev/null | $lame - -b 64 $base.mp3 2> /dev/null`;
}

For example, save to "/usr/local/bin/midi2mp3" and set the permissions:

    chmod 0755 /usr/local/bin/midi2mp3

and then to convert a MIDI file:

    midi2mp3 file.mid

To convert all MIDI files in a directory:

    midi2mp3 *.mid