Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6201989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:39:05+00:00 2026-05-24T04:39:05+00:00

I am finalizing the first version of my javascript app, and I would like

  • 0

I am finalizing the first version of my javascript app, and I would like to add sound effects. What is the recommended way to play a short sound (mp3 or wav or other format) using javascript in a web browser? I have ten sounds that I would like to have pre-loaded and able to play during application execution.

I’ve created this small test app and can’t get the audio to play. Maybe someone can show me where I’m going wrong:

<html>
<head>
    <title>Sound Test</title>
    <script type="text/javascript" src="raphael.js"></script>
</head>
<body>
    <div id="debugPane" style="width: 300px; height: 500px; float: left; background-color: #EEEEEE; margin-left: 10px; border-style: solid; border-width: 1px;"></div>
    <script type="text/javascript">
        try {
            var snd = new Audio("mp3/1.mp3");
            alert(snd.src);
            snd.play();
        } catch (err) {
            document.getElementById("debugPane").innerHTML += "" + err.message;
        }
    </script>
</body>
</html>

The correct file is being chosen. However, when I point to a file that doesn’t exist, I don’t get any exception. The file happily reports what its src is even though it’s not actually on my filesystem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:39:07+00:00Added an answer on May 24, 2026 at 4:39 am

    It ended up working the whole time in Chrome and Safari in Windows and Mac. My dev box was a Chromium/Ubuntu environment, which either is not supported, or my sound is misconfigured. In fact, it doesn’t work in Ubuntu with any browser so far.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm finalizing my first iPhone apps; and wonder where should I put credit information
This is for use in an android app. The first call works, not the
I have a fairly straightforward WCF service that performs one-way file synchronization for a
I am finalizing an application that will soon be submitted for Windows Logo Program
I am finalizing one of my projects and taking a look over the whole
i'm getting a Finalizing a Cursor that has not been deactivated or closed error
I am finalizing a MVC project and have switched to using Google's CDN for
I want to define a following function: if(stmtToFinalize) { NSLog(@Finalizing statement stmtToFinalize); if (sqlite3_finalize(stmtToFinalize)
Just a quick question: I'm in the finalizing state of my current C# project,
I'm trying to translate a huge project from C++ to Delphi and I'm finalizing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.