REF / Music API / Plot

Ascene . Agraph . Aengine
Anode . Modulator . Envelope
Songbook . Song . TimeKeeper
Voices . SampleMgr . StreamMgr
Loader . Async . Plot
Random . Rhythm . Util
MIDI . OSC . HID . Piano
Music Theory with Tonal

right-click to navigate to page sections


There are times you just need to get geeky and visualize some aspect of your songs or audio configuration. Hz includes some 2D plot surfaces in its Audio Monitor panel and you can use this API to dispatch your own data to appear there.

// minimal signal plot example, no audio thread running
let plotId = 0;
let chanId = 0;
let data = [];
data.length = 512;
for(let i=0; i<data.length; i++)
{
    data[i] = Math.sin(3*i/511*Math.PI*2); 
}
PlotSignal(plotId, chanId, data, "3 cycles of sine");

plotId = 1;
data.length = 1024;
chanId = 0;
for(let i=0;i<data.length;i++)
{
    data[i] = .4*Math.sin(3.1*i/1023*Math.PI*2);
}
PlotSignal(plotId, chanId, data,  "3.1 cycles of sine");
home .. topics .. interface .. reference .. examples .. tipjar