Sue Ledoux
Developer Technology Engineer
Microsoft Corporation
April 2, 1997
The following article was originally published in the MSDN Online Web Workshop Magazine.
Tired of the deafening silence you hear as you surf through endless mute Web pages? Sick of waiting for WAV files to download? Bored with the same old MIDI files repeating over and over? No longer grooving on that cheesy FM synthesizer music coming out of your sound card? Despair no longer! The Microsoft Interactive Music control and the Microsoft Synthesizer will banish your silent-Web-page blues forever.
The Interactive Music control is an ActiveX component that you can use to create and play music dynamically on your Web pages. The music is played either directly through the MIDI synthesizer on the user's sound card or through the Microsoft Synthesizer, a wavetable synthesis component that is downloaded with the Interactive Music control.
Until now, the options available to Web authors for adding music to their pages were limited. They could download and play a WAV file, but if the sound was any longer than a few seconds, the download time required became prohibitive. MIDI files were much smaller, and generally a better solution when long-running or continuous background music was desired. But these still required a download for each separate MIDI file. Plus, an author had to hunt down that rare and expensive beast, the ultra-cool computer musician type, to compose the music for it.
Unlike those imperfect musical options of the past, the Interactive Music control is perfectly suited to Web authoring because it creates music on the fly, without using pre-authored WAV or MIDI files. It can even mix musical sound effects with the background music in response to a user action. End users will need to do a one-time download and setup of the control and synthesizer. When a user accesses a Web page making use of the Interactive Music control, only the style and personality files (the basic building blocks of the music that is generated) are downloaded. These typically range in size from 5K to 100K, but their size is fixed and does not depend on the length of the music generated from them. So users will no longer have to endure interminable waits to download each unique piece of music. Instead, they'll be able to experience an infinite variety of endless musical accompaniment and embellishments with only a few flashes of those little blinky modem lights.
The Interactive Music control generates music dynamically, using data stored in files and parameters specified by the author. The two kinds of files used by the control are the style (.STY) and personality (.PER) files. A style determines the genre and overall sound of the music, and consists of a pattern of notes and rhythms that define that particular style of music. The personality modifies the mood of the music and is used in conjunction with a style. There are currently 110 predefined styles and 27 personalities to choose from, and even more will be available in the near future.
Once you have chosen the style and personality of the music, you can set a number of parameters to further specify the kind of music you'd like played. The Interactive Music control uses all of these variables to create a unique stream of music (in MIDI form) that is sent to the Microsoft synthesizer or another installed MIDI device for playback.
The following table lists the variables that the author sets to control the sound of the music.
Table 1. Interactive Music control parameters
Parameter | Description |
---|---|
Style | A collection of notes, patterns and rhythms that fit a particular genre, such as jazz or rock. This information is stored in .STY files. |
Personality | Used to control the chord progression for the style you select. Personalities modify the mood of the music. This information is stored in .PER files. |
Band | The set of instrument sounds that plays the music. The bands available to you depend on the style you select. Each style contains one or more bands, but bands do not exist as separate files. |
Motif | A musical embellishment or sound effect played while the music is playing, often used in response to actions a user makes, such as clicking on a link. Styles contain motifs, but motifs do not exist as separate files |
Transition | Determines how the music sounds as it changes from one style to another, such as when changing to a new page. |
Length | The number of measures that the music lasts in a section. Measures are regular units of musical rhythm. The music can also be set to auto-repeat. |
Shape | Determines how the intensity of the style you select changes over time. |
Activity level | Describes how frequently the chords change. |
By changing the values of these parameters, the Web author can change the whole sound of the music. When the music changes, the Interactive Music control creates a smooth transition, controlled through the Transition parameter.
Typically, an author will change the music when the user moves from one Web page to another, but the change can be effected in response to any user-driven event, whether from intrinsic HTML controls such as buttons or listboxes, or from custom ActiveX controls. By tweaking the parameters given to the Interactive Music control, the author can create a dynamic and unique musical experience based on the contents of the pages and on input from the end user.
Now that you've been serenaded on the wonders of the Interactive Music control, let's talk about the Microsoft Synthesizer, which can be optionally used by the Interactive Music control to play back its generated music.
For years, MIDI authors have been struggling with the widely differing synthesizers that ship with PC sound cards. Windows® operating system multimedia finally made it possible to write one piece of MIDI playback code that would work on any sound card that had implemented a Windows driver. But Windows could do nothing to control how nice the sound actually was. Beautiful pieces of music that set hearts aflutter on high-end MIDI cards were barely recognizable on Johnny Enduser's inexpensive sound card with the super-cheap FM synthesizer in it.
With the Microsoft Synthesizer, the music will sound the same on all machines, regardless of the sound-card hardware installed. Instead of using the MIDI synthesizer on the sound card, which can vary widely, the Microsoft Synthesizer uses software wavetable technology. In this technique, the instruments referred to in a MIDI file are actually created in software by manipulating predefined wavetable samples. The whole thing then plays through the wave device instead of the MIDI synthesizer. Since there is little variation in wave-playback hardware, authors can now rest assured that the music Johnny Enduser hears sounds just the way it was intended.
The MIDI community recently defined a standard file format called the DLS (Downloadable Sample) format in which to store the wavetable data. The Microsoft Synthesizer supports this standard and can utilize any sound set that is defined using this format. As an added bonus, Microsoft has licensed the Roland Sound Canvas sound set, the world's most highly acclaimed wavetable sounds, which ship with the Microsoft Synthesizer. Web authors will be able to use this sound set royalty-free to make beautiful music on their Web pages.
How can you actually experience the thrill of Interactive Music? Well, if you're just Joe Netsurfer, and you're reading this out of curiosity, and you are not planning to author Web pages, do nothing. When you encounter a page that uses the Interactive Music control, you will be prompted to download the control if you don't already have it installed. If you're an author, you'll want to download the software components and the supporting materialsdocumentation, tutorial, sample code, and so on. Your choices are outlined in the following table.
Table 2. Interactive Music Authoring Components
Component | Download size | Description |
---|---|---|
Interactive Music Control | 2.2 MB | Interactive Music Control, software synthesizer, documentation, tutorial, sample code, authoring utility, style and personality files. |
8-bit DLS files | 1.4 MB | 8-bit versions of Roland Sound Canvas sound set. |
16-bit DLS files | 3.2 MB | 16-bit versions of Roland Sound Canvas sound set. |
All authors will need to download the Interactive Music control. Unless for some bizarre reason you're a diehard fan of FM synthesizer music, you'll want to use the Microsoft Synthesizer as well. The synthesizer is included in the Interactive Music control download, but the Sound Canvas sound set that is needed for the synthesizer must be downloaded separately. The 8-bit version of the sound set is useful if limiting download size is crucial, but for the best sound choose the 16-bit version. Note that the bit depth designation refers to the size of the data that is given to the software synthesizer for processing, and does not define the ultimate output. Both sound sets will play back on either 8-bit or 16-bit sound cards.
These components are available for free download (as self-extracting .EXE files) on the Microsoft Interactive Music Control home page.
The Microsoft Interactive Music control and the Microsoft Synthesizer were designed for computers running Microsoft Windows 95 or Windows NT® 4.0 and using Microsoft Internet Explorer, version 3.0 and above. The control can also be used with Netscape Navigator, so long as you use the NCompass ScriptActive conversion utility on your Web pages. NCompassLabs provides step-by-step instructions on how to do this. However, Netscape does not guarantee that NCompass works with Netscape Communicator 4.x, the Interactive Music control should be considered incompatible with Netscape Communicator 4.x.
You might want to tell author Sue Ledoux how much you really, really liked this article. Besides being one of the Great White North's finest gifts to developer technology, Sue owns four incredibly large Rottweilers and one Labrador Retriever.
If you're a Web author, you can add the Interactive Music control to your Web page by using a high-level authoring tool such as Microsoft FrontPage, or by writing script directly in the HTML code for your page.
Either Visual Basic® Scripting Edition (VBScript) or JavaScript can be used, although the documentation and tutorial for the Interactive Music control emphasize VBScript.
The Authoring Setup includes a utility called Interactive Music Express. This nifty tool lets you audition combinations of styles, personalities, and other parameters in order to choose music appropriate for your application. Additionally, the utility will generate code, in your choice of VBScript or JavaScript, to create the music that you have selected.
Note that you'll need Internet Explorer to use Interactive Music Express, because it uses the HTML Layout Control, which is not supported by Netscape Navigator.
For more information on how to author your Web pages to use the Microsoft Interactive Music control and the Microsoft Synthesizer, check out the Microsoft Interactive Music Control home page . Here you'll find everything you need to get marvelous music to spring forth from your Web pages. Let the cacophony begin!
For technical how-to questions, check in with the Web Men Talking, the MSDN Online Web Workshop's answer pair.