Search code examples
javascriptandroidhtmlaudiosynthesizer

Realtime Javascript synth on Android/IOS. HTML5 audio tag won't take injected data


I have an Javascript application that creates some audio tones and plays them. The tones are generated as a WAV file then injected like this....

<audio id="player" controls autobuffer="autobuffer" />
<script type="text/javascript" charset="utf-8">
  document.getElementById("player").src = wavData;
  document.getElementById("player").play();
</script>

This works on recent versions of Chrome or Firefox on a PC but not on any mobile device I tried including Android 4.0.3, Android 2.3 and an IPhone.

Another example of a Javascript synth that works on a desktop but not an Android device is this "Morning Star" synth. http://bitterspring.net/ms/morningstar/

An example of HTML5 audio that does work on Android is this test page. http://textopia.org/androidsoundformats.html .

Is there a workaround? I want a solution based entirely on HTML/Javascript.


Solution

  • MorningStar author here: my synth does not use any <audio> tag, it uses Web Audio API.

    I haven't tested it on Android devices (yet), but if the stock Android browser doesn't support Web Audio API, there's no way the synth could work.