NorskInput.audioSignal() method

Generate a test audio signal with a configurable waveform.

Signature:

audioSignal(settings: AudioSignalGeneratorSettings): Promise<AudioSignalGeneratorNode>;

Parameters

Parameter Type Description

settings

AudioSignalGeneratorSettings

Configuration for the audio signal

Returns:

Example [07_audio_signal.ts]

Generate an audio tone and publish it in an audio-only HLS playlist

export async function main() {
  const norsk = await Norsk.connect();

  const input = await norsk.input.audioSignal(audioSignalSettings);
  const audioOutput = await norsk.output.cmafAudio(hlsAudioSettings);

  audioOutput.subscribe([{ source: input, sourceSelector: selectAudio }]);

  void audioOutput.url().then(playlistUrl => {
    console.log(`playlistUrl: ${playlistUrl}`);
  });
}

const audioSignalSettings: AudioSignalGeneratorSettings = {
  id: "audio-signal",
  sourceName: "signal",
  channelLayout: "stereo",
  sampleRate: 48000,
  wave: mkSine(440),
};

const hlsAudioSettings: CmafOutputSettings = {
  id: "hls-audio",
  partDurationSeconds: 1.0,
  segmentDurationSeconds: 4.0,
  destinations: [{ type: "local", retentionPeriodSeconds: 60, id: "local" }],
};

Find Examples