Home PageJump to Jonal EntryHumorInspirationUse this address for help with your membership.
Good Morning Nanty Glo!
Tuesday, April 10 2001

A tangent: putting music on web pages

Tim McCullough asked on Sunday how to go about adding music to his web pages, and I thought enough of you might be interested in the answer to share it here. I've found there are a variety of approaches, so I'll mention several and provide details on the most common. In general, three types of computer files that recreate sounds can be played with web pages: midi files (ones that end with the extension .mid); wav files (.wav), and au files (.au). Moreover, any song or noise on a CD can be converted into a compressed file called an mp3 file (.mp3). Mp3 files, likewise, can be converted into wav files, so in theory, any sound that's on a CD can be put on the Internet. Furthermore, software to make these conversions can be downloaded from the Internet free from, for example, here (alternatively, you might type or copy "converting CDs into wav files" into the Google search field that's on the Home Page and see what you get).

The big issue is, how big is the file? If it's too big, a visitor to your page may move on to another page without ever hearing your sound, because it won't start playing until it has loaded into the visitor's computer with the web page, and that download may take a few minutes or even longer. This same principle works with photos and other webpage graphics; if they're too big, they may not be seen as you expect. In general, again, midi files are the smallest and therefore the easiest to add to the page effectively. Mp3s are relatively huge; typically, a whole song in mp3 format won't even fit on a floppy disk, so putting one on your web page would probably not be effective.

The rest of today's postcard will give basics of adding a midi file (the most compact and readily available, as well as most "legal" file format) to a page and provide sources of more information if you want to go beyond that. The first step is to find the midi file you want. As with anything on the Internet, many of these can be found by doing a Google or Alta Vista (or other) search. Entering "midi files" into the Google search field yields links to 446,000 pages! The first on my search was http://www.aitech.ac.jp/~ckelly/SMF.html, which also includes articles more thorough than this one about how to use midi files. That page, however, seems to concentrate on original compositions, which might be useful but on the other hand, you may be looking for a specific song that you already know. To narrow that down, add another keyword to the Google (or other) search. For example, "midi files, Christmas," or "midi files, patriotic," or "midi files, pop music." You can even specify a particular artist. I found one of the Backstreet Boys' hits (not their rendition, but the music for it) when I lived in an apartment complex in Los Angeles in which three of them also had a residence, and it was our theme song on the Home Page for that year.

Once you find a midi file you want to use, the next step is saving it onto your own computer. Just like any photo or other file ingredient on most web pages, you can save it with a few clicks of your mouse. For example, if you hover your cursor over the musical notes on the top right of the Home Page, and click the right mouse button, you'll see among the menu options, "Save Target As." Click that, and a file save sequence will begin. The fact that the Windows interface suggests a name ending in .mid indicates that you have the right file in line. At that point, or later (when you have the file on your own disk), you can choose to keep the present filename or rename it. Pages that have whole collections of songs usually make it even easier to save them.

Once you have the midi file you want to use, you have three choices for ways to use it on your page. You can make it invisible and self-starting, like the background music on our Churches Page. The hymn there plays with no control available to you, except to turn down your volume if you have one. The Allegheny Moon midi on the Home Page has to be launched by clicking the musical notes at the top right. A media player like the Windows Media Player or Realplayer will launch and play the file, and provides a range of options you can use, including pause, volume, and others. The midi on the Vintondale page and the .au file on the Blacklick page are embedded. They start to play on their own, but you can stop them by clicking the embedded portion of the player.

Finally, you have to make sure the audio file, like any picture file you are using on your webpage, is in the same directory as the webpage, on its server, rather than just on your own computer. You accomplish that the same way as you get the rest of your page's ingredients onto the server (or the "host" as it may be called by your service provider). The most commonly used way is file transfer (called ftp), but if you have a page of your own and there's another method, you should know how you do it!

The following lines of code show how each of the options is accomplished. These can be put anywhere on the page; experiment with what works best for you (noting that if you have Javascripts on pages, their top-level code must be in a specific place and must not be superseded by code like this). In general, it makes sense to put it near the top, to get it loading from the moment the page is opened.

1. Using a graphical link (the musical notes) to launch a media player (using the Nanty Glo Home Page as the example):
<a href="alegheny.mid"><img src="munote.gif" width="17" height="27" border="0" align="absbottom" alt="Play Allegheny Moon">

Here's what the code means: "a href" means "refer to." "alegheny.mid" refers to the midi file (Allegheny can be misspelled!). Img src= refers to the image source (the musical note, which is "munote.gif"). The sizes are the size of the image, which helps browsers open the page more quickly than when image sizes are not specified. "Alt=" refers to a line that visitors to the page can see if they hover their cursors over the munote.gif.

2. Using a self-launching interface with an off/on switch (the example is from the Vintondale page):
<embed src="redvalley.mid" width="70" height="25" align="absbottom" autostart="true" loop="6" alt="music"></embed>

Here, embed src= tells the browser that this is an embedded file which must be played through a media player, so the player will launch automatically. The sizes are the size of the media player interface. These are set for Windows media player, on which they work perfectly but they might be less than perfect if the page visitor has another player, like Realplayer, selecdted as his default media player. Here and below, "loop=" refers to the number of times the midi will replay before stopping.

3. Finally, "invisible and self-starting," as on our churches page:
<bgsound src="irish_hymn.mid" loop="5">

Note that the bgsound (background sound) option doesn't work on Netscape browsers, so their users will not hear your sound if you choose this route. Last I heard, about half of all web users still use Netscape, despite its refusal to keep up with developing browser technology.

And finally, you can refer to a sound source that is not on your server (as you can also do with photographs). The reason to be cautious about doing so is that the page on which you refer to it may eventually disappear or be moved, and your link will be broken. But if you don't want to save the midi file onto your own computer first and then to your server, you could make the play for the Nanty Glo file by using this code instead of the comparable portion of example 1 above:
<a href="http://www.nantyglo.com/alegheny.mid">

Most of these Jonal email letters are created using that approach. If they actually sent the photo background and other accoutrements, it would be too big to email.

Another reference: Adding background music to web pages.

Webmaster Jon Kennedy

The minds of this year's college freshmen (continued from yesterday)

Feeling old Yet? There's more:
This year's freshman class were born the year that Walkmen were introduced by Sony.
Roller skating has always meant inline for them.
Jay Leno has always been on the Tonight Show.
They have no idea when or why Jordache jeans were cool.
Popcorn has always been cooked in the microwave.
They have never seen Larry Bird play.
They never took a swim and thought about Jaws.
The Vietnam War is as ancient history to them as WWI, WWII, and the Civil War.
They have no idea that Americans were ever held hostage in Iran.
They can't imagine what hard contact lenses are.
They don't know who Mork was or where he was from.
They never heard: "Where's the beef?", "I'd walk a mile for a Camel," or "De plane, de plane!".
They do not care who shot J.R. and have no idea who J.R. was.
The Titanic was found? They thought we always knew.
Michael Jackson has always been white.
Kansas, Chicago, Boston, America, and Alabama are places, not rock bands.
McDonalds never came in styrofoam containers.
There has always been MTV.
They don't have a clue how to use a typewriter.
Do you feel old yet?

Sent by Trudy Myers

Holy Week readings (from the Gospel account of the last week of Jesus' earthly ministry)

  When the Son of man shall come in his glory, and all the holy angels with him, then shall he sit on the throne of his glory: And before him shall be gathered all nations: and he shall separate them one from another, as a shepherd divides his sheep from the goats. And he shall set the sheep on his right hand, but the goats on the left.

Then the King will say to them on his right hand, "Come, you blessed of my Father, inherit the kingdom prepared for you from the foundation of the world. For I was hungry, and you gave me meat. I was thirsty, and you gave me drink. I was a stranger, and you took me in, naked, and you clothed me. I was sick, and you visited me. I was in prison, and you came to me."

Then shall the righteous answer him, saying, Lord, when did we see you hungry, and fed you, or thirsty, and gave you drink? When did we see you as a stranger, and took you in, or naked, and clothed you? Or when did we see you sick, or in prison, and came to visit?

And the King will answer, "Truly I say to you, Inasmuch as you did it to one of the least of these my brethren, you have done it to me." Then shall he say also to them on the left hand, "Depart from me, you cursed, into everlasting fire prepared for the devil and his angels, for I was hungry and you gave me no meat, I was thirsty, and you gave me no drink, I was a stranger, and you didn't take me in; naked, and you didn't clothe me; sick, and in prison, and you didn't visit me."

Then shall they also answer him, saying, "Lord, when did we see you hungry, or thirsty, or a stranger, or naked, or sick, or in prison, and did not minister to you?"

Then he will answer them: "Truly, I say to you, Inasmuch as you did not do these things to one of the least of these, you didn't do it to me. And they shall go away into everlasting punishment: but the righteous into life eternal."

Gospel of St. Matthew, chapter 25:31-46

The Nanty Glo Home Page and all its departments are for and by the whole Blacklick Valley community. Your feedback and written or artistic contributions, also notification about access problems, are welcomed. Click here to reply.

To QUIT the Jonal email list, click here. | To JOIN or REJOIN the list, click here.

When subscribing or unsubscribing to the list, use the email address to which you receive mail.
No message text or subject are needed on the email.

Nanty Glo Home | Blacklick Township Page | Vintondale Page