AudioEncodeCodecSettings type

The part of AudioEncodeSettings that ties the codec to the channel layouts and bitrates it can do.

  • channelLayout: the channel layout of this encode. If the source’s doesn’t match it will be automatically converted; to gain greater control over this process, see NorskTransform.audioMix() and NorskTransform.audioMixMatrix() - bitrate: the target bitrate of this encode, in bits per second - codec: what codec to (re) encode the audio to

MP3 is mono or stereo only, and its bitrate must be one that its sample rate allows (see Mp3Mpeg1Bitrate, Mp3Mpeg2Bitrate, Mp3Mpeg25Bitrate) - other values are rejected by the server too. MP2 is the same, except that at 32 / 44.1 / 48 kHz its bitrate also depends on the channel layout (see Mp2Settings).

Signature:

export type AudioEncodeCodecSettings = {
    channelLayout: ChannelLayout;
    bitrate: number;
    codec: OpusSettings | AacSettings | Ac3Settings | Eac3Settings;
} | {
    channelLayout: "mono" | "stereo";
    bitrate: Mp3Mpeg1Bitrate;
    codec: Mp3Settings<Mp3Mpeg1SampleRate>;
} | {
    channelLayout: "mono" | "stereo";
    bitrate: Mp3Mpeg2Bitrate;
    codec: Mp3Settings<Mp3Mpeg2SampleRate>;
} | {
    channelLayout: "mono" | "stereo";
    bitrate: Mp3Mpeg25Bitrate;
    codec: Mp3Settings<Mp3Mpeg25SampleRate>;
} | {
    channelLayout: "mono";
    bitrate: Mp2Mpeg1MonoBitrate;
    codec: Mp2Settings<Mp3Mpeg1SampleRate>;
} | {
    channelLayout: "stereo";
    bitrate: Mp2Mpeg1StereoBitrate;
    codec: Mp2Settings<Mp3Mpeg1SampleRate>;
} | {
    channelLayout: "mono" | "stereo";
    bitrate: Mp2Mpeg2Bitrate;
    codec: Mp2Settings<Mp3Mpeg2SampleRate>;
};