EX / Hz.Plugins / Hz.Osc (scoped)

Right-click to copy examples to your workspace


Intro

This example serves two purposes:

  1. Demonstrate Hz.Osc's various waveforms
  2. Demonstrate Hz.Scope's signal and spectrum analysis.

See Also

Hz.Osc Phase Modulation, Hz.Osc Misc, Hz.Osc Ref, Hz.Scope Ref

The Setup

To activate Hz.Scope, we instantiate it, then connect to its input the signal we'd like to analyze. Here we monitor the scene-wide DAC.

let scene = await Ascene.BeginFiber(this);
let osc = scene.NewAnode("Hz.Osc")
let gain = scene.NewAnode("Hz.Mix");
let scope = scene.NewAnode("Hz.Scope");
let dac = scene.GetDAC();
scene.Chain(osc, gain, dac, scope);
await scene.Sync();

Next we walk through all the waveforms and produce a series of notes with each:

for(let i=0; i<=13;i++)
{
    let shape = osc.GetParamMenuLabel("Waveform", i);
    if(shape != "CustomTab") 
    {
        console.info(`osc shape ${i} ${shape}`);
        osc.SetParam("Waveform", i);
        for await (const val of doNotes())
            yield; /* to FiberMgr - support cancellation*/
    }
}

home .. topics .. interface .. reference .. examples .. tipjar