Reputation: 2040
For a small web app I'm making, I need to output sinusoidal test tones for client-side audio playback.
The thing is, I can't seem to find a way to do it in javascript without downloading and looping pre-rendered WAV files.
Is there a standards compliant method out there of outputting test tones? Or must I build the test tones on my own and use something like this to play back the files?
(I would much prefer to generate the test tones real-time so that I can generate a number of frequencies beyond the limited gamut of frequencies available to me with a sample set of WAV files.)
Upvotes: 0
Views: 470
Reputation: 163232
There is a way of doing this by using the data URI scheme, but it is a bit of a hack, and probably isn't very efficient. You should also keep in mind of length limits for the data URI.
See http://ajaxian.com/archives/generating-and-playing-sound-in-javascript and http://softwareas.com/offline-sound-no-flash-no-file.
Upvotes: 1