<bgsound src="winniethepooh.mid" loop="6" />


SOUND TAGS FOR MSNTV & COMPUTERS

Please note: All sound tag tests were done with a MSNTV Sony Plus and a Philips Magnavox Plus and the 2.6.1 and 2.7 and 2.8.1 and 2.9 updates, enhanced by advice from friends who use computers. Last updated: May 11, 2005.

NOTE: The following tags have been updated to conform to the future standard of HTML that requires all tags be closed. Notice that this is done with sound tags, which previously have not required closing tags, by inserting a space and then typing /> at the end of the info inside the tag.

This is the simplest tag to use. All you need to type is the following:

This tag will cause the midi to play one time from start to finish as soon as the page loads. There will be no visible clickable buttons to use to start and stop the sound.

If you wish to have the song play longer than one time through, then you must add the loop attribute to the tag. You can specify the number of times you want the midi to play, using a number such as "2" or "3":

EMBED TAG FOR MSNTV & NETSCAPE

Now we'll consider the embed tag. Both of these tags will work with MSNTV, but if your page is also for computer users, you must use BOTH of these sound tags! (see below) Let's start with the basic tag:

If you use the embed tag by itself with no attributes added, a clickable button will appear. These words (in light green text) will apear above the button: Select to start. Clicking the button will produce the song. But suppose you want the sound to start automatically with no button showing? Then you must add these attributes:

You may also add the loop attribute, as with the bgsound tag. It works exactly the same as it does in the bgsound tag. Some people close this embed tag for sound. With MSNTV it is not necessary, but you may use it if you wish. Its use seems mandatory when writing for computer viewers:

</embed>

I have tested the loop="-1" attribute with all the sound file types: au (.au), midi (.mid), mod (.mod), Rich Music Format (.rmf), s3m (.s3m) and wav (.wav), except for the Real Audio. All sound file types listed above work with the loop="-1" for MSNTV, but not for some computer browsers. So it is best to use a number, like "2" or "6" instead.

PLACEMENT OF SOUND TAGS ON PAGE

Since users of MSNTV ought to put a Javascript reload warning on their pages to counteract the MSNTV JS bug that plagues the browser, please note the following:

After the body tag, place the reload tags. THEN place the sound tags. If you place the sound tags before the reload warning tags, then MSNTV users MAY have to reload more than once to make the sound play! This has been happening with the 2.7 update.

NOTE: Since computer users will see your reload warning, and will not be able to see MSNTV pages properly if you have used the gradient color and audioscope tags, it is best to also suggest to a computer user to download the MSNTV Viewer, so they can see your page properly. The url for the MSNTV/WebTV Viewer is http://developer.msntv.com/Tools/WebTVVwr.sp

PRELOADING: You can also put the sound tags between the <head> and </head> tags of the page. In my experience, this helps the sound to load faster. But there are other MSNTV users who disagree with this. If you don't put the sound tag in the <head>, then place it right after the body tag and the bug warning. Browsers load pages from the top to the bottom.

SOUND TAGS FOR COMPUTERS

If you are making webpages to be viewed by computers as well as by MSNTV, you must use both sound tags, one right after the other. Some browsers will read one tag, others will read the other and ignore the first. The bgsound tag works as above, with the exception of the loop attribute. For both the bgsound and the embed tags, instead of using "-1" for the loop, you must use a positive number (no minus sign), if you want the song to repeat.

With the embed tag, you should also use the attribute called "hidden." Some versions of Internet Explorer will produce a pop-up control panel in the middle of the screen if you leave out the hidden attribute! So here's what you'll be putting on your page if you want computer users to hear music while they are reading your page:

It is necessary to use the noembed tags around the bgsound src tag, since Netscape does not translate this tag. Netscape will just ignore what's between the two noembed tags, while earlier versions of Internet Explorer will read this bgsound src tag. The sound tag that Netscape uses is the embed src tag.

HOWEVER, it seems that the more recent version of Internet Explorer can read the embed sound tag! Let's hope that eventually we'll have to use only the embed tag and can drop the bgsound tag.

A JAVASCRIPT CODE FOR SOUND FILES

Here's another solution to the problem of getting the different browsers to play the music file: This uses JavaScript. One problem, though. For MSNTV, if the JavaScript bug hits, the viewer won't hear anything. With computer users, sometimes they have the JavaScript turned off in their browsers. So if you choose to use this JS solution, then it's a good idea to also put the following warning on your page:

"If you hear no sound, reload, or enable JavaScript in your browser."

Below is the JS in a text box ready for copying:

WAV, AIFF & AU FILES FOR COMPUTERS

With MSNTV and with the computer browsers that recognize the BGSOUND tag, wav, aiiff and au files will loop according to specifications. But for computer browsers, no matter how low you set the number of loops for the EMBED tag, a wav, aiff or au sound file will loop endlessly! We are indebted to Tom Landum for supplying a Javascript solution that works for both MSNTV and computer browsers. For a song wav file, the number of times the song will loop doesn't matter so much. But if you have a wav, aiff or au file of a specific sound, like a duck quacking, you may want the quack to sound only 3-4 times, not endlessly.

These settings are for a wav sound file that lasts for 3 seconds (3000 = 3 seconds). In this script, each 1000 equals one second. Notice that each setTimeout is 3000 more than the previous setting. You must continue to add 3000 each time you add to the setTimeout, as the seconds are cumulative. You must time your wav (or aiff or au) sound file to get the proper number of seconds. Four seconds equals 4000, and so on.

SEQUENTIAL SONGS ON A PAGE

This works for computers with browsers that read the bgsound tag: Use one meta tag in the head for each ensuing song. Measure the number of seconds for each song, and add this to the number in the content attribute. Actual time is usually longer than the time entered, due to file loading time. Preloading the song urls makes the actual time nearer to this value.

For MSNTV you can have only ONE meta refresh tag in the head. If you put more than one meta refresh tag in the head, then the bgsound tag will play first, but only the last listed meta tag song will play next. The MSNTV browser ignores the other meta refresh tags.

For an example of two sequential sound files in action, go to "Hitchcock and the Chickens".

NEW! Ken a.k.a. Muddeshu's text file for sequential sounds
Ken's demo page
The demo page is blank, but you'll hear first one sound and then the next. This is a very simple JavaScript. Just add to the head and body tags whatever else you need for the page. Then proceed to build the page.

Cedesign's Sound Tute
Lots of examples, including the various buttons, start, stop, etc; plus all the codes to copy. I haven't tried some of these codes, so don't know whether they'll all work for MSNTV.

Tyhart's Tute for Sequential Sounds on a Page
Here's a JS script for getting more than two sounds per page for MSNTV. This method works fairly well. But due to the vagaries of how the MSNTV browser loads a page, sometimes a longer song will get cut off. But that's a small price to pay if you want more than two songs/sounds per webpage. This does not work with email or newsgroup posts.

CONTROL PANELS FOR MSNTV

MSNTV users can now put one or more control panels on webpages. Each panel will control one song: start, pause, stop and raise or lower the volume. For further information, go to Sound Control Panels.

UNZIPPING SOUND FILES FOR MSNTV

Domania's and the new Arbor File Managers have a feature, called G-zip, which does zip up (and unzip) sound, text and image files that the 2.7 and 2.8.2 MSNTV users can hear and see. Although The Zone does offer this feature, too, I am told that the server sometimes doesn't translate those files properly so they can be heard and seen.

The above File Managers also do the regular zipping and unzipping of files. I do not know about any other File Managers.

CONTINUOUS MUSIC FROM PAGE TO PAGE

Sammi has written an excellent tutorial on getting the same music to play continuously, without interruption, when a viewer moves from one page to the next on a website. This method uses frames, but never fear, her tutorial is very easy to follow and understand.

NEW! JAVASCRIPT FOR VOLUME CONTROL
ON WEBPAGES

In the onMouseOver line in the script, you can change the -50 to settings between that and +20 or so to increase the volume level. This is probably for computers only. I have not tested this to see if it works for MSNTV.

The above Javascript is from the Blue Fox's tutorial.

For a Javascript method that does work for MSN TV, please click here.

NEW! CELLOMAR'S INSTRUCTIONS

Cellomar's Websounds Page
Cellomar explains the differences among the various types of sound files. Below that is her explanation of how to add sound files to computer pages. Also check out the rest of her absolutely wonderful music site.

Tandem Tooters ~ ~ Table That Tune ~ ~ Flo's Music Pages
Tone By Tone Dot Net © 2005
Midi playing is "Winnie the Pooh"