hitmill.com
link to hitmill.com home page

 

HTML Sound Tutorial
Bringing Sound to Your Web Page


 
Code for HTML sound tags, how to have sound on your Web page. A free tutorial with code examples for coding HTML sounds and linking to sounds, as well as how to play an audio file as the Web page is loading. Related links are displayed for further exploration of this topic.

 
 

 

 
Try to code your music into your pages so that the music is NOT FORCED onto the user, but so that the user may choose whether or not to listen. This is just one of the courtesies of the Web. Embedded music plays automatically so the user has no choice. This is rude to force upon a user.
Notice:
Music on the web is copyrighted and you should have permission of the holder of the copyright before using music on your web site. If the music is in the public domain it is free to use on your site.
To code sound for your web page you may code <A HREF="filename.ext"> where .ext is the 3-letter abbreviation of the file format. The sound link may be included in paragraphs, tables, or just about anywhere on the page.
Placing music link on your Web page
SAMPLE CODE:
<A HREF="myfile.mid">My Song</A> is the code you would use to place a midi or other audio file wherever you want it on your Web page. If the file size is known, include that information. See the sample link above the image of the French horn, or
click directly on the image. I coded the image to play music when you click on the image.
Image-Link which plays music
To code the music file associated with an image:
<A HREF="myfile.mid"><IMG SRC="mypicture.jpg" BORDER="0" ALT="describe picture and/or music here"></A>
The image on this page is linked to a .MID file. To hear the file play, you click on the image of the French horn.

 
Logos and graphics on this page are copyrighted by Real.Com, QSound.Com, LiveUpdate.Com, and HiTMilL.Com and may not be used on on your pages without the wwritten permission of each individual copyright holder.
Embedding Sound: A Bad Idea?
Embedded Sound is a sound file that plays automatically when the page loads. The user has no control over whether they want to hear that file or not, unless they shut off the speakers. From my own experiences and feelings, I would rather have a choice, have a link I could click on to hear a sound file rather than having it forced on me, without any choice in matter. If you embed sound into your HTML code, do not be surprised if you get "flamed" in e-mail. Early versions of one of the major browsers would not even support the <EMBED> tag but here goes (you have been forewarned):
<EMBED SRC="filename.extension" WIDTH=145 HEIGHT=100 AUTOSTART="true">
SRC="filename.extension" is pretty straight-forward. That is the name of your music file and the proper extension for your particular file. If it is a MIDI file named Sunset then you will code <EMBED SRC="Sunset.mid" WIDTH="145"   > and the rest of the information will be coded as the <EMBED> example above.
 
Width, height, and autostart are all required parameters for the control that will be displayed when the page loads. This code should be coded immediately after the body tag if it is to be played automatically upon page load. Many users would rather that you coded the music file as above, so they have a choice whether to hear it or not. I have only included the code here, in response to several requests from students asking how to embed sound files into HTML code. AUTOSTART = "false" would display the control on page load but the user would have to click on the control to hear the file. It would be better again, if this is the case, to code as above in the first example without using the <EMBED> tag, to have better browser support and to allow user decision.
Related Links: More HTML Sound Tutorials
Sound Archives

 
Products, Plug-Ins, and Software

 
Miscellaneous Audio and Sound Links


 
Cred-It Complete Web Solutions, Search Engine Optimization, Site Design, Credit-Card Billing Incorporated into Site. See the full list of services offered.
 

 

 

 

 

 
Contact
 
Updated 12 Dec 2012
© hitmill.com
All Rights Reserved