Here we explore the audio file creation capability of the Hz.AudioFileOut builtin.
Hz.AudioFileOut
is a builtin anode that asynchronously streams its
input audio stream to a stereo .WAV
file.
The idea is simple:
Hz.AudioFileOut
dac
to record
we'll record the entire scene.if(doRecord)
{
// this will fail if your workspace doesn't have a directory
// named '_tmp'. You can create one via the workspace panel.
let ts = Util.GetFileTimestamp();
let outputFile = await ResolveWSFile(`_ws_/_tmp/radio.${ts}.wav`, false);
let preset = {filename: outputFile};
let record = ascene.NewAnode("Hz.AudioFileOut", {preset});
console.log("Recording to " + outputFile + " <----------------");
let dac = ascene.GetDAC();
ascene.Chain(dac, record);
}