Solved

Playing sounds and manipulating sound files

Posted on 2006-10-29
5
153 Views
Last Modified: 2012-08-14
Hi.

Firstly, this is for audible alerts so is a valid reason for having sound on a page :)

I have 2 basic questions.

1. I am getting the name of the particular sound file required by reading an external file. I need this sound to play just once and to be totally embedded in the page and invisible. When it needs to sound i want to use something like

document.getElementById('soundfile').src = "'sounds/"+thissound+".wav'";

to alter the sound according to the value of 'thissound' retreived. I just can't figure out IE/FF code where the required src can be swapped at will. This must be fully cross-browser compatible.

2. Is there any way to retreive a combination of sound files and play one after the other? eg get a file for sound 'Hello' and then another for 'John' and then play them back to back to create 'Hello John'? Obviously I'm simplifying here but just wondered if possible to do.

Many thx





0
Comment
Question by:robertybob
  • 2
5 Comments
 
LVL 30

Expert Comment

by:third
ID: 17830713
0
 

Author Comment

by:robertybob
ID: 17831014
Yup - I found that on Google a while back - problem is none of them work satisfactorily, hence the question here.

However it seems it was a mistake in my element IDs not the JS all sorted anyway.
0
 

Author Comment

by:robertybob
ID: 17831152
ok - all sorted - sry :)

Just simply used a timeout before swapping the sound file again. Would be nice to actually timie it to kick in directly after the previous one has ended but is good enough for the purpose.

0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 18016179
PAQed with points refunded (250)

Computer101
EE Admin
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question