Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,7 @@ Language-specific build instructions can be found in their respective directorie
Techmo TTS Service API is defined in `proto/TTS.proto` file.

Service's `Synthesize` method accepts `SynthesizeRequest` object which contains whole phrase to be synthesized.
You have to put the phrase as a string in `text` field of `SynthesizeRequest`. The string has to be in orthographic form. In that string you can use several special tags which can be interpreted. Tags have to be in from `<tag>something special</tag>` and can occur in any place in text. Currently interpreted tags are:

cardinal cardinal number "<cardinal>7</cardinal>" -> "siedem"
signed number with sign "<signed>-15</signed>" -> "minus piętnaście"
ordinal ordinal number "<ordinal>1</ordinal>" -> "pierwszy"
fraction fractional number "<fraction>3/4</fraction>" -> "trzy czwarte"
postal postal code "<postal>30-020</postal>" -> "trzydzieści zero dwadzieścia"
time time "<time>22:00</time>" -> "dwudziesta druga"
date date "<date>12/05/2001</date>" -> "dwunasty maja dwa tysiące jeden"

Note: when interpreting tags only nominal case is supported at the moment.

You have to put the phrase as a string in `text` field of `SynthesizeRequest`. The string has to be in orthographic form.
You can set `SynthesizeConfig`'s fields to specify parameters of synthesis. Currently supported option is only `sample_rate_hertz`, which is desired sampling frequency (in hertz) of synthesized audio.

`SynthesizeRequest` can be sent to the service via gRPC insecure channel (that does not require authentication).
Expand All @@ -37,3 +26,10 @@ We provide sample TTS Client written in:
- C++ in `cpp` (accepts text to be synthesized as a command line string),
- Python in `python` (accepts text to be synthesized as a command line string or as a content of given text file).
By default it saves "TechmoTTS.wav" file with received synthesized audio content. To use it, you have to specify provided by us service IP address and port using `--service-address` option with string in form "address:port".

TTS supports following SSML tags:
`<prosody volume="+40%">text</prosody>` Change of volume. Parses numeric value (+ and -)
`<prosody rate="-10%">text</prosody>` Change of rate without change of pitch. Parses numeric value (+ and -)
`<prosody pitch="+30%">text</prosody>` Change of pitch. Parses numeric value (+ and -)
`<break time="3s"/>` Inserts silence. Parses numeric value in seconds or milliseconds ("3s", "750ms")
Prosody tags can be combined together, example: `<prosody rate="+30%" pitch="+40%">text</prosody>`.
4 changes: 4 additions & 0 deletions cpp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Tribune TTS gRPC C++ client Changelog

## [1.3.0] - 2019-06-24
### Added
- `audio-encoding` option.

## [1.2.0] - 2018-12-12
### Added
- Support for setting gRPC deadline (how long the client is willing to wait for a reply from the server).
Expand Down
2 changes: 1 addition & 1 deletion cpp/libtribune-client/VERSION.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
static constexpr auto LIBTRIBUNE_CLIENT_VERSION = "1.2.0";
static constexpr auto LIBTRIBUNE_CLIENT_VERSION = "1.3.0";
6 changes: 5 additions & 1 deletion cpp/libtribune-client/tribune_client.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
#include <grpc++/grpc++.h>
#include <google/protobuf/text_format.h>

#include "tribune_tts.grpc.pb.h"
#include "tribune_client.h"


namespace techmo { namespace tribune {

SynthesizeRequest build_request(const TribuneClientConfig& config, const std::string& text) {
if(config.encoding == AudioEncoding::OGG_OPUS and config.sample_rate_hertz != 0 ){
throw std::runtime_error("Custom sample rate is not supported with Opus compression.");
}

SynthesizeRequest request;
request.set_text(text);
request.mutable_config()->set_sample_rate_hertz(config.sample_rate_hertz);
request.mutable_config()->set_encoding(config.encoding);
return request;
}

Expand Down
2 changes: 2 additions & 0 deletions cpp/libtribune-client/tribune_client.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef __TRIBUNE_CLIENT_H__
#define __TRIBUNE_CLIENT_H__

#include "tribune_tts.grpc.pb.h"

namespace techmo { namespace tribune {

Expand All @@ -9,6 +10,7 @@ struct TribuneClientConfig {
// Session ID is the best way to match log's from client application with these on server side.
int grpc_timeout = 0; // Timeout in milliseconds used to set gRPC deadline - how long the client is willing to wait for a reply from the server.
unsigned int sample_rate_hertz = 0; // Sample rate in Hz of synthesized audio. If set to 0, the service will use voice's original sample rate.
AudioEncoding encoding = AudioEncoding::LINEAR16;
};

struct TribuneAudioData {
Expand Down
34 changes: 15 additions & 19 deletions cpp/libtribune-client/tribune_tts.grpc.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

119 changes: 97 additions & 22 deletions cpp/libtribune-client/tribune_tts.pb.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading