I would like to generate a single continuous tone (eg. a sine wave) from a web page with the ability to interactively control the following:

  • start/stop sound
  • change pitch
  • change volume

I'm after a solution that is reasonably likely to work on a wide variety of hardware, browsers and connections; something as simple and low-bandwidth as possible.

The only method that seems to work reliably across the hardware I have access to is Flash, but I'd really like to avoid a proprietary solution and create something with open-source software that conforms to open standards.

Is this possible?

If so, how?

2 Answers 2


You could try using the <audio> tag and loop it using the onendedattribute. I'm not sure about the cross-platform compatibility of this solution, but it has to be better than Flash, which won't work on the iPad, iPhone or many other mobile devices.

Then you just need a server-side script to generate small audio clips of a particular frequency. I.e. you'd point the src of the audio tag to:

/generate_tone?freq={the frequency you want}

Java is an alternative. There's a development environment called Processing that was created to abstract Java and make it easier for artists and regular folks to program graphics and multimedia.

You can output programs as applets (or cross platform applications).

If having an applet on your website is ok, then this is a good way to go.

Here's their example of generating a sine wave tone using an audio library.

  • Do mobile browsers support Java applets? Commented Oct 22, 2010 at 4:04
  • 1
    @Lèse - we've been investigating browser-based java applets on mobile devices lately and the general answer is a resounding no - not even Android supports them. Commented Oct 22, 2010 at 4:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.