473,386 Members | 1,754 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to Play a series of .mid files as background

Hi,

I'm trying to write some javascript to set up a series of MIDI files as
background using <EMBED>. I can get it to work in general, but the main
problem I have is:

what coding can be used so that each subsequent selection only starts when
the previous selection has finished.

an additional problem will be:

how to clear the control panel from the display after the selection has
finished.

The coding I'm trying to use is something like this in the <BODY>:

<SCRIPT>
var soundFile = "jsrgo1gm.mid,jsrgo2gm.mid,jsrgo3gm.mid";

for (var counter = 0; counter < 3; counter++) {
// something in here to determine when the next piece can start, and to
clear the Console
var sounds = soundFile.split(",");soundFile = sounds[counter];
document.write('<embed src="'+soundFile+'" autostart="true"
controls="Console" width=144 height=60></embed>');
}
</SCRIPT>

<noscript><embed src="jsrgo1gm.mid" autostart="true" ></embed></noscript>
<noembed><bgsound src="jsrgo1gm.mid" ></noembed>

I would appreciate any help you can provide, and if there is an altogether
better way of doing this, I would appreciate hearing about that as well.

Thanks,

Jack


Jul 20 '05 #1
2 1407
Jack Sirulnikoff wrote:
Hi,

I'm trying to write some javascript to set up a series of MIDI files as
background using <EMBED>. I can get it to work in general, but the main
problem I have is:

what coding can be used so that each subsequent selection only starts when
the previous selection has finished.

an additional problem will be:

how to clear the control panel from the display after the selection has
finished.

The coding I'm trying to use is something like this in the <BODY>:

<SCRIPT>
var soundFile = "jsrgo1gm.mid,jsrgo2gm.mid,jsrgo3gm.mid";

for (var counter = 0; counter < 3; counter++) {
// something in here to determine when the next piece can start, and to
clear the Console
var sounds = soundFile.split(",");soundFile = sounds[counter];
document.write('<embed src="'+soundFile+'" autostart="true"
controls="Console" width=144 height=60></embed>');
}
</SCRIPT>

<noscript><embed src="jsrgo1gm.mid" autostart="true" ></embed></noscript>
<noembed><bgsound src="jsrgo1gm.mid" ></noembed>

I would appreciate any help you can provide, and if there is an altogether
better way of doing this, I would appreciate hearing about that as well.

Embed an .m3u file and let the default application handle it. An .m3u
file is nothing more than a "playlist" of files. The URLs in an .m3u
file *must* be absolute URLs.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 20 '05 #2
Thanks for your help. I set up an .m3u, and it worked perfectly from the
test directory on my hard drive. Since all my files are in one directory, it
worked both with just the filename, and using the absolute URL. However,
neither way worked when I tried to run it from my website. I suspect the
problem still has to do with that, but I'm not sure what the answer is.

Jack

"Randy Webb" <hi************@aol.com> wrote in message
news:R_********************@comcast.com...
Jack Sirulnikoff wrote:
Hi,

I'm trying to write some javascript to set up a series of MIDI files as
background using <EMBED>. I can get it to work in general, but the main
problem I have is:

what coding can be used so that each subsequent selection only starts when the previous selection has finished.

an additional problem will be:

how to clear the control panel from the display after the selection has
finished.

The coding I'm trying to use is something like this in the <BODY>:

<SCRIPT>
var soundFile = "jsrgo1gm.mid,jsrgo2gm.mid,jsrgo3gm.mid";

for (var counter = 0; counter < 3; counter++) {
// something in here to determine when the next piece can start, and to
clear the Console
var sounds = soundFile.split(",");soundFile = sounds[counter];
document.write('<embed src="'+soundFile+'" autostart="true"
controls="Console" width=144 height=60></embed>');
}
</SCRIPT>

<noscript><embed src="jsrgo1gm.mid" autostart="true"

</embed></noscript>
<noembed><bgsound src="jsrgo1gm.mid" ></noembed>

I would appreciate any help you can provide, and if there is an altogether better way of doing this, I would appreciate hearing about that as well.

Embed an .m3u file and let the default application handle it. An .m3u
file is nothing more than a "playlist" of files. The URLs in an .m3u
file *must* be absolute URLs.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Steve K | last post by:
Hi, I'm designing a website for the Cornell Undergraduate Business Program where the client wants faculty and student profiles to be interspersed throught the site. These profiles are...
0
by: Michael Fällgreen | last post by:
HI I need to play two (or more) wav-files at the same time. One is "background" and others will play for a sec og two. Can't seem to find info on how to do that (can't make SoundPlayer do it) ...
1
by: chitara | last post by:
code.poet Group: Members Joined: 16 Dec, 2005 Posts: 64 My Contributions
5
by: | last post by:
Hello, I am wrtting a program that does some sound effects... the files are stored in a subfolder in the application folder... and I check the existence of the files before calling the method to...
3
by: andrew.smith.cpp | last post by:
Hello :-) how can i play a ".wav" file in C++.means with the help of the C++ code i just want to play a "a.wav" file more then 10 times. i just want to play background music. Can i do it in C++ ?...
3
by: AWW | last post by:
Using XP and VB 2005, it seemed like a good idea to save audio in the clipboard and then play it with backgroundworker. Cannot find a good Clipboard audio example anywhere - just SetAudio and...
3
by: pavanip | last post by:
Hi, I am new to Silverlight application.I want to display video using Mediaelement tag and I used the below code to play video. <Canvas> <MediaElement x:Name="mPlayer"...
2
by: shannona | last post by:
I've been banging my head against an interaction between a table and float element. I want the two of them to together take up 100% of the width of their container. If the table cells' content...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.