Site hosted by Angelfire.com: Build your free website today!
 

how to put music on a webpage

how can i add music to my web page?

music can be added to pages with the <embed> tag adding music to webpages can be problematic, some browsers need additional plugins and sometimes browsers cannot play the soundfile if the embed tag is in a table, but probably the biggest problem is that html coders reach a certain skill level and get to a stage where they start to think of adding whistles and bells to their code, or more acuratly start to think
"I'm gonna download the best mp3 on the web and let visitors to my webpage listen to it, oh no wait, what am i saying, 'let them listen to it', if i give visitors the option of listening to it they might miss it completely and never know what good taste i have, let alone what a good coder i am, i know, i'll make them listen to it !!"

the next stage is wondering why the webpage with the new 10MB mp3 takes so long to load and the the mp3 plays a small chunk of the song followed by silence followed by another small chunk of music then silence again and so on, and still the page has not loaded.

the clue to that is the 10MB filesize, it takes as long to load on the page as it did to download from the web, exept now the filesize of the page also has to be downloaded by the user.

only .mid music files of 25KB-50KB or less are used on this site

the embed html

below is the example html code for the embed tag
<embed src="soundfile.mid" hidden="false" border="0" width="310" height="45" autostart="true" autoplay="true" loop="true" volume="75%">

use the example html source code above to play audio on your webpage, here's a break down of the example html source code

how embed works

how the embed attributes work

src="soundfile.mid" the url of the file
(src="http://www.whatever.com/soundfile.mid")

hidden="false" shows the controls

hidden="true" hides the controls



width="310" height="45"
the dimensions of the control measured in pixels, play around with these

autostart="true" autoplay="true"
if set to true play automatically on load
autostart="false" autoplay="false"
if set to false do not play

loop="true" if false play once only, if true repeat constantly

volume="75%" set the volume as a percentage


sample midi: could you be loved [41KB] couldyou.mid


html tutorial


home
html tutorial css tutorial javascript webmaster articles link exchange

html tutorial

make money
from your website