Please note: This material is adapted from Apple Computer's QuickTime tutorial pages at http://www.apple.com/quicktime/products/tutorials/. It has been adapted to include information related to the use of this technique with MIDI files converted to QuickTime movies. In this tutorial you will create a QuickTime movie containing a MIDI file of Bach Invention 11. As the MIDI file plays web pages containing the music notation will appear in time with the music. The completed example can be viewed in this new window (click here). Note that the completed example uses frames to display the QuickTime MIDI file in the top frame with the notation pages appearing in the bottom frame. View the source code of the completed version.
A standard MIDI file of the Bach invention should be downloaded to a folder on your hard drive to complete this exercise. You should convert the standard MIDI file to a QuickTime movie using MoviePlayer 2.5.1 or QuickTime Player Pro.
For your reference, a graphic of the complete notation file is available in gif format here.
An HREF track is a special type of text track that adds interactivity to a QuickTime movie. HREF tracks contain URLs that can specify movies that replace the current movie, that load in another frame, or that load in QuickTime Player. They can also specify JavaScript functions or Web pages that load in a specific browser frame or window.
An HREF track is not meant to be displayed, unlike other types of text tracks; it simply contains link information. The URLs in an HREF track can be interactive or automatic. An interactive URL loads when you click anywhere in the movie's display area. An automatic URL loads as a movie is playing at the exact frame specified by a text descriptor timestamp in the HREF track. With automatic URLs, you can create a narrated tour of a website, use web pages as slides in a presentation, or do anything else that requires loading movies or web pages in a predetermined sequence.
Adding an HREF track to a movie is similar to adding a chapter list. Heres how to do it:
Type a list of URLs into a text editor such as SimpleText, using the HREF syntax described at left. Each text sample line should end with a carriage return. If you want to deactivate the last URL, add a blank URL (an extra carriage return) at the end of the list as described above. Save as a plain text file. See the special instructions on the left for the example MIDI file we will use in this exercise.
|
HREF Syntax
The syntax for an interactive HREF track text sample is: <URL> T<frame> (You must click on the movie frame to link to the URL.) The syntax for an automatic HREF track text sample is: A<URL> T<frame> (The A term indicates that the URL is automatic.) In the HREF track, an example would be: [00:01:30.15] A<http://www.apple.com> T<myframe> This automatically loads an HTML frame called "myframe" with the URL "http://www.apple.com" at 1 minute, 30.5 seconds into the movie. The URL can be relative or absolute for the QuickTime Plug-in (absolute only for QuickTime Player), but note that a relative URL is relative to the movie, not to the web page that contains it. The URL can also be a name of a JavaScript function in the current HTML page; loading the URL executes the function. You can also pass parameters or actual JavaScript code this way. Special Instructions for MIDI file exercise Here is an example of a text file created to contain the URLs of several pages with music notation excerpts to go along with bach invention 11. The A stands for ANCHOR which creates a link to a web page. The T stands for TARGET and designates a target frame (in this case one called "nframe") in which the URL will load. Create this file in BBEdit or another text editor and save it as hreftrack.txt. A<bach1101.html> T<nframe> A<bach1102.html> T<nframe> A<bach1103.html> T<nframe> A<bach1104.html> T<nframe> A<bach1105.html> T<nframe> A<bach1106.html> T<nframe> |
In QuickTime Player (or Movie Player 2.5.1), choose Import... from the File menu and select the text file. Click Convert to convert the file to a text movie.
Choose Export... from the File menu. Set the Export pop-up to Text to Text and set the Use: pop-up to Text with Descriptors. Click on the Options... button. In the Text Export Settings dialog, choose the Show Text, Descriptors, and Time option, choose Show Time Relative to Start of Movie, and set fractions of seconds as 1/1000 (the default is 1/1000). The alternative is to set fractions of seconds to 1/30 but that does not work with MIDI files. Click Save to create a text file with descriptors. You might call it "hreftrackdescriptors.txt".
You now need to open several windows so you can work with text, tracks, and movie controls at the same time. Open the exported list in your text processor. Open the target movie in MoviePlayer 2.5.1 or QuickTime Player. If using QuickTime Player, open QuickTime Players Controls drawer by clicking the button with four dots on it. Finally, choose Get info from QuickTime Players Movie menu, choose Movie from the Tracks (left-hand) pop-up, and choose Time from the Properties (right-hand) pop-up. Your screen should look something like the picture below.
In QuickTime Player (Movie Player), find the frame in the movie where you want to load the first URL. Use the frame controls to step forward or backward a frame at a time as needed. Note the time in the Info window.
In the text file, find the first URL. It has a time stamp just before it that should look something like [00:00:00.000]. Change that to the time you noted in the Info window. Make sure that each URL is given a duration of at least half a second, so that it wont be skipped if your computers gets behind during playback.
Continue editing the timestamps preceding each URL, modifying them to match the timestamps of the frames when the URL is to load. Modify the last timestamp in the text file to match the duration of the movie.
Import the text file into QuickTime Player (Movie Player). This creates a new movie with just a text track. Choose Select All from the File menu, then Copy. Close the movie.
Click on the main movie (the one with the MIDI file in it). Select All. Add Scaled (by pressing Ctrl-Alt-Shift (windows) or Option-Shift (Mac), then selecting Add Scaled from the Edit menu). This adds the text track to the movie and makes sure it is exactly the right length.
In the Info window, choose the new text track in the Tracks pop-up. Click Change Name and rename the track HREFTrack exactly as shown (mixed upper and lower case, no space between HREF and Track).
Choose Enable Tracks from the Edit menu and disable the new HREF track, so it doesnt display on top of the video. It will still function as an HREF track.
Save as a self-contained movie. Call it "Bach11.mov".
Finally, create a simple two-frame web site with a page containing the embedded "Bach11.mov" in the top frame and a bottom frame to contain the web pages with notation graphics. The notation graphics can be created in any music notation program and dumped onto the hard drive using the screen capture technique (Apple-Shift-4). Once on the hard drive they can be opened in AppleWorks or any graphics program and converted to jpg or gif format.
The optional T<frame> parameter indicates a target frame or target window in the movie. If a target is specified, the URL is loaded into the specified frame or window.
One special instance of the T<frame> parameter is T<myself>. This opens the URL directly in QuickTime Player or the QuickTime plug-in. The URL replaces the playing movie. The URL must point to a file type that QuickTime can handle. Use T<myself> to link a series of QuickTime movies into a single virtual movie over the web.
Another special instance of the T<frame> parameter is T<quicktimeplayer>. This is normally used to launch a movie in the QuickTime Player application from a movie embedded in a web page. Again, the URL must specify a file or stream that QuickTime can play.