gRPC setup
Before developing and running client applications, you need to set up the gRPC environment for your programming language.
Basic steps
The basic steps in using the gRPC protocol for TTSaaS are:
-
Install gRPC for the programming language of your choice, including C++, Java, Python, Go, Ruby, C#, Node.js, and others. See gRPC Documentation for a complete list and instructions on using gRPC with each one. For example, for Python:
python3 -m pip install --upgrade pip python3 -m pip install grpcio python3 -m pip install grpcio-tools
python -m pip install --upgrade pip python -m pip install grpcio python -m pip install grpcio-tools
-
Download proto files: nuance-tts-and-storage-protos.zip. These files contain a generic version of the functions or classes that perform speech synthesis and upload operations.
-
Extract the file to the directory that contains or will contain your client apps, for example, /home/tts/clients on Linux or c:\TTS\clients on Windows. On Linux, use the
unzip
command:cd /home/tts/clients unzip nuance_tts_and_storage_protos.zip
The zip file extracts as a directory structure starting with nuance:
├── Your client apps here ├── nuance_tts_and_storage_protos.zip └── nuance ├── rpc │ ├── error_details.proto │ ├── status_code.proto │ └── status.proto └── tts ├── storage │ └── v1beta1 │ └── storage.proto └── v1 └── synthesizer.proto
-
If your programming language requires client stub files, generate the stubs from the proto files using gRPC protoc, following the Python example as guidance.
These stubs contain the methods and fields from the proto files as implemented in your programming language. Some languages, such as Node.js, can use the proto files directly, meaning client stubs are not required. Consult the gRPC documentation for your programming language.
# Generate Python stubs for synthesis and storage python3 -m grpc_tools.protoc --proto_path=./ --python_out=./ --grpc_python_out=./ nuance/tts/v1/synthesizer.proto python3 -m grpc_tools.protoc --proto_path=./ --python_out=./ --grpc_python_out=./ nuance/tts/storage/v1beta1/storage.proto # Generate Python stubs for RPC messages, if not already present python3 -m grpc_tools.protoc --proto_path=./ --python_out=./ nuance/rpc/status.proto python3 -m grpc_tools.protoc --proto_path=./ --python_out=./ nuance/rpc/status_code.proto python3 -m grpc_tools.protoc --proto_path=./ --python_out=./ nuance/rpc/error_details.proto
# Generate Python stubs for synthesis and storage python -m grpc_tools.protoc --proto_path=./ --python_out=./ --grpc_python_out=./ nuance/tts/v1/synthesizer.proto python -m grpc_tools.protoc --proto_path=./ --python_out=./ --grpc_python_out=./ nuance/tts/storage/v1beta1/storage.proto # Generate Python stubs for RPC messages, if not already present python -m grpc_tools.protoc --proto_path=./ --python_out=./ nuance/rpc/status.proto python -m grpc_tools.protoc --proto_path=./ --python_out=./ nuance/rpc/status_code.proto python -m grpc_tools.protoc --proto_path=./ --python_out=./ nuance/rpc/error_details.proto
If you already have client stubs for the RPC files in this location, you may use the existing files.
Final structure
The resulting files contain the information in the proto files in your programming language.
├── Your client apps here
└── nuance
├── rpc
│ ├── error_details_pb2.py
│ ├── error_details.proto
│ ├── status_code_pb2.py
│ ├── status_code.proto
│ ├── status_pb2.py
│ └── status.proto
└── tts
├── storage
│ └── v1beta1
│ ├── storage_pb2.py
│ ├── storage_pb2_grpc.py
│ └── storage.proto
└── v1
├── synthesizer_pb2.py
├── synthesizer_pb2_grpc.py
└── synthesizer.proto
What’s next?
Once you have the proto files and optionally the client stubs, you are ready to develop and run client applications with the help of sample clients:
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.