@jambonz/speech-utils 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +1 -0
- package/.eslintrc.json +126 -0
- package/.github/workflows/ci.yml +27 -0
- package/.github/workflows/publish.yml +23 -0
- package/LICENSE +21 -0
- package/README.md +2 -0
- package/build_stubs.sh +11 -0
- package/config/test.json +13 -0
- package/index.js +32 -0
- package/lib/get-ibm-access-token.js +48 -0
- package/lib/get-nuance-access-token.js +49 -0
- package/lib/get-tts-voices.js +111 -0
- package/lib/purge-tts-cache.js +46 -0
- package/lib/synth-audio.js +469 -0
- package/lib/utils.js +115 -0
- package/package.json +48 -0
- package/protos/nuance/synthesizer.proto +332 -0
- package/protos/riva/proto/riva_audio.proto +36 -0
- package/protos/riva/proto/riva_tts.proto +77 -0
- package/stubs/nuance/synthesizer_grpc_pb.js +104 -0
- package/stubs/nuance/synthesizer_pb.js +6815 -0
- package/stubs/riva/proto/riva_audio_grpc_pb.js +1 -0
- package/stubs/riva/proto/riva_audio_pb.js +31 -0
- package/stubs/riva/proto/riva_tts_grpc_pb.js +99 -0
- package/stubs/riva/proto/riva_tts_pb.js +1278 -0
- package/test/docker-compose-testbed.yaml +39 -0
- package/test/docker_start.js +12 -0
- package/test/docker_stop.js +12 -0
- package/test/ibm.js +78 -0
- package/test/index.js +5 -0
- package/test/nuance.js +50 -0
- package/test/synth.js +431 -0
- package/test/tmp/redis.conf +2054 -0
- package/test/webhook/Dockerfile +23 -0
- package/test/webhook/app.js +125 -0
- package/test/webhook/package-lock.json +1045 -0
- package/test/webhook/package.json +15 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// GENERATED CODE -- NO SERVICES IN PROTO
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// source: riva/proto/riva_audio.proto
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview
|
|
4
|
+
* @enhanceable
|
|
5
|
+
* @suppress {missingRequire} reports error on implicit type usages.
|
|
6
|
+
* @suppress {messageConventions} JS Compiler reports an error if a variable or
|
|
7
|
+
* field starts with 'MSG_' and isn't a translatable message.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
// GENERATED CODE -- DO NOT EDIT!
|
|
11
|
+
/* eslint-disable */
|
|
12
|
+
// @ts-nocheck
|
|
13
|
+
|
|
14
|
+
var jspb = require('google-protobuf');
|
|
15
|
+
var goog = jspb;
|
|
16
|
+
var global = Function('return this')();
|
|
17
|
+
|
|
18
|
+
goog.exportSymbol('proto.nvidia.riva.AudioEncoding', null, global);
|
|
19
|
+
/**
|
|
20
|
+
* @enum {number}
|
|
21
|
+
*/
|
|
22
|
+
proto.nvidia.riva.AudioEncoding = {
|
|
23
|
+
ENCODING_UNSPECIFIED: 0,
|
|
24
|
+
LINEAR_PCM: 1,
|
|
25
|
+
FLAC: 2,
|
|
26
|
+
MULAW: 3,
|
|
27
|
+
OGGOPUS: 4,
|
|
28
|
+
ALAW: 20
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
goog.object.extend(exports, proto.nvidia.riva);
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// GENERATED CODE -- DO NOT EDIT!
|
|
2
|
+
|
|
3
|
+
// Original file comments:
|
|
4
|
+
// SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
5
|
+
// SPDX-License-Identifier: MIT
|
|
6
|
+
//
|
|
7
|
+
'use strict';
|
|
8
|
+
var grpc = require('@grpc/grpc-js');
|
|
9
|
+
var riva_proto_riva_tts_pb = require('../../riva/proto/riva_tts_pb.js');
|
|
10
|
+
var riva_proto_riva_audio_pb = require('../../riva/proto/riva_audio_pb.js');
|
|
11
|
+
|
|
12
|
+
function serialize_nvidia_riva_tts_RivaSynthesisConfigRequest(arg) {
|
|
13
|
+
if (!(arg instanceof riva_proto_riva_tts_pb.RivaSynthesisConfigRequest)) {
|
|
14
|
+
throw new Error('Expected argument of type nvidia.riva.tts.RivaSynthesisConfigRequest');
|
|
15
|
+
}
|
|
16
|
+
return Buffer.from(arg.serializeBinary());
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function deserialize_nvidia_riva_tts_RivaSynthesisConfigRequest(buffer_arg) {
|
|
20
|
+
return riva_proto_riva_tts_pb.RivaSynthesisConfigRequest.deserializeBinary(new Uint8Array(buffer_arg));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function serialize_nvidia_riva_tts_RivaSynthesisConfigResponse(arg) {
|
|
24
|
+
if (!(arg instanceof riva_proto_riva_tts_pb.RivaSynthesisConfigResponse)) {
|
|
25
|
+
throw new Error('Expected argument of type nvidia.riva.tts.RivaSynthesisConfigResponse');
|
|
26
|
+
}
|
|
27
|
+
return Buffer.from(arg.serializeBinary());
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function deserialize_nvidia_riva_tts_RivaSynthesisConfigResponse(buffer_arg) {
|
|
31
|
+
return riva_proto_riva_tts_pb.RivaSynthesisConfigResponse.deserializeBinary(new Uint8Array(buffer_arg));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function serialize_nvidia_riva_tts_SynthesizeSpeechRequest(arg) {
|
|
35
|
+
if (!(arg instanceof riva_proto_riva_tts_pb.SynthesizeSpeechRequest)) {
|
|
36
|
+
throw new Error('Expected argument of type nvidia.riva.tts.SynthesizeSpeechRequest');
|
|
37
|
+
}
|
|
38
|
+
return Buffer.from(arg.serializeBinary());
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function deserialize_nvidia_riva_tts_SynthesizeSpeechRequest(buffer_arg) {
|
|
42
|
+
return riva_proto_riva_tts_pb.SynthesizeSpeechRequest.deserializeBinary(new Uint8Array(buffer_arg));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function serialize_nvidia_riva_tts_SynthesizeSpeechResponse(arg) {
|
|
46
|
+
if (!(arg instanceof riva_proto_riva_tts_pb.SynthesizeSpeechResponse)) {
|
|
47
|
+
throw new Error('Expected argument of type nvidia.riva.tts.SynthesizeSpeechResponse');
|
|
48
|
+
}
|
|
49
|
+
return Buffer.from(arg.serializeBinary());
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function deserialize_nvidia_riva_tts_SynthesizeSpeechResponse(buffer_arg) {
|
|
53
|
+
return riva_proto_riva_tts_pb.SynthesizeSpeechResponse.deserializeBinary(new Uint8Array(buffer_arg));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
var RivaSpeechSynthesisService = exports.RivaSpeechSynthesisService = {
|
|
58
|
+
// Used to request text-to-speech from the service. Submit a request containing the
|
|
59
|
+
// desired text and configuration, and receive audio bytes in the requested format.
|
|
60
|
+
synthesize: {
|
|
61
|
+
path: '/nvidia.riva.tts.RivaSpeechSynthesis/Synthesize',
|
|
62
|
+
requestStream: false,
|
|
63
|
+
responseStream: false,
|
|
64
|
+
requestType: riva_proto_riva_tts_pb.SynthesizeSpeechRequest,
|
|
65
|
+
responseType: riva_proto_riva_tts_pb.SynthesizeSpeechResponse,
|
|
66
|
+
requestSerialize: serialize_nvidia_riva_tts_SynthesizeSpeechRequest,
|
|
67
|
+
requestDeserialize: deserialize_nvidia_riva_tts_SynthesizeSpeechRequest,
|
|
68
|
+
responseSerialize: serialize_nvidia_riva_tts_SynthesizeSpeechResponse,
|
|
69
|
+
responseDeserialize: deserialize_nvidia_riva_tts_SynthesizeSpeechResponse,
|
|
70
|
+
},
|
|
71
|
+
// Used to request text-to-speech returned via stream as it becomes available.
|
|
72
|
+
// Submit a SynthesizeSpeechRequest with desired text and configuration,
|
|
73
|
+
// and receive stream of bytes in the requested format.
|
|
74
|
+
synthesizeOnline: {
|
|
75
|
+
path: '/nvidia.riva.tts.RivaSpeechSynthesis/SynthesizeOnline',
|
|
76
|
+
requestStream: false,
|
|
77
|
+
responseStream: true,
|
|
78
|
+
requestType: riva_proto_riva_tts_pb.SynthesizeSpeechRequest,
|
|
79
|
+
responseType: riva_proto_riva_tts_pb.SynthesizeSpeechResponse,
|
|
80
|
+
requestSerialize: serialize_nvidia_riva_tts_SynthesizeSpeechRequest,
|
|
81
|
+
requestDeserialize: deserialize_nvidia_riva_tts_SynthesizeSpeechRequest,
|
|
82
|
+
responseSerialize: serialize_nvidia_riva_tts_SynthesizeSpeechResponse,
|
|
83
|
+
responseDeserialize: deserialize_nvidia_riva_tts_SynthesizeSpeechResponse,
|
|
84
|
+
},
|
|
85
|
+
// Enables clients to request the configuration of the current Synthesize service, or a specific model within the service.
|
|
86
|
+
getRivaSynthesisConfig: {
|
|
87
|
+
path: '/nvidia.riva.tts.RivaSpeechSynthesis/GetRivaSynthesisConfig',
|
|
88
|
+
requestStream: false,
|
|
89
|
+
responseStream: false,
|
|
90
|
+
requestType: riva_proto_riva_tts_pb.RivaSynthesisConfigRequest,
|
|
91
|
+
responseType: riva_proto_riva_tts_pb.RivaSynthesisConfigResponse,
|
|
92
|
+
requestSerialize: serialize_nvidia_riva_tts_RivaSynthesisConfigRequest,
|
|
93
|
+
requestDeserialize: deserialize_nvidia_riva_tts_RivaSynthesisConfigRequest,
|
|
94
|
+
responseSerialize: serialize_nvidia_riva_tts_RivaSynthesisConfigResponse,
|
|
95
|
+
responseDeserialize: deserialize_nvidia_riva_tts_RivaSynthesisConfigResponse,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
exports.RivaSpeechSynthesisClient = grpc.makeGenericClientConstructor(RivaSpeechSynthesisService);
|