Skip to content

Commit

Permalink
DELIA-65109: Speechrate mapping for offline VG (rdkcentral#5371)
Browse files Browse the repository at this point in the history
Reason for change: speechrate mapping
Test Procedure: Mentioned in ticket
Risks: Low

Signed-off-by: vdinak240 <[email protected]>
  • Loading branch information
vdinak240 authored Jun 3, 2024
1 parent c8f5d36 commit 4b534cc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
4 changes: 4 additions & 0 deletions TextToSpeech/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ All notable changes to this RDK Service will be documented in this file.
* Changes in CHANGELOG should be updated when commits are added to the main or release branches. There should be one CHANGELOG entry per JIRA Ticket. This is not enforced on sprint branches since there could be multiple changes for the same JIRA ticket during development.

* For more details, refer to [versioning](https://github.com/rdkcentral/rdkservices#versioning) section under Main README.
## [1.0.29] - 2024-06-03
### Added
- Added Speech rate mapping for nuance VG on Flex2

## [1.0.28] - 2024-05-07
### Fixed
- Fixed local Language not updated for offline VG
Expand Down
2 changes: 1 addition & 1 deletion TextToSpeech/TextToSpeech.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#define API_VERSION_NUMBER_MAJOR 1
#define API_VERSION_NUMBER_MINOR 0
#define API_VERSION_NUMBER_PATCH 28
#define API_VERSION_NUMBER_PATCH 29
#define API_VERSION_NUMBER 1

namespace WPEFramework {
Expand Down
21 changes: 18 additions & 3 deletions TextToSpeech/impl/TTSURLConstructer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *use
return size * nmemb;
}

static const std::map<std::string, int> speechRateMap = {
{"slow", 25},
{"medium", 50},
{"fast", 75},
{"faster", 90},
{"fastest", 100}
};

namespace TTS
{

Expand Down Expand Up @@ -45,9 +53,16 @@ std::string TTSURLConstructer::httpgetURL(TTSConfiguration &config, std::string
ttsRequest.append(config.language());
}

if(!isLocal && ((config.endPointType().compare("TTS2")) == 0)) {
ttsRequest.append("&speaking_rate=");
ttsRequest.append(config.speechRate());
if(((config.endPointType().compare("TTS2")) == 0)) {
if(!isLocal) {
ttsRequest.append("&speaking_rate=");
ttsRequest.append(config.speechRate());
} else {
//rate mapping for offline VG
ttsRequest.append("&rate=");
auto it = speechRateMap.find(config.speechRate());
ttsRequest.append(std::to_string((speechRateMap.end() != it ) ? it->second : 50));
}
} else {
// Rate / speed
ttsRequest.append("&rate=");
Expand Down

0 comments on commit 4b534cc

Please sign in to comment.