# Midi Music on web pages



## wolfworx (Oct 2, 2001)

Recently noticed a problem with some of my website pages playing midi music. These are urls that have played the selections properly in the past. There has been no change in the html coding. I have been using lines similar to the following.

*addams2.mid*

I have discovered the problem on several computers using both Firefox and ie. Sometime the page will play and other times not.

On one url three pages play and one does not, but on another computer all four play and on a third none play.

Yes I have checked the sound output on all three computers.

Could this problem be the server at my site provider?

To repeat: This music played in the past and I have not modified the code.


----------



## Elvandil (Aug 1, 2003)

Probably not much help, but if the HTML hasn't changed, then maybe something else has, like security updates in the browser or the firewall settings.

I have noticed, for example, that images may fail to load on some web pages when changes are made in the connection settings, like the MTU or receive window. Anything like that changed lately?


----------



## wolfworx (Oct 2, 2001)

No such change that I am aware of. Also I have just tried on a fourth computer. It produced the music at the site in the past but now, nada.


----------



## sepala (May 20, 2010)

Agree with others. Apart from that, modern browsers have more support to HTML 5 AUDIO tag, rather than this.


----------



## wolfworx (Oct 2, 2001)

Problem is standards and consistency. When you create a web page you need that features work for a reasonable percentage of the visitors. I had to go back and eliminate hover buttons on my web site because not all visitors could use them.

regarding this code:

<style type="text/css">

.image-swap-1 {
width: 256px;
height: 256px;
position: relative;
padding: 0;
margin: 0;
line-height: 256px;
vertical-align: middle;
text-align: center;
}

.image-swap-1 em {
display: block;
width: 256px;
height: 256px;
position: absolute;
top: 0;
left: 0;
background: url('mouseover-images/thumbs.png');
background-position: left;
}

.image-swap-1 a:hover em {
background: url('mouseover-images/thumbs.png');
background-position: right;
}

This code did not make hover buttons available to all users so I might have well as use simple graphics for button links.


----------



## namenotfound (Apr 30, 2005)

Try instead of


----------



## sepala (May 20, 2010)

sepala said:


> Agree with others. Apart from that, modern browsers have more support to HTML 5 AUDIO tag, rather than this.





namenotfound said:


> Try instead of


:up:


----------



## wolfworx (Oct 2, 2001)

Hmmm. Thanks for sticking with me on this. But the problem becomes more and more puzzling.

Firstly, I cannot get the audio tag to work.

Keeping with the embed tags on all pages

Computer #1 Vista with Firefox 8.0 : Music works on all pages
Computer #2 Win XP Home Firefox 7.0.1 Music works on all pages
Computer #3 Win XP Prof. Firefox 7.0.1 No music on any page
computer #4 Win XP Prof. Firefox 8.0 (wireless) No music on any page

All four computers access the internet through the same router to the same cable modem using the same internet provider.
I can play midi music file directly (off line) on all four computers
Internet sites with video and sound clips (YouTube, etc.) play sound OK on all four.

Evil gnomes at work???

My Halloween url is
http://www.wolfworx.com/hwn2005/


----------



## namenotfound (Apr 30, 2005)

Take the embed out of the head, and put it in the body. Does it work now?


----------



## wolfworx (Oct 2, 2001)

Nope. Same difference, alas!


----------



## Laxer (Aug 29, 2011)

I usually use javascript to handle my audio....

I find it easier to work with....

```
<script language="javascript" type="text/javascript">
function playSound(soundfile) {
document.getElementById("music").innerHTML= "<OBJECT ID=\"MediaPlayer1\" CLASSID=\"CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95\" CODEBASE=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab# Version=5,1,52,701\" STANDBY=\"Loading Microsoft Windows® Media Player components...\" TYPE=\"application/x-oleobject\" width=\"1\" height=\"1\"><param name=\"fileName\" value=\""+soundfile+"\"><param name=\"animationatStart\" value=\"true\"><param name=\"transparentatStart\" value=\"true\"><param name=\"autoStart\" value=\"true\"><param name=\"showControls\" value=\"true\"><param name=\"Volume\" value=\"-300\"><embed type=\"application/x-mplayer2\" pluginspage=\"http://www.microsoft.com/Windows/MediaPlayer/\" src=\""+soundfile+"\" name=\"MediaPlayer1\" width=1 height=1 autostart=1 showcontrols=1 volume=-300></OBJECT>";
}
</script>
```
Then just add an empty element inside your body tag like:

```

```
And now just link to the sound clips like so:

```
<a href="javascript:playSound(SOUNDCLIP.mid);">
```
If that's hard to follow an OP summed it up excellently here: How to make WMP invisible while playing audio


----------



## wolfworx (Oct 2, 2001)

I am beginning to think the problem is not with the html code at the server, but some tweek of the OS or Firefox.
Note that Midi Music plays on 
Computer #1 Vista with Firefox 8.0 
Computer #2 Win XP Home Firefox 7.0.1 
but does not work on
Computer #3 Win XP Prof. Firefox 7.0.1 
Computer #4 Win XP Prof. Firefox 8.0 

All four connect to the internet through the same router.

Have not Yet checked with IE.


----------



## wolfworx (Oct 2, 2001)

Note that computers 3 and 4 have SP3 and #2 has SP2
Computer #1 Vista with Firefox 8.0 : Music works on all pages
Computer #2 Win XP Home (SP2) Firefox 7.0.1 Music works on all pages
Computer #3 Win XP Prof. (SP3) Firefox 7.0.1 No music on any page
computer #4 Win XP Prof. (SP3) Firefox 8.0 (wireless) No music on any page

I tried IE 6 on #3. Music played, but not consistently on all pages tried.

I tried a 5th computer Win XP Home (SP2) Firefox 7.0.1 Music works on all pages

Could upgrading XP to SP 3 be the problem?


----------



## Laxer (Aug 29, 2011)

It could all depend on what you are using to play the audio file....

Browsers use different resources to play the audio. For example: Chrome has a built in Flash/Java that could be playing it....

IMO the overall issue is the use of just the embed tag... It is not very well supported anymore and frequently causes problems....

If its just one file try using Object/Param/Embed instead... Although it may look messier it is supported much better across all platforms.


----------



## wolfworx (Oct 2, 2001)

Of course I also tried the AUDIO tag. That does not work on #3 and #4 either.

Ditto using Chrome browser. No music on #3 and #4.

_"If its just one file try using Object/Param/Embed instead... Although it may look messier it is supported much better across all platforms."_​
"One file" ? meaning one page or instance of midi music? No, have about a dozen pages with midi reference tags.

Still, the puzzle is why computers #1 and #2 play the midi music and others do not. Could it involve Java or something changed with SP3?

I wish that a change of tags in the HTML code would provide more universal performance, but so far, that is not the case.


----------



## Laxer (Aug 29, 2011)

The embed tag uses flash.... It is built into many browsers but some may require it stand alone....

Embed is very sloppy code... that is why you see it disappear in HTML5...


----------



## wolfworx (Oct 2, 2001)

OK. But I've tried Namenotfound's sugestion:

_Try instead of _


That doesn't work either.
__________________


----------



## wolfworx (Oct 2, 2001)

Found still another computer that plays all my website midi music.

This computer was running Win XP Home w/ SP2.

Makes me very curious since it appears that computer that do not play the midi music all are Win XP w/ SP3. Could there be something in SP3 or something removed in SP3 that is the cause of this problem? I note the play midi failure seem to be a recent development. A couple of years ago I tested some of these web pages on several computers and the midi always played.

If there were and easy way to revert from SP3 to SP2 on the computers that are not playing midi, I could discover if this is at the heart of the problem.

BTW, I also discovered that Hover Buttons do not work consistently on all computers, so I am removin them and replacing them with more conventional buttons or linking methods.


----------



## wolfworx (Oct 2, 2001)

Recently set up a new web page and used the following code:
alone.mid

I was following the suggestion from lookup of midi music + html. It provide the following information:

_soundfile.mid

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_​
I have tried several variations of this code and polled several visitors to my site. The results are still inconsistant. Some visitors get music others do not.

To repeat my results:

Computer #1 Vista Home Premium SP2 with Firefox 8.0 : Music works on all pages
Computer #2 Win XP Home SP2 with Firefox 7.0.1 Music works on all pages, IE 6.0 Music works inconsistently. 
Computer #3 Win XP Prof. SP3 with Firefox 7.0.1 , Chrome and IE 6.0 No music on any page
computer #4 Win XP Prof. SP3 (wireless) with Firefox 8.0 and IE 6.0 3 No music on any pages

I can find no cause of this inconsistency. Any more suggestions?


----------



## etaf (Oct 2, 2003)

Opened as requested


----------



## wolfworx (Oct 2, 2001)

Recently created a new web page for Christmas and added music to it using the following tag:
jingban.mid

Still a problem. Works OK on Vista computer with Firefox 18.0 
Works OK on one XP with Firefox18.0 but not IE 8
Does not work at all in two other XP computers with Firefox.

I am trying to get feedback from friends running Windows 7.

If anyone wants to try my site is:

www.wolfworx.com/xmas2012

Thanks for any help you can offer.


----------



## etaf (Oct 2, 2003)

works in chrome and in IE9 on windows 7


----------



## wolfworx (Oct 2, 2001)

Thanks for the response. Hope feedback lie this will get me to a solution.


----------



## splinner (Dec 13, 2012)

***
**
***

*

If you are reading this, it is because your browser does not support the audio element.

*

Just provide fallbacks for all browsers its the only way to get the job done effiecntly in all browsers. And honestly you should give up on midi when any other format will do the same job and actually read in browsers.


----------



## wolfworx (Oct 2, 2001)

Thanks, Splinner, I tested out your suggestions.
does not work at all.
song1.mid works on 60% of computers tried so far.
(I am using files with the "mid" extension not "midi")
song2.mp3 also works on these computers.
I am still waiting to get reports from others.
There must be some tweek in browsers that is making the difference, since midi and mp3 files play on systems where the web page does not yield any sound.


----------



## splinner (Dec 13, 2012)

Its brcause midi itself is a dieing format. You have to provide 2 additional fallbacks to work on sll browsers ogg and mp3. There is no other way around it.


----------



## splinner (Dec 13, 2012)

Im pretty sure most browser see mid and midi as the same fortmat


----------



## splinner (Dec 13, 2012)

And also it doesnt matter what version of windows your using its the browser.


----------



## wolfworx (Oct 2, 2001)

Well, I am having exactly the same problem with mp3 as midi. 
I have no ogg files nor know where to get Christmas music in that format.


----------



## splinner (Dec 13, 2012)

Yes firefox doesnt support mp3 download a converter. Audacity is free and just import your song and export in ogg


----------



## wolfworx (Oct 2, 2001)

Actually Firefox does support mp3
song2.mp3 works on the computers where the midi file work but not on the others.


----------

