@aristech-org/tts-client
Version:
A Node.js client library for the Aristech Text-to-Speech API
1,252 lines (1,251 loc) • 44.8 kB
JavaScript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.7
// protoc v3.21.12
// source: TTSTypes.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = "aristech.tts";
export var SqrType;
(function (SqrType) {
/** UNSET - default value to identify clients that didn't set a value */
SqrType[SqrType["UNSET"] = 0] = "UNSET";
/** NO_SQRS - don't apply synced sqrs */
SqrType[SqrType["NO_SQRS"] = 1] = "NO_SQRS";
/** PRODUCTIVE - apply only productive sqrs */
SqrType[SqrType["PRODUCTIVE"] = 2] = "PRODUCTIVE";
/** NON_PRODUCTIVE - apply only non-productive sqrs */
SqrType[SqrType["NON_PRODUCTIVE"] = 3] = "NON_PRODUCTIVE";
/** ALL - apply all (latest) sqrs */
SqrType[SqrType["ALL"] = 4] = "ALL";
SqrType[SqrType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(SqrType || (SqrType = {}));
export function sqrTypeFromJSON(object) {
switch (object) {
case 0:
case "UNSET":
return SqrType.UNSET;
case 1:
case "NO_SQRS":
return SqrType.NO_SQRS;
case 2:
case "PRODUCTIVE":
return SqrType.PRODUCTIVE;
case 3:
case "NON_PRODUCTIVE":
return SqrType.NON_PRODUCTIVE;
case 4:
case "ALL":
return SqrType.ALL;
case -1:
case "UNRECOGNIZED":
default:
return SqrType.UNRECOGNIZED;
}
}
export function sqrTypeToJSON(object) {
switch (object) {
case SqrType.UNSET:
return "UNSET";
case SqrType.NO_SQRS:
return "NO_SQRS";
case SqrType.PRODUCTIVE:
return "PRODUCTIVE";
case SqrType.NON_PRODUCTIVE:
return "NON_PRODUCTIVE";
case SqrType.ALL:
return "ALL";
case SqrType.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
/** Indicates the container of the audio. */
export var SpeechAudioFormat_Container;
(function (SpeechAudioFormat_Container) {
/** RAW - raw */
SpeechAudioFormat_Container[SpeechAudioFormat_Container["RAW"] = 0] = "RAW";
/** WAV - wav */
SpeechAudioFormat_Container[SpeechAudioFormat_Container["WAV"] = 1] = "WAV";
/** FLAC - flac */
SpeechAudioFormat_Container[SpeechAudioFormat_Container["FLAC"] = 2] = "FLAC";
/** OGG - ogg */
SpeechAudioFormat_Container[SpeechAudioFormat_Container["OGG"] = 3] = "OGG";
/** MP3 - mp3 */
SpeechAudioFormat_Container[SpeechAudioFormat_Container["MP3"] = 4] = "MP3";
/** SPEEX - speex */
SpeechAudioFormat_Container[SpeechAudioFormat_Container["SPEEX"] = 5] = "SPEEX";
SpeechAudioFormat_Container[SpeechAudioFormat_Container["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(SpeechAudioFormat_Container || (SpeechAudioFormat_Container = {}));
export function speechAudioFormat_ContainerFromJSON(object) {
switch (object) {
case 0:
case "RAW":
return SpeechAudioFormat_Container.RAW;
case 1:
case "WAV":
return SpeechAudioFormat_Container.WAV;
case 2:
case "FLAC":
return SpeechAudioFormat_Container.FLAC;
case 3:
case "OGG":
return SpeechAudioFormat_Container.OGG;
case 4:
case "MP3":
return SpeechAudioFormat_Container.MP3;
case 5:
case "SPEEX":
return SpeechAudioFormat_Container.SPEEX;
case -1:
case "UNRECOGNIZED":
default:
return SpeechAudioFormat_Container.UNRECOGNIZED;
}
}
export function speechAudioFormat_ContainerToJSON(object) {
switch (object) {
case SpeechAudioFormat_Container.RAW:
return "RAW";
case SpeechAudioFormat_Container.WAV:
return "WAV";
case SpeechAudioFormat_Container.FLAC:
return "FLAC";
case SpeechAudioFormat_Container.OGG:
return "OGG";
case SpeechAudioFormat_Container.MP3:
return "MP3";
case SpeechAudioFormat_Container.SPEEX:
return "SPEEX";
case SpeechAudioFormat_Container.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
/** Indicates the codec of the audio. */
export var SpeechAudioFormat_Codec;
(function (SpeechAudioFormat_Codec) {
/** PCM - pcm a.k.a. signed-integer */
SpeechAudioFormat_Codec[SpeechAudioFormat_Codec["PCM"] = 0] = "PCM";
/** MU_LAW - mu-law */
SpeechAudioFormat_Codec[SpeechAudioFormat_Codec["MU_LAW"] = 1] = "MU_LAW";
/** A_LAW - a-law */
SpeechAudioFormat_Codec[SpeechAudioFormat_Codec["A_LAW"] = 2] = "A_LAW";
SpeechAudioFormat_Codec[SpeechAudioFormat_Codec["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(SpeechAudioFormat_Codec || (SpeechAudioFormat_Codec = {}));
export function speechAudioFormat_CodecFromJSON(object) {
switch (object) {
case 0:
case "PCM":
return SpeechAudioFormat_Codec.PCM;
case 1:
case "MU_LAW":
return SpeechAudioFormat_Codec.MU_LAW;
case 2:
case "A_LAW":
return SpeechAudioFormat_Codec.A_LAW;
case -1:
case "UNRECOGNIZED":
default:
return SpeechAudioFormat_Codec.UNRECOGNIZED;
}
}
export function speechAudioFormat_CodecToJSON(object) {
switch (object) {
case SpeechAudioFormat_Codec.PCM:
return "PCM";
case SpeechAudioFormat_Codec.MU_LAW:
return "MU_LAW";
case SpeechAudioFormat_Codec.A_LAW:
return "A_LAW";
case SpeechAudioFormat_Codec.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
export var Voice_Gender;
(function (Voice_Gender) {
Voice_Gender[Voice_Gender["FEMALE"] = 0] = "FEMALE";
Voice_Gender[Voice_Gender["MALE"] = 1] = "MALE";
Voice_Gender[Voice_Gender["OTHER"] = 2] = "OTHER";
Voice_Gender[Voice_Gender["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(Voice_Gender || (Voice_Gender = {}));
export function voice_GenderFromJSON(object) {
switch (object) {
case 0:
case "FEMALE":
return Voice_Gender.FEMALE;
case 1:
case "MALE":
return Voice_Gender.MALE;
case 2:
case "OTHER":
return Voice_Gender.OTHER;
case -1:
case "UNRECOGNIZED":
default:
return Voice_Gender.UNRECOGNIZED;
}
}
export function voice_GenderToJSON(object) {
switch (object) {
case Voice_Gender.FEMALE:
return "FEMALE";
case Voice_Gender.MALE:
return "MALE";
case Voice_Gender.OTHER:
return "OTHER";
case Voice_Gender.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
function createBaseSpeechRequestOption() {
return {
voiceId: "",
audio: undefined,
normalize: false,
sqrType: 0,
normalizationOptions: undefined,
disableCache: false,
};
}
export const SpeechRequestOption = {
encode(message, writer = new BinaryWriter()) {
if (message.voiceId !== "") {
writer.uint32(10).string(message.voiceId);
}
if (message.audio !== undefined) {
SpeechAudioFormat.encode(message.audio, writer.uint32(18).fork()).join();
}
if (message.normalize !== false) {
writer.uint32(24).bool(message.normalize);
}
if (message.sqrType !== 0) {
writer.uint32(40).int32(message.sqrType);
}
if (message.normalizationOptions !== undefined) {
SpeechRequestOption_NormalizationOptions.encode(message.normalizationOptions, writer.uint32(50).fork()).join();
}
if (message.disableCache !== false) {
writer.uint32(56).bool(message.disableCache);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSpeechRequestOption();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.voiceId = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.audio = SpeechAudioFormat.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.normalize = reader.bool();
continue;
}
case 5: {
if (tag !== 40) {
break;
}
message.sqrType = reader.int32();
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.normalizationOptions = SpeechRequestOption_NormalizationOptions.decode(reader, reader.uint32());
continue;
}
case 7: {
if (tag !== 56) {
break;
}
message.disableCache = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
voiceId: isSet(object.voiceId) ? globalThis.String(object.voiceId) : "",
audio: isSet(object.audio) ? SpeechAudioFormat.fromJSON(object.audio) : undefined,
normalize: isSet(object.normalize) ? globalThis.Boolean(object.normalize) : false,
sqrType: isSet(object.sqrType) ? sqrTypeFromJSON(object.sqrType) : 0,
normalizationOptions: isSet(object.normalizationOptions)
? SpeechRequestOption_NormalizationOptions.fromJSON(object.normalizationOptions)
: undefined,
disableCache: isSet(object.disableCache) ? globalThis.Boolean(object.disableCache) : false,
};
},
toJSON(message) {
const obj = {};
if (message.voiceId !== "") {
obj.voiceId = message.voiceId;
}
if (message.audio !== undefined) {
obj.audio = SpeechAudioFormat.toJSON(message.audio);
}
if (message.normalize !== false) {
obj.normalize = message.normalize;
}
if (message.sqrType !== 0) {
obj.sqrType = sqrTypeToJSON(message.sqrType);
}
if (message.normalizationOptions !== undefined) {
obj.normalizationOptions = SpeechRequestOption_NormalizationOptions.toJSON(message.normalizationOptions);
}
if (message.disableCache !== false) {
obj.disableCache = message.disableCache;
}
return obj;
},
create(base) {
return SpeechRequestOption.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseSpeechRequestOption();
message.voiceId = object.voiceId ?? "";
message.audio = (object.audio !== undefined && object.audio !== null)
? SpeechAudioFormat.fromPartial(object.audio)
: undefined;
message.normalize = object.normalize ?? false;
message.sqrType = object.sqrType ?? 0;
message.normalizationOptions = (object.normalizationOptions !== undefined && object.normalizationOptions !== null)
? SpeechRequestOption_NormalizationOptions.fromPartial(object.normalizationOptions)
: undefined;
message.disableCache = object.disableCache ?? false;
return message;
},
};
function createBaseSpeechRequestOption_NormalizationOptions() {
return { sqrType: 0, keepMarkdown: false, attemptSinglePassSynthesis: undefined };
}
export const SpeechRequestOption_NormalizationOptions = {
encode(message, writer = new BinaryWriter()) {
if (message.sqrType !== 0) {
writer.uint32(8).int32(message.sqrType);
}
if (message.keepMarkdown !== false) {
writer.uint32(16).bool(message.keepMarkdown);
}
if (message.attemptSinglePassSynthesis !== undefined) {
writer.uint32(24).bool(message.attemptSinglePassSynthesis);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSpeechRequestOption_NormalizationOptions();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.sqrType = reader.int32();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.keepMarkdown = reader.bool();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.attemptSinglePassSynthesis = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
sqrType: isSet(object.sqrType) ? sqrTypeFromJSON(object.sqrType) : 0,
keepMarkdown: isSet(object.keepMarkdown) ? globalThis.Boolean(object.keepMarkdown) : false,
attemptSinglePassSynthesis: isSet(object.attemptSinglePassSynthesis)
? globalThis.Boolean(object.attemptSinglePassSynthesis)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.sqrType !== 0) {
obj.sqrType = sqrTypeToJSON(message.sqrType);
}
if (message.keepMarkdown !== false) {
obj.keepMarkdown = message.keepMarkdown;
}
if (message.attemptSinglePassSynthesis !== undefined) {
obj.attemptSinglePassSynthesis = message.attemptSinglePassSynthesis;
}
return obj;
},
create(base) {
return SpeechRequestOption_NormalizationOptions.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseSpeechRequestOption_NormalizationOptions();
message.sqrType = object.sqrType ?? 0;
message.keepMarkdown = object.keepMarkdown ?? false;
message.attemptSinglePassSynthesis = object.attemptSinglePassSynthesis ?? undefined;
return message;
},
};
function createBaseSpeechAudioFormat() {
return { container: 0, codec: 0, samplerate: 0, bitDepth: 0, channels: 0, bitrate: 0 };
}
export const SpeechAudioFormat = {
encode(message, writer = new BinaryWriter()) {
if (message.container !== 0) {
writer.uint32(8).int32(message.container);
}
if (message.codec !== 0) {
writer.uint32(16).int32(message.codec);
}
if (message.samplerate !== 0) {
writer.uint32(24).int32(message.samplerate);
}
if (message.bitDepth !== 0) {
writer.uint32(32).int32(message.bitDepth);
}
if (message.channels !== 0) {
writer.uint32(40).int32(message.channels);
}
if (message.bitrate !== 0) {
writer.uint32(48).int32(message.bitrate);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSpeechAudioFormat();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.container = reader.int32();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.codec = reader.int32();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.samplerate = reader.int32();
continue;
}
case 4: {
if (tag !== 32) {
break;
}
message.bitDepth = reader.int32();
continue;
}
case 5: {
if (tag !== 40) {
break;
}
message.channels = reader.int32();
continue;
}
case 6: {
if (tag !== 48) {
break;
}
message.bitrate = reader.int32();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
container: isSet(object.container) ? speechAudioFormat_ContainerFromJSON(object.container) : 0,
codec: isSet(object.codec) ? speechAudioFormat_CodecFromJSON(object.codec) : 0,
samplerate: isSet(object.samplerate) ? globalThis.Number(object.samplerate) : 0,
bitDepth: isSet(object.bitDepth) ? globalThis.Number(object.bitDepth) : 0,
channels: isSet(object.channels) ? globalThis.Number(object.channels) : 0,
bitrate: isSet(object.bitrate) ? globalThis.Number(object.bitrate) : 0,
};
},
toJSON(message) {
const obj = {};
if (message.container !== 0) {
obj.container = speechAudioFormat_ContainerToJSON(message.container);
}
if (message.codec !== 0) {
obj.codec = speechAudioFormat_CodecToJSON(message.codec);
}
if (message.samplerate !== 0) {
obj.samplerate = Math.round(message.samplerate);
}
if (message.bitDepth !== 0) {
obj.bitDepth = Math.round(message.bitDepth);
}
if (message.channels !== 0) {
obj.channels = Math.round(message.channels);
}
if (message.bitrate !== 0) {
obj.bitrate = Math.round(message.bitrate);
}
return obj;
},
create(base) {
return SpeechAudioFormat.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseSpeechAudioFormat();
message.container = object.container ?? 0;
message.codec = object.codec ?? 0;
message.samplerate = object.samplerate ?? 0;
message.bitDepth = object.bitDepth ?? 0;
message.channels = object.channels ?? 0;
message.bitrate = object.bitrate ?? 0;
return message;
},
};
function createBaseSpeechLocale() {
return { language: "", accent: "", languageName: "", accentName: "" };
}
export const SpeechLocale = {
encode(message, writer = new BinaryWriter()) {
if (message.language !== "") {
writer.uint32(10).string(message.language);
}
if (message.accent !== "") {
writer.uint32(18).string(message.accent);
}
if (message.languageName !== "") {
writer.uint32(26).string(message.languageName);
}
if (message.accentName !== "") {
writer.uint32(34).string(message.accentName);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSpeechLocale();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.language = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.accent = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.languageName = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.accentName = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
language: isSet(object.language) ? globalThis.String(object.language) : "",
accent: isSet(object.accent) ? globalThis.String(object.accent) : "",
languageName: isSet(object.languageName) ? globalThis.String(object.languageName) : "",
accentName: isSet(object.accentName) ? globalThis.String(object.accentName) : "",
};
},
toJSON(message) {
const obj = {};
if (message.language !== "") {
obj.language = message.language;
}
if (message.accent !== "") {
obj.accent = message.accent;
}
if (message.languageName !== "") {
obj.languageName = message.languageName;
}
if (message.accentName !== "") {
obj.accentName = message.accentName;
}
return obj;
},
create(base) {
return SpeechLocale.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseSpeechLocale();
message.language = object.language ?? "";
message.accent = object.accent ?? "";
message.languageName = object.languageName ?? "";
message.accentName = object.accentName ?? "";
return message;
},
};
function createBaseVoiceDefaults() {
return { rate: "", pitch: "", defaultVoice: false, volume: "", attemptSinglePassSynthesisDefault: false };
}
export const VoiceDefaults = {
encode(message, writer = new BinaryWriter()) {
if (message.rate !== "") {
writer.uint32(10).string(message.rate);
}
if (message.pitch !== "") {
writer.uint32(18).string(message.pitch);
}
if (message.defaultVoice !== false) {
writer.uint32(24).bool(message.defaultVoice);
}
if (message.volume !== "") {
writer.uint32(34).string(message.volume);
}
if (message.attemptSinglePassSynthesisDefault !== false) {
writer.uint32(40).bool(message.attemptSinglePassSynthesisDefault);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseVoiceDefaults();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.rate = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.pitch = reader.string();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.defaultVoice = reader.bool();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.volume = reader.string();
continue;
}
case 5: {
if (tag !== 40) {
break;
}
message.attemptSinglePassSynthesisDefault = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
rate: isSet(object.rate) ? globalThis.String(object.rate) : "",
pitch: isSet(object.pitch) ? globalThis.String(object.pitch) : "",
defaultVoice: isSet(object.defaultVoice) ? globalThis.Boolean(object.defaultVoice) : false,
volume: isSet(object.volume) ? globalThis.String(object.volume) : "",
attemptSinglePassSynthesisDefault: isSet(object.attemptSinglePassSynthesisDefault)
? globalThis.Boolean(object.attemptSinglePassSynthesisDefault)
: false,
};
},
toJSON(message) {
const obj = {};
if (message.rate !== "") {
obj.rate = message.rate;
}
if (message.pitch !== "") {
obj.pitch = message.pitch;
}
if (message.defaultVoice !== false) {
obj.defaultVoice = message.defaultVoice;
}
if (message.volume !== "") {
obj.volume = message.volume;
}
if (message.attemptSinglePassSynthesisDefault !== false) {
obj.attemptSinglePassSynthesisDefault = message.attemptSinglePassSynthesisDefault;
}
return obj;
},
create(base) {
return VoiceDefaults.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseVoiceDefaults();
message.rate = object.rate ?? "";
message.pitch = object.pitch ?? "";
message.defaultVoice = object.defaultVoice ?? false;
message.volume = object.volume ?? "";
message.attemptSinglePassSynthesisDefault = object.attemptSinglePassSynthesisDefault ?? false;
return message;
},
};
function createBaseVoice() {
return {
name: "",
audio: undefined,
locale: undefined,
gender: 0,
voiceId: "",
uuid: "",
version: "",
portsAvailable: 0,
debugAvailable: false,
defaults: undefined,
supportsSinglePassSynthesis: false,
ssmlProfile: undefined,
};
}
export const Voice = {
encode(message, writer = new BinaryWriter()) {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
if (message.audio !== undefined) {
SpeechAudioFormat.encode(message.audio, writer.uint32(18).fork()).join();
}
if (message.locale !== undefined) {
SpeechLocale.encode(message.locale, writer.uint32(26).fork()).join();
}
if (message.gender !== 0) {
writer.uint32(32).int32(message.gender);
}
if (message.voiceId !== "") {
writer.uint32(42).string(message.voiceId);
}
if (message.uuid !== "") {
writer.uint32(50).string(message.uuid);
}
if (message.version !== "") {
writer.uint32(58).string(message.version);
}
if (message.portsAvailable !== 0) {
writer.uint32(64).int32(message.portsAvailable);
}
if (message.debugAvailable !== false) {
writer.uint32(72).bool(message.debugAvailable);
}
if (message.defaults !== undefined) {
VoiceDefaults.encode(message.defaults, writer.uint32(98).fork()).join();
}
if (message.supportsSinglePassSynthesis !== false) {
writer.uint32(104).bool(message.supportsSinglePassSynthesis);
}
if (message.ssmlProfile !== undefined) {
VoiceSsmlProfile.encode(message.ssmlProfile, writer.uint32(114).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseVoice();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.name = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.audio = SpeechAudioFormat.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.locale = SpeechLocale.decode(reader, reader.uint32());
continue;
}
case 4: {
if (tag !== 32) {
break;
}
message.gender = reader.int32();
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.voiceId = reader.string();
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.uuid = reader.string();
continue;
}
case 7: {
if (tag !== 58) {
break;
}
message.version = reader.string();
continue;
}
case 8: {
if (tag !== 64) {
break;
}
message.portsAvailable = reader.int32();
continue;
}
case 9: {
if (tag !== 72) {
break;
}
message.debugAvailable = reader.bool();
continue;
}
case 12: {
if (tag !== 98) {
break;
}
message.defaults = VoiceDefaults.decode(reader, reader.uint32());
continue;
}
case 13: {
if (tag !== 104) {
break;
}
message.supportsSinglePassSynthesis = reader.bool();
continue;
}
case 14: {
if (tag !== 114) {
break;
}
message.ssmlProfile = VoiceSsmlProfile.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
name: isSet(object.name) ? globalThis.String(object.name) : "",
audio: isSet(object.audio) ? SpeechAudioFormat.fromJSON(object.audio) : undefined,
locale: isSet(object.locale) ? SpeechLocale.fromJSON(object.locale) : undefined,
gender: isSet(object.gender) ? voice_GenderFromJSON(object.gender) : 0,
voiceId: isSet(object.voiceId) ? globalThis.String(object.voiceId) : "",
uuid: isSet(object.uuid) ? globalThis.String(object.uuid) : "",
version: isSet(object.version) ? globalThis.String(object.version) : "",
portsAvailable: isSet(object.portsAvailable) ? globalThis.Number(object.portsAvailable) : 0,
debugAvailable: isSet(object.debugAvailable) ? globalThis.Boolean(object.debugAvailable) : false,
defaults: isSet(object.defaults) ? VoiceDefaults.fromJSON(object.defaults) : undefined,
supportsSinglePassSynthesis: isSet(object.supportsSinglePassSynthesis)
? globalThis.Boolean(object.supportsSinglePassSynthesis)
: false,
ssmlProfile: isSet(object.ssmlProfile) ? VoiceSsmlProfile.fromJSON(object.ssmlProfile) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.name !== "") {
obj.name = message.name;
}
if (message.audio !== undefined) {
obj.audio = SpeechAudioFormat.toJSON(message.audio);
}
if (message.locale !== undefined) {
obj.locale = SpeechLocale.toJSON(message.locale);
}
if (message.gender !== 0) {
obj.gender = voice_GenderToJSON(message.gender);
}
if (message.voiceId !== "") {
obj.voiceId = message.voiceId;
}
if (message.uuid !== "") {
obj.uuid = message.uuid;
}
if (message.version !== "") {
obj.version = message.version;
}
if (message.portsAvailable !== 0) {
obj.portsAvailable = Math.round(message.portsAvailable);
}
if (message.debugAvailable !== false) {
obj.debugAvailable = message.debugAvailable;
}
if (message.defaults !== undefined) {
obj.defaults = VoiceDefaults.toJSON(message.defaults);
}
if (message.supportsSinglePassSynthesis !== false) {
obj.supportsSinglePassSynthesis = message.supportsSinglePassSynthesis;
}
if (message.ssmlProfile !== undefined) {
obj.ssmlProfile = VoiceSsmlProfile.toJSON(message.ssmlProfile);
}
return obj;
},
create(base) {
return Voice.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseVoice();
message.name = object.name ?? "";
message.audio = (object.audio !== undefined && object.audio !== null)
? SpeechAudioFormat.fromPartial(object.audio)
: undefined;
message.locale = (object.locale !== undefined && object.locale !== null)
? SpeechLocale.fromPartial(object.locale)
: undefined;
message.gender = object.gender ?? 0;
message.voiceId = object.voiceId ?? "";
message.uuid = object.uuid ?? "";
message.version = object.version ?? "";
message.portsAvailable = object.portsAvailable ?? 0;
message.debugAvailable = object.debugAvailable ?? false;
message.defaults = (object.defaults !== undefined && object.defaults !== null)
? VoiceDefaults.fromPartial(object.defaults)
: undefined;
message.supportsSinglePassSynthesis = object.supportsSinglePassSynthesis ?? false;
message.ssmlProfile = (object.ssmlProfile !== undefined && object.ssmlProfile !== null)
? VoiceSsmlProfile.fromPartial(object.ssmlProfile)
: undefined;
return message;
},
};
function createBaseSsmlTagInfo() {
return { tag: "", allowedAttributes: [], selfClosing: false };
}
export const SsmlTagInfo = {
encode(message, writer = new BinaryWriter()) {
if (message.tag !== "") {
writer.uint32(10).string(message.tag);
}
for (const v of message.allowedAttributes) {
writer.uint32(18).string(v);
}
if (message.selfClosing !== false) {
writer.uint32(24).bool(message.selfClosing);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSsmlTagInfo();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.tag = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.allowedAttributes.push(reader.string());
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.selfClosing = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
tag: isSet(object.tag) ? globalThis.String(object.tag) : "",
allowedAttributes: globalThis.Array.isArray(object?.allowedAttributes)
? object.allowedAttributes.map((e) => globalThis.String(e))
: [],
selfClosing: isSet(object.selfClosing) ? globalThis.Boolean(object.selfClosing) : false,
};
},
toJSON(message) {
const obj = {};
if (message.tag !== "") {
obj.tag = message.tag;
}
if (message.allowedAttributes?.length) {
obj.allowedAttributes = message.allowedAttributes;
}
if (message.selfClosing !== false) {
obj.selfClosing = message.selfClosing;
}
return obj;
},
create(base) {
return SsmlTagInfo.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseSsmlTagInfo();
message.tag = object.tag ?? "";
message.allowedAttributes = object.allowedAttributes?.map((e) => e) || [];
message.selfClosing = object.selfClosing ?? false;
return message;
},
};
function createBaseVoiceSsmlProfile() {
return { supportedTags: [] };
}
export const VoiceSsmlProfile = {
encode(message, writer = new BinaryWriter()) {
for (const v of message.supportedTags) {
SsmlTagInfo.encode(v, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseVoiceSsmlProfile();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.supportedTags.push(SsmlTagInfo.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
supportedTags: globalThis.Array.isArray(object?.supportedTags)
? object.supportedTags.map((e) => SsmlTagInfo.fromJSON(e))
: [],
};
},
toJSON(message) {
const obj = {};
if (message.supportedTags?.length) {
obj.supportedTags = message.supportedTags.map((e) => SsmlTagInfo.toJSON(e));
}
return obj;
},
create(base) {
return VoiceSsmlProfile.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseVoiceSsmlProfile();
message.supportedTags = object.supportedTags?.map((e) => SsmlTagInfo.fromPartial(e)) || [];
return message;
},
};
function createBaseSsmlDocSection() {
return { tag: "", title: "", markdown: "", examples: [] };
}
export const SsmlDocSection = {
encode(message, writer = new BinaryWriter()) {
if (message.tag !== "") {
writer.uint32(10).string(message.tag);
}
if (message.title !== "") {
writer.uint32(18).string(message.title);
}
if (message.markdown !== "") {
writer.uint32(26).string(message.markdown);
}
for (const v of message.examples) {
writer.uint32(34).string(v);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSsmlDocSection();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.tag = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.title = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.markdown = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.examples.push(reader.string());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
tag: isSet(object.tag) ? globalThis.String(object.tag) : "",
title: isSet(object.title) ? globalThis.String(object.title) : "",
markdown: isSet(object.markdown) ? globalThis.String(object.markdown) : "",
examples: globalThis.Array.isArray(object?.examples) ? object.examples.map((e) => globalThis.String(e)) : [],
};
},
toJSON(message) {
const obj = {};
if (message.tag !== "") {
obj.tag = message.tag;
}
if (message.title !== "") {
obj.title = message.title;
}
if (message.markdown !== "") {
obj.markdown = message.markdown;
}
if (message.examples?.length) {
obj.examples = message.examples;
}
return obj;
},
create(base) {
return SsmlDocSection.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseSsmlDocSection();
message.tag = object.tag ?? "";
message.title = object.title ?? "";
message.markdown = object.markdown ?? "";
message.examples = object.examples?.map((e) => e) || [];
return message;
},
};
function isSet(value) {
return value !== null && value !== undefined;
}