I am not aware of anyone who has tried it and, even if it is possible, I'm sure it would be a pretty steep learning curve.
I don't know of any simplified tool that is available.
// Create an audio context
var ctx = new AudioContext();
function OnStart()
{
play(ctx.destination, 274.17, ctx.currentTime + 0.0, 0.2);
play(ctx.destination, 308.06, ctx.currentTime + 0.2, 0.2);
play(ctx.destination, 346.13, ctx.currentTime + 0.4, 0.2);
play(ctx.destination, 366.90, ctx.currentTime + 0.6, 0.2);
}
function play(node, frequency, start, length)
{
var o = node.context.createOscillator();
o.connect(node);
o.frequency.value = frequency;
o.start(start);
o.stop(start + length);
}
Thanks for those replys! They helped a lot! Here is an app I wrote which uses some advanced features of WebAudio for those who are interested.
Here's the code, hth.
var music = {};
music.g = function(i,x,t,o){
return ((3&x&(i*(((3&i>>16?"BY}6YB6%":"Qj}6jQ6%").charCodeAt(t%8))+51)>>o))<<4);
}
music.onNext = function(e) {
var i = music.ctr,
inc = music.inc,
out = e.outputBuffer,
bs = music.proc.bufferSize,
chnl = out.getChannelData(0),
chnr = out.getChannelData(1),
g = music.g;
l=0;
r=0;
for (var j = 0; j < bs; j++) {
c = g(i,1,n=i>>14,12)
l+=c;
r+=c*.4;
c = g(i,s=i>>17,n^i>>13,10);
l+=c;
c = g(i,s/3,n+((i>>11)%3),10)
r+=c;
c = g(i,s/5,8+n-((i>>10)%3),9);
l+=c*.3;
r+=c*.7;
chnl[j] = ((l & 0xff) / 255) - 0.5;
chnr[j] = ((r & 0xff) / 255) - 0.5;
i += inc;
l=0;
r=0;
} //j
music.ctr = i;
}
music.init = function() {
music.context = AudioContext;
if (music.context) { //webaudio
music.compatible = true; //communicate webaudio compatibility.
//create and connect components.
music.context = new music.context(); //then create it.
music.destination = music.context.destination;
music.masterGain = music.context.createGain();
music.masterGain.connect(music.destination);
music.proc = music.context.createScriptProcessor(0, 0, 2);
music.proc.connect(music.masterGain)
music.inc = 8000/44100;
music.ctr = 0;
music.proc.onaudioprocess = music.onNext;
} else {
music.compatible = false; //communicate webaudio compatibility.
} //if
}
//Called when application is started.
function OnStart()
{
//Create a layout with objects vertically centered.
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
//Create a text label and add it to layout.
txt = app.CreateText( "The Bitshift Variations in C minor" );
txt.SetTextSize( 32 );
lay.AddChild( txt );
info = app.CreateText("This song was created in C by Rob Miles, and ported to DroidScript by Jason Custer. Jason Custer also converted this song to stereo. Rob Miles holds any copyright to this song.");
lay.AddChild(info);
//Add layout to app.
app.AddLayout( lay );
music.init();
if (!music.compatible) {
app.Alert("Incompatible Device", "We're sorry, your device does not support the technology to play this song.");
} //if
}
The text doesn't fit on my screen so I changed both text controls to multiLine
txt = app.CreateText( "The Bitshift Variations in C minor",-1,-1,"multiLine" );
Perhaps you could consider building an spk file and uploading it to the Spk Store https://dspk.justplayer.de/