Examples / AudioIO / Audio Out

Right-click to copy examples to your workspace


This example opens the current audio output device and sends it a simple audio stream generated by Hz.Osc.

audioout.js

let ascene = await Ascene.BeginFiber(this);
let dac = ascene.GetDAC();
let osc = ascene.NewAnode("Hz.Osc");
ascene.Chain(osc, dac);
await ascene.Sync();
for(let i=0;i<100;i++)
{
    let dur = ascene.Seconds(.05 + .2 * Math.random());
    osc.Note(Math.floor(30 + 60*Math.random()), .15 + .4*Math.random(), dur);
    await ascene.Wait(dur);
    yield
}
// exercise: eliminate clicks with voices or Hz.Syntho.
console.log("Done.");
home .. topics .. interface .. reference .. examples .. tipjar