Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Dal123

macrumors 6502a
Original poster
Oct 23, 2008
903
0
England
I'm trying to have a sound recording (.amr) which gives a little audio description of my company and makes it seem more professional (I know that this is a little taboo but it will make my page look professional in the industry it's targeted at).
After doing some brief research I can see it's a bit tricky to have a sound file that is hidden that validates in xhtml strict. Maybe an object tag, I've made a big effort to validate all my xhtml and css and would be a shame to sacrifice that now as so close to getting finished.
Haven't had much time lately been working long hours and haven't had much time on my computer unfortunately :(.
Input appreciated :).
 
I had some JavaScript for an online game where I was playing sound effects. I think it was working on most browsers, but haven't looked or used this code in a few years. I was using wav files. I've never used a .amr file so not sure what can play that on a page.

PHP:
function soundPlay(s)
{
  if (window.opera) soundPlayOpera(s);
  sound = document.createElement("embed");
  sound.setAttribute("src", s);
  sound.setAttribute("id", "sfx");
  sound.setAttribute("hidden", true);
  sound.setAttribute("autostart", true);
  document.body.appendChild(sound);
}
function soundPlayOpera(sfx)
{
  a = new Audio(sfx);
  a.play();
}
 
I looked this up out of interest and found .amr is compressed human speech audio used in 3G cell phones as part of MMS messages and similar uses and widely supported on Windows and Mac via QuickTime and/or Real Player. There is a proprietary ARM encoder and player for Windows only, as well.

FYI
 
I'd say try converting that file to an mp3 or similar before continuing, because chances are high someone's not going to be able to play that.

As far as imbedding it, the JavaScript earlier should be fine.

jW
 
Angelwatt thank you very much, I thought it would be pretty simple but quite suprised at its complexity.
Jim exactly right, a friend helped me to read some information regarding my company and used my mobile phone to record it. I was amazed how well it came out.
Site is very close to completion, post a link when done.;)
Thanks again :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.