Mobile app version of vmapp.org
Login or Join
Ravi8258870

: How to play a tone (eg. sine wave) at an arbitrary pitch/frequency? I would like to generate a single continuous tone (eg. a sine wave) from a web page with the ability to interactively control

@Ravi8258870

Posted in: #Audio #OpenSource #Sound #Standards

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?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Ravi8258870

2 Comments

Sorted by latest first Latest Oldest Best

 

@Dunderdale272

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.

10% popularity Vote Up Vote Down


 

@Shanna517

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}

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme