@aristech-org/tts-client
Version:
A Node.js client library for the Aristech Text-to-Speech API
956 lines (955 loc) • 34.7 kB
JavaScript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.2.4
// protoc v3.21.12
// source: TTSServices.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { makeGenericClientConstructor, } from "@grpc/grpc-js";
import { SpeechLocale, SpeechRequestOption, Voice } from "./TTSTypes.js";
export const protobufPackage = "aristech.tts";
/** Commands that can be used in ServerCommand */
export var CommandType;
(function (CommandType) {
CommandType[CommandType["START_REQUEST"] = 0] = "START_REQUEST";
CommandType[CommandType["STOP_REQUEST"] = 1] = "STOP_REQUEST";
CommandType[CommandType["STATUS_REQUEST"] = 2] = "STATUS_REQUEST";
CommandType[CommandType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(CommandType || (CommandType = {}));
export function commandTypeFromJSON(object) {
switch (object) {
case 0:
case "START_REQUEST":
return CommandType.START_REQUEST;
case 1:
case "STOP_REQUEST":
return CommandType.STOP_REQUEST;
case 2:
case "STATUS_REQUEST":
return CommandType.STATUS_REQUEST;
case -1:
case "UNRECOGNIZED":
default:
return CommandType.UNRECOGNIZED;
}
}
export function commandTypeToJSON(object) {
switch (object) {
case CommandType.START_REQUEST:
return "START_REQUEST";
case CommandType.STOP_REQUEST:
return "STOP_REQUEST";
case CommandType.STATUS_REQUEST:
return "STATUS_REQUEST";
case CommandType.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
export var CommandResponseType;
(function (CommandResponseType) {
/** STARTRESPONSE - Synthesis startet */
CommandResponseType[CommandResponseType["STARTRESPONSE"] = 0] = "STARTRESPONSE";
/** STOPRESPONSE - Synthesis stopped */
CommandResponseType[CommandResponseType["STOPRESPONSE"] = 1] = "STOPRESPONSE";
/** STATUSRESPONSE - Response contains status information */
CommandResponseType[CommandResponseType["STATUSRESPONSE"] = 2] = "STATUSRESPONSE";
/** SYNTHESISRESPONSE - Response contains SpeechResponses */
CommandResponseType[CommandResponseType["SYNTHESISRESPONSE"] = 3] = "SYNTHESISRESPONSE";
CommandResponseType[CommandResponseType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(CommandResponseType || (CommandResponseType = {}));
export function commandResponseTypeFromJSON(object) {
switch (object) {
case 0:
case "STARTRESPONSE":
return CommandResponseType.STARTRESPONSE;
case 1:
case "STOPRESPONSE":
return CommandResponseType.STOPRESPONSE;
case 2:
case "STATUSRESPONSE":
return CommandResponseType.STATUSRESPONSE;
case 3:
case "SYNTHESISRESPONSE":
return CommandResponseType.SYNTHESISRESPONSE;
case -1:
case "UNRECOGNIZED":
default:
return CommandResponseType.UNRECOGNIZED;
}
}
export function commandResponseTypeToJSON(object) {
switch (object) {
case CommandResponseType.STARTRESPONSE:
return "STARTRESPONSE";
case CommandResponseType.STOPRESPONSE:
return "STOPRESPONSE";
case CommandResponseType.STATUSRESPONSE:
return "STATUSRESPONSE";
case CommandResponseType.SYNTHESISRESPONSE:
return "SYNTHESISRESPONSE";
case CommandResponseType.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
function createBaseSpeechRequest() {
return { text: "", options: undefined, parameters: "", inputType: "", outputType: "" };
}
export const SpeechRequest = {
encode(message, writer = new BinaryWriter()) {
if (message.text !== "") {
writer.uint32(10).string(message.text);
}
if (message.options !== undefined) {
SpeechRequestOption.encode(message.options, writer.uint32(18).fork()).join();
}
if (message.parameters !== "") {
writer.uint32(26).string(message.parameters);
}
if (message.inputType !== "") {
writer.uint32(34).string(message.inputType);
}
if (message.outputType !== "") {
writer.uint32(42).string(message.outputType);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSpeechRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.text = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.options = SpeechRequestOption.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.parameters = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.inputType = reader.string();
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.outputType = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
text: isSet(object.text) ? globalThis.String(object.text) : "",
options: isSet(object.options) ? SpeechRequestOption.fromJSON(object.options) : undefined,
parameters: isSet(object.parameters) ? globalThis.String(object.parameters) : "",
inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "",
outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "",
};
},
toJSON(message) {
const obj = {};
if (message.text !== "") {
obj.text = message.text;
}
if (message.options !== undefined) {
obj.options = SpeechRequestOption.toJSON(message.options);
}
if (message.parameters !== "") {
obj.parameters = message.parameters;
}
if (message.inputType !== "") {
obj.inputType = message.inputType;
}
if (message.outputType !== "") {
obj.outputType = message.outputType;
}
return obj;
},
create(base) {
return SpeechRequest.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseSpeechRequest();
message.text = object.text ?? "";
message.options = (object.options !== undefined && object.options !== null)
? SpeechRequestOption.fromPartial(object.options)
: undefined;
message.parameters = object.parameters ?? "";
message.inputType = object.inputType ?? "";
message.outputType = object.outputType ?? "";
return message;
},
};
function createBasePhonesetRequest() {
return { voice: undefined };
}
export const PhonesetRequest = {
encode(message, writer = new BinaryWriter()) {
if (message.voice !== undefined) {
Voice.encode(message.voice, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePhonesetRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.voice = Voice.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { voice: isSet(object.voice) ? Voice.fromJSON(object.voice) : undefined };
},
toJSON(message) {
const obj = {};
if (message.voice !== undefined) {
obj.voice = Voice.toJSON(message.voice);
}
return obj;
},
create(base) {
return PhonesetRequest.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBasePhonesetRequest();
message.voice = (object.voice !== undefined && object.voice !== null) ? Voice.fromPartial(object.voice) : undefined;
return message;
},
};
function createBasePhonesetResponse() {
return { status: 0, message: "", phoneset: "" };
}
export const PhonesetResponse = {
encode(message, writer = new BinaryWriter()) {
if (message.status !== 0) {
writer.uint32(8).int64(message.status);
}
if (message.message !== "") {
writer.uint32(18).string(message.message);
}
if (message.phoneset !== "") {
writer.uint32(26).string(message.phoneset);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePhonesetResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.status = longToNumber(reader.int64());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.message = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.phoneset = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
status: isSet(object.status) ? globalThis.Number(object.status) : 0,
message: isSet(object.message) ? globalThis.String(object.message) : "",
phoneset: isSet(object.phoneset) ? globalThis.String(object.phoneset) : "",
};
},
toJSON(message) {
const obj = {};
if (message.status !== 0) {
obj.status = Math.round(message.status);
}
if (message.message !== "") {
obj.message = message.message;
}
if (message.phoneset !== "") {
obj.phoneset = message.phoneset;
}
return obj;
},
create(base) {
return PhonesetResponse.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBasePhonesetResponse();
message.status = object.status ?? 0;
message.message = object.message ?? "";
message.phoneset = object.phoneset ?? "";
return message;
},
};
function createBaseTranscriptionRequest() {
return { voice: undefined, word: "" };
}
export const TranscriptionRequest = {
encode(message, writer = new BinaryWriter()) {
if (message.voice !== undefined) {
Voice.encode(message.voice, writer.uint32(10).fork()).join();
}
if (message.word !== "") {
writer.uint32(18).string(message.word);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTranscriptionRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.voice = Voice.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.word = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
voice: isSet(object.voice) ? Voice.fromJSON(object.voice) : undefined,
word: isSet(object.word) ? globalThis.String(object.word) : "",
};
},
toJSON(message) {
const obj = {};
if (message.voice !== undefined) {
obj.voice = Voice.toJSON(message.voice);
}
if (message.word !== "") {
obj.word = message.word;
}
return obj;
},
create(base) {
return TranscriptionRequest.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseTranscriptionRequest();
message.voice = (object.voice !== undefined && object.voice !== null) ? Voice.fromPartial(object.voice) : undefined;
message.word = object.word ?? "";
return message;
},
};
function createBaseTranscriptionResponse() {
return { status: 0, message: "", transcription: "" };
}
export const TranscriptionResponse = {
encode(message, writer = new BinaryWriter()) {
if (message.status !== 0) {
writer.uint32(8).int64(message.status);
}
if (message.message !== "") {
writer.uint32(18).string(message.message);
}
if (message.transcription !== "") {
writer.uint32(26).string(message.transcription);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTranscriptionResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.status = longToNumber(reader.int64());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.message = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.transcription = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
status: isSet(object.status) ? globalThis.Number(object.status) : 0,
message: isSet(object.message) ? globalThis.String(object.message) : "",
transcription: isSet(object.transcription) ? globalThis.String(object.transcription) : "",
};
},
toJSON(message) {
const obj = {};
if (message.status !== 0) {
obj.status = Math.round(message.status);
}
if (message.message !== "") {
obj.message = message.message;
}
if (message.transcription !== "") {
obj.transcription = message.transcription;
}
return obj;
},
create(base) {
return TranscriptionResponse.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseTranscriptionResponse();
message.status = object.status ?? 0;
message.message = object.message ?? "";
message.transcription = object.transcription ?? "";
return message;
},
};
function createBaseServerCommand() {
return { commandType: 0, commandData: new Uint8Array(0), speechRequest: undefined };
}
export const ServerCommand = {
encode(message, writer = new BinaryWriter()) {
if (message.commandType !== 0) {
writer.uint32(8).int32(message.commandType);
}
if (message.commandData.length !== 0) {
writer.uint32(18).bytes(message.commandData);
}
if (message.speechRequest !== undefined) {
SpeechRequest.encode(message.speechRequest, writer.uint32(26).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseServerCommand();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.commandType = reader.int32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.commandData = reader.bytes();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.speechRequest = SpeechRequest.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
commandType: isSet(object.commandType) ? commandTypeFromJSON(object.commandType) : 0,
commandData: isSet(object.commandData) ? bytesFromBase64(object.commandData) : new Uint8Array(0),
speechRequest: isSet(object.speechRequest) ? SpeechRequest.fromJSON(object.speechRequest) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.commandType !== 0) {
obj.commandType = commandTypeToJSON(message.commandType);
}
if (message.commandData.length !== 0) {
obj.commandData = base64FromBytes(message.commandData);
}
if (message.speechRequest !== undefined) {
obj.speechRequest = SpeechRequest.toJSON(message.speechRequest);
}
return obj;
},
create(base) {
return ServerCommand.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseServerCommand();
message.commandType = object.commandType ?? 0;
message.commandData = object.commandData ?? new Uint8Array(0);
message.speechRequest = (object.speechRequest !== undefined && object.speechRequest !== null)
? SpeechRequest.fromPartial(object.speechRequest)
: undefined;
return message;
},
};
function createBaseServerCommandResponse() {
return { responseType: 0, status: 0, message: "", responseData: new Uint8Array(0), speechResponse: [] };
}
export const ServerCommandResponse = {
encode(message, writer = new BinaryWriter()) {
if (message.responseType !== 0) {
writer.uint32(8).int32(message.responseType);
}
if (message.status !== 0) {
writer.uint32(16).int64(message.status);
}
if (message.message !== "") {
writer.uint32(26).string(message.message);
}
if (message.responseData.length !== 0) {
writer.uint32(34).bytes(message.responseData);
}
for (const v of message.speechResponse) {
SpeechResponse.encode(v, writer.uint32(42).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseServerCommandResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.responseType = reader.int32();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.status = longToNumber(reader.int64());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.message = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.responseData = reader.bytes();
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.speechResponse.push(SpeechResponse.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
responseType: isSet(object.responseType) ? commandResponseTypeFromJSON(object.responseType) : 0,
status: isSet(object.status) ? globalThis.Number(object.status) : 0,
message: isSet(object.message) ? globalThis.String(object.message) : "",
responseData: isSet(object.responseData) ? bytesFromBase64(object.responseData) : new Uint8Array(0),
speechResponse: globalThis.Array.isArray(object?.speechResponse)
? object.speechResponse.map((e) => SpeechResponse.fromJSON(e))
: [],
};
},
toJSON(message) {
const obj = {};
if (message.responseType !== 0) {
obj.responseType = commandResponseTypeToJSON(message.responseType);
}
if (message.status !== 0) {
obj.status = Math.round(message.status);
}
if (message.message !== "") {
obj.message = message.message;
}
if (message.responseData.length !== 0) {
obj.responseData = base64FromBytes(message.responseData);
}
if (message.speechResponse?.length) {
obj.speechResponse = message.speechResponse.map((e) => SpeechResponse.toJSON(e));
}
return obj;
},
create(base) {
return ServerCommandResponse.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseServerCommandResponse();
message.responseType = object.responseType ?? 0;
message.status = object.status ?? 0;
message.message = object.message ?? "";
message.responseData = object.responseData ?? new Uint8Array(0);
message.speechResponse = object.speechResponse?.map((e) => SpeechResponse.fromPartial(e)) || [];
return message;
},
};
function createBaseSpeechResponse() {
return { status: 0, data: new Uint8Array(0), inputType: "", outputType: "" };
}
export const SpeechResponse = {
encode(message, writer = new BinaryWriter()) {
if (message.status !== 0) {
writer.uint32(8).int64(message.status);
}
if (message.data.length !== 0) {
writer.uint32(18).bytes(message.data);
}
if (message.inputType !== "") {
writer.uint32(26).string(message.inputType);
}
if (message.outputType !== "") {
writer.uint32(34).string(message.outputType);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSpeechResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.status = longToNumber(reader.int64());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.data = reader.bytes();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.inputType = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.outputType = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
status: isSet(object.status) ? globalThis.Number(object.status) : 0,
data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0),
inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "",
outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "",
};
},
toJSON(message) {
const obj = {};
if (message.status !== 0) {
obj.status = Math.round(message.status);
}
if (message.data.length !== 0) {
obj.data = base64FromBytes(message.data);
}
if (message.inputType !== "") {
obj.inputType = message.inputType;
}
if (message.outputType !== "") {
obj.outputType = message.outputType;
}
return obj;
},
create(base) {
return SpeechResponse.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseSpeechResponse();
message.status = object.status ?? 0;
message.data = object.data ?? new Uint8Array(0);
message.inputType = object.inputType ?? "";
message.outputType = object.outputType ?? "";
return message;
},
};
function createBaseVoiceListRequest() {
return { locale: undefined };
}
export const VoiceListRequest = {
encode(message, writer = new BinaryWriter()) {
if (message.locale !== undefined) {
SpeechLocale.encode(message.locale, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseVoiceListRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.locale = SpeechLocale.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { locale: isSet(object.locale) ? SpeechLocale.fromJSON(object.locale) : undefined };
},
toJSON(message) {
const obj = {};
if (message.locale !== undefined) {
obj.locale = SpeechLocale.toJSON(message.locale);
}
return obj;
},
create(base) {
return VoiceListRequest.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseVoiceListRequest();
message.locale = (object.locale !== undefined && object.locale !== null)
? SpeechLocale.fromPartial(object.locale)
: undefined;
return message;
},
};
export const SpeechServiceService = {
/**
* Performs Text-to-Speech with the given SpeechRequest and streams back the
* audio as packets of type SpeechResponse.
*/
getSpeech: {
path: "/aristech.tts.SpeechService/GetSpeech",
requestStream: false,
responseStream: true,
requestSerialize: (value) => Buffer.from(SpeechRequest.encode(value).finish()),
requestDeserialize: (value) => SpeechRequest.decode(value),
responseSerialize: (value) => Buffer.from(SpeechResponse.encode(value).finish()),
responseDeserialize: (value) => SpeechResponse.decode(value),
},
/**
* Performs Text-to-Speech and streams back the audio. Adds the capability to
* stop the speech synthesis and free a port during synthesis.
*/
controlServer: {
path: "/aristech.tts.SpeechService/ControlServer",
requestStream: true,
responseStream: true,
requestSerialize: (value) => Buffer.from(ServerCommand.encode(value).finish()),
requestDeserialize: (value) => ServerCommand.decode(value),
responseSerialize: (value) => Buffer.from(ServerCommandResponse.encode(value).finish()),
responseDeserialize: (value) => ServerCommandResponse.decode(value),
},
/** Returns available voices as stream. */
getVoiceList: {
path: "/aristech.tts.SpeechService/GetVoiceList",
requestStream: false,
responseStream: true,
requestSerialize: (value) => Buffer.from(VoiceListRequest.encode(value).finish()),
requestDeserialize: (value) => VoiceListRequest.decode(value),
responseSerialize: (value) => Buffer.from(Voice.encode(value).finish()),
responseDeserialize: (value) => Voice.decode(value),
},
/** Returns the phoneset for a given voice */
getPhoneset: {
path: "/aristech.tts.SpeechService/GetPhoneset",
requestStream: false,
responseStream: false,
requestSerialize: (value) => Buffer.from(PhonesetRequest.encode(value).finish()),
requestDeserialize: (value) => PhonesetRequest.decode(value),
responseSerialize: (value) => Buffer.from(PhonesetResponse.encode(value).finish()),
responseDeserialize: (value) => PhonesetResponse.decode(value),
},
/** Returns the transcription for a word for a given voice */
getTranscription: {
path: "/aristech.tts.SpeechService/GetTranscription",
requestStream: false,
responseStream: false,
requestSerialize: (value) => Buffer.from(TranscriptionRequest.encode(value).finish()),
requestDeserialize: (value) => TranscriptionRequest.decode(value),
responseSerialize: (value) => Buffer.from(TranscriptionResponse.encode(value).finish()),
responseDeserialize: (value) => TranscriptionResponse.decode(value),
},
};
export const SpeechServiceClient = makeGenericClientConstructor(SpeechServiceService, "aristech.tts.SpeechService");
export const DebugServiceService = {
processData: {
path: "/aristech.tts.DebugService/ProcessData",
requestStream: false,
responseStream: true,
requestSerialize: (value) => Buffer.from(SpeechRequest.encode(value).finish()),
requestDeserialize: (value) => SpeechRequest.decode(value),
responseSerialize: (value) => Buffer.from(SpeechResponse.encode(value).finish()),
responseDeserialize: (value) => SpeechResponse.decode(value),
},
};
export const DebugServiceClient = makeGenericClientConstructor(DebugServiceService, "aristech.tts.DebugService");
function bytesFromBase64(b64) {
if (globalThis.Buffer) {
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
}
else {
const bin = globalThis.atob(b64);
const arr = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; ++i) {
arr[i] = bin.charCodeAt(i);
}
return arr;
}
}
function base64FromBytes(arr) {
if (globalThis.Buffer) {
return globalThis.Buffer.from(arr).toString("base64");
}
else {
const bin = [];
arr.forEach((byte) => {
bin.push(globalThis.String.fromCharCode(byte));
});
return globalThis.btoa(bin.join(""));
}
}
function longToNumber(int64) {
const num = globalThis.Number(int64.toString());
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
}
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
}
return num;
}
function isSet(value) {
return value !== null && value !== undefined;
}