“Music, the greatest good that mortals know,
And all of heaven we have below.” … Joseph Addison
Depending on the subject matter of your blog, having music played in the background may either enhance the pleasure of reading or annoy your visitor. Imagine the agony of surfing the web in discreet, only to catch the attention of your office colleagues or parents when the music automatically blasts off in the background. Not to mention, a big music file may cause a slower page download. Nevertheless, the solution, as shall be explained later, is simple – have an option for the reader to play or stop the music.
To begin, you will need to have a music file uploaded onto a server. You can read about using free hosts like Google Page Creator and Google Groups. We have also a rather comprehensive list of free Image Hosts and File Hosting Services in our article on Manage Blogger Image Storage Space. Check out those sites and choose one that is fast, reliable and enables hotlinking to the uploaded files. Upon uploading, note down the URL of the file.
Alternatively, there are several sites that offer free download of their music files. You can enter search words like “free music download” or search for a popular artist name in the Google search box. Most of the sites that offer free download will lead you to the file location stored in their servers. Copy the URL of the music file that you have chosen.
If you would like to hear how the music works on your Blog, you can also use this music file which we have uploaded onto Google Pages – http://ownlblog.googlepages.com/BalladePourAdeline.mid – whenever you are prompted to enter the “URL of music file”. This file is for testing purposes only. Please do not link permanently to this file as it may be changed or deleted in due course.
Next, you would have to decide how you want the music to be played.
Link for reader to click
This is a text link. Your visitor can click the link if he wants to hear the music.
Music with a console
A music player console with controls of the volume, on and off buttons, would give your visitors a choice on how he wants the music played. With the code stated below, the music will not play unless the visitor clicks the play button.
The code to insert is this:-
autostart=”false” height=”40″ loop=”true” playcount=”2″ src=”URL of music file” width=”300″/>
For instance, using the following code:-
this is what you see:-
It will look different in IE and Firefox, depending on the installed plugins.
Note the following attributes and how they work on different browsers:-
1. Insert your URL of music file into the code.
2. The width of the example you see above is “300″. If you want it to be embedded neatly into your sidebar, the width should not be greater than the sidebar width. For example, if your sidebar width is 150px, the width of your console should be about 140px.
3. The height would depend on your preference and space constraints.
4. The autostart attribute has two options. If you choose “true”, the music will automatically play when your page is loaded. As I have mentioned earlier, this is not a good option unless you are absolutely sure all your visitors would not mind the music. The better option is to state it as “false”. If the visitor wishes to hear the music, he can click the play button to start the music.
Note, however, that while it works fine in Internet Explorer, it may not be so in Mozilla Firefox. The default setting for IE is “false” which means the music will not play automatically. The default setting for Firefox is “true”, and when we experimented with .wma and .wav files, they automatically played even when we set the autostart to “false”. If you are working on the Mac, the default setting for both browsers is “false”.
5. The loop attribute indicates whether the music should stop once that particular tune ends. The common attributes are “false” or “true”. If the attribute is “false”, the music ends after it is played once. If it is “true”, the music will automatically loop and continue playing until the visitor clicks the stop button or leaves your site. For short music pieces, you may want it to repeat and choose “true”.
For certain versions of Netscape browsers, another attribute that might work is loop=”n” where n is a number. If n is 2 for example, the music will play twice and stop. The similar attribute in Internet Explorer is playcount.
6. You can specify the number of times the music is to be played. In the above example, where playcount=”2″, the same piece of music is played twice before it stops. If you want the music to be played once, you can delete playcount altogether. Note that this only works in Internet Explorer.
Background music to play automatically
For the music to play the moment your page is loaded, the code will have to appear in the HTML document of your site. Note that in so doing, there are no controls for the visitor to choose whether or not to listen to the music, nor options to turn it off. Login to your Dashboard and under “Template”, click “Edit HTML”. Somewhere near the top, after the word , insert this code:-
URL of music file” width=”0″/>
Remember to insert the URL of music file into the code. There is no image of a console and readers cannot choose to turn off the music. Use this option with discretion.
The sound files can be in any format provided that your browser has the necessary plugin to play that file. Many people have problems playing MP3 files because their Firefox browsers do not have the necessary plugins. To check what your Firefox browser can support, enter this command into your browser:-
It will list all the installed plugins and the media files that can be played. If you need additional Mozilla Firefox add-ons, you can visit their Add-ons Page.
Top 10 Search Terms:
• music code for blog • music code for blogger • music for blogspot • free music code for blog • code music for blog • music code for blogspot • blogger music code • music blogspot • music for blogger code • free music code for blogspot