Knowledge is good only if it is shared. As a new blogger, I have learned to change the Web template, and found out the tips, tricks, hacks, and tweaks of altering the Blogger template, customizing CSS, widgets, layout, blog design, inserting JavaScripts, HTML codes, Google AdSense, and other settings the hard way, through many trials and errors. For the purposes of this guide, I have started with the new “Minima” template. As I make the changes or learn something new, I shall document them. Before changing any template, please remember to save a copy of the current template. After editing the template, preview it, and save it when you are satisfied with the change. Hope this guide will help those who are finding the way around, just like me.

Search Tips for New Bloggers

Search World-Wide-Web

We have extended our month-long vacation by a couple of days. We shall be posting articles the moment we return. We noticed that Google had updated the Page Ranks. New bloggers who have been waiting anxiously for this can check their blogs' Page Ranks. We have the PR checker link in our SEO Tools - Search Engine Optimization article.

The blog we created recently in Aug 2007, Blogger FAQ and Help, has also got its first Page Rank, a PR4. All our blogs are now ranked:-

Tips for New Bloggers - PR6
Business Fables and Management Lessons - PR4
Famous Motivational and Inspirational Quotes - PR4
Blogger FAQ and Help - PR4

Thanks to everyone for the support!

Feb 25, 2007

Digg This Story

Add Music to Blogspot blog

This article is updated to address the difference in the way the code is interpreted by the different browsers, namely Internet Explorer and Mozilla Firefox. We have also included a sample music file which you can use to test the effects of adding the sound file to your Blog. As well, read our article on Flash Music Player and Music Playlists to add a playlist of several musical pieces or songs.

“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.

<a href="URL of music file">Click to hear music file</a>


Remember to enter the URL of music file into the above code. This code can be inserted into your Blog post. If you want to put it in your sidebar, you can go to Template -> Page Elements -> Add a Page Element, select HTML/JavaScript and insert the code. Whatever words you type into the “Click to hear music file” will appear as the text link.

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.

You can either insert the music console into your Blog post or your sidebar. If you want it in the sidebar, go to Template -> Page Elements -> Add a Page Element, select HTML/JavaScript.

The code to insert is this:-

<embed autostart="false" height="40" loop="true" playcount="2" src="URL of music file" width="300"/></embed>


For instance, using the following code:-

<embed autostart="false" height="40" loop="true" src="http://ownlblog.googlepages.com/BalladePourAdeline.mid" width="300"/></embed>


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 <Head>, insert this code:-

<embed autostart="true" height="0" loop="true" src="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.

Troubleshooting

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:-

about:plugins


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.


Further reading:


If you are looking to have a video clip or movie file added to your blog or template, you may check out our other article Add video clip to Blog. We have also written a guide on how to add a music player to display a music playlist and allow readers to select and play the music they want to hear.

© Tips for New Bloggers

Found this article useful? Mention us in your post, subscribe to our feed, link to us, or bookmark this site. Thanks for your support!AddThis Social Bookmark Button

40 comments:

Women on the Verge said...

Help! I love your info, but I have a file that I burned onto a cd from itunes. I uploaded it and it saved as a .cda. When I try to use it in the media player code, all I get is the square full of shapes that I dread....

Nicole said...

I just started a blog in January, and have been frustrated trying to figure out how to spice up the template and "make it my own". I'm lovin' your blog right now, and have learned a ton of really neat things! Thank you!

Janey Loree said...

I've bookmarked your blog already! I came to welcome you to BLOG VILLAGE and found a plethora of blogging tips. Thanks for joining!!

Marsha said...

hello, I came here from blogvillage. I love your blog. I cannot wait to weed through all your tips and tricks. I have been teaching myself this stuff too, so I cannot wait to learn more.

bizwhiz said...

Thanks to all for your encouraging comments. Visited your nice blogs and bookmarked them too :)

I have also sent to "women on the verge" an email explaining what .cda format is about, and how it can be converted to other other formats. Do let me know if I can be of further help.

Hedi said...

I'm wondering if there is a trick that enables a sound when you point the mouse over an object (link) for example.

Vin said...

it's people like you who make the web a better place...it's great that now I have a single point from where I can learn so much! Thanks

TDR said...

Your blog spot is great, very useful advices.
But I have trouble with playing music
in firefox. I done everything like you said but it says: Additional plugins are required... and when I click it ti says: No suitable plugins were found.

bizwhiz said...

Hi TDR

It would appear that you do not have the plugin to play that media type which you installed.

To check whether you have that in your Firefox, enter about:plugins into your browser. You will see a list of media files that are supported.

The common one that has problem is usually Windows Media Player, for obvious reasons. You can install it by visiting the Mozilla add-ons page -
https://addons.mozilla.org/en-US/firefox/browse/type:7

For further info and discussion on the Windows media in Firefox, you may also read the discussion at -
http://forums.mozillazine.org/viewtopic.php?t=206213

Stevens8204 said...

Great stuff indeed....even as a semi experienced blogger...I learn something new every time I read...which helps...a lot. You are linked up on The NHL Arena Program and your site is a valuable asset to all bloggers everywhere.

You And Me said...

hai..

i want to add music background in my blog, but after i paste the code,i can't save my HTML coz the blogs needs some plugins again, and error command in the code.

how fix it ???

thanks

fruit said...

hi 10x for the tip. can i make playlist?

bizwhiz said...

Thanks for all the feedback. I have updated this article and addressed the concerns relating to the application in different browsers.

Yes, fruit. We will be writing an article on song playlist.

fruit said...

cool!!

what can i do when the song Stuck,
its because the steaming or something else?

bizwhiz said...

Hi Fruit

Probably so. Depending on the size of your song file, it may take a while to download. Some browsers are configured to play bits of it while it is being downloaded, a process called streaming. Sometimes the data is not sent quickly enough to the receiving side and the sound will not be smooth.

fruit said...

someone told it because the Server that i uploud the song, thet is right?

10x again :-)

SOPHIE said...

you are my new best friend :) - ive totally learnt loads and had fun making all the adaptions... still have a few things to work on but im sure i will find answers somewhere on your page!! thanks for taking the time to make entries with such clear instructions - its massively appreciated :)

Kimmo said...

An easy way to add music to a blog is Sonific's songspots Widgets. For instance with blogger it's a 5 second task. Check examples from http://songspotting.blogspot.com, and see the real action at http://sonific.com

shonari said...

Hey thanks for the info...really helpful. i have a problem thou. how do i add more than one song to the player? what addition do i need to make to the code and where?

thanks in advance

... said...

I am creating a new blog that will have links to the songs that our family singing group has recorded. I am having trouble uploading the .wav files to our blogspot blog. What do you suggest?

bizwhiz said...

Hi ...

Have you looked at the steps in this guide? They explain how you can link music files. But the music files cannot be uploaded onto Blogger. You would have to upload them somewhere like Google Pages or Google Groups or any other free server. After that, you can create the link or embed the sound file in your blog.

... said...

Thanks BizWhiz! I followed your suggestion to use my Google Page. I did have trouble saving my .wav file. It failed every time. After saving our songs as mp3 files, they uploaded to our Google Page just perfect! Thanks again for taking the time to put all this knowledge in one place!!!

Ram Arvind Kotaru said...

It works...thnx.

l'étournelle said...

Thank you so much for your blogtips. They are very helpful. You're one of my favourite website.
I'll be also very interested in your article about song playlist.

JustJames said...

Hi from Spain! Thank you very much for the tips! Amazing! But I have two questions. May you answer if you have time enough?

1- How can I open the music link directly in a new page? I would like my (few) readers could listen the music while reading the blog.

2- How can I change the background of the music console? My blog's background is dark blue, and the console's background is white. Looks quite ugly! Is it possible?

Thank you so much in advance!!!
And good job!!!

bizwhiz said...

Hi JustJames

To open links in a new page, we can add a target attribute like this:-

<a href="URL of music file" target="_blank">Click to hear music file</a>

You can have a look at our Hyperlinks article to understand how the tag works.

The console follows the browser plugin. There are limitations like you mentioned. If music is an essential aspect of your Blog, you may want to try some of the 3rd party provider progs. They are free and the interface is customizable. We'll probably look around for some worthy ones and cover that in our post.

{[[[(m•g)]]]} said...

This was awesome. so straight forward and easy to use. Thanks so much

BayingAtTheMoon said...

Thank you SO much for that! Other sites made this so complicated I gave up. With you I had exactly what I wanted up and running in minutes!

Texas Liberty Lady said...

Thanks so much for this blog. I can't tell you how much I have done with my blog since finding it.

I am having a major problem though with background music. I paste code with my music url andthe entire thing shows up in the sidebar. No controls at all. Help and thanks again for wonderful tutorials.

bizwhiz said...

Hi Texas Liberty Lady

If you want to see a console, you will need to put in the embed code and not just a URL link. An MP3 file plays well in IE but Firefox may lack the plugin.

The other thing is that your main post column is not aligned. In your template, you have this:-

#main-wrap1 {
margin:15px 0 0 15p;

It should read this:-

#main-wrap1 {
margin:15px 0 0 15px;

aroengbinang said...

It works well, great tips! Awaiting the tips for having widget with playlist menu. Cheers.

Jess said...

Hi, I've followed your instructions
to add music (Background music to play automatically) onto my blog but I kept getting the following msg:

(We were unable to save your template
Please correct the error below, and submit your template again.
Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
XML error message: The element type "head" must be terminated by the matching end-tag "".
)

What could be wrong since I followed your code (added in my URL) exactly?

bizwhiz said...

Hi Jess

You can try it without the </embed>

If you have problems with inserting it in the template, you can also insert the code into a "HTML/JavaScript" page element.

Jess said...

Thanks! The HTML/Java script method works! U're a godsend!!! :)

Catty Pants said...

You guys are awesome!

I know some famous bloggers out there that are unwilling to share their tips on how they make their blogs look so nice so to chance on a site like this is godsend!

I do have a question though about adding music to my blogsite:

I'm using Window's Vista and I've succesfully manged to add the page element but whenever I click it, it hangs and Window's Vista says something about colour imcompatibility and a white box appears in the centre of my screen!

I'm guessing that Vista isn't compatable with the plug-ins (whatever they are, you are talking about a real novice in computerin!) so what is the alternative?

Thank you and keep the fabulous job up! xox

Miles said...
This post has been removed by the author.
Miles said...
This post has been removed by the author.
bizwhiz said...

Hi Catty Pants

Which code did you add? Recheck for typo error. It is unlikely though that a 'color incompatibility' error is due to that. The next time you encounter an error message, try to note the full text and search in Microsoft support for the cause and solution to the problem.

Bungeegal said...

I'm confused the music works for a couple of hours when I log back in the next day, it disappears but the code is still there? Do you know what causes this to happen?

bizwhiz said...

Hi Bungeegal

If you enter that music URL into your browser, do you hear the music? If you don't, the URL is probably incorrect, or the site that you have uploaded to does not allow hotlinking, or the file is not for public access. Try uploading it onto another server.