Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Commit

Permalink
fixed: Sometimes TTS engine pronounces space as "percent twenty"
Browse files Browse the repository at this point in the history
  • Loading branch information
veksha committed Apr 16, 2023
1 parent c964a31 commit 9d02290
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/qonlinetts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,9 @@ void QOnlineTts::generateUrls(const QString &text, QOnlineTranslator::Engine eng

// Generate URL API for add it to the playlist
QUrl apiUrl(QStringLiteral("https://translate.googleapis.com/translate_tts"));
const QString query = QStringLiteral("ie=UTF-8&client=gtx&tl=%1&q=%2").arg(langString, QString(QUrl::toPercentEncoding(unparsedText.left(splitIndex))));
#if defined(Q_OS_LINUX)
const QString query = QStringLiteral("ie=UTF-8&client=gtx&tl=%1&q=%2")
.arg(langString, QString(QUrl::toPercentEncoding(unparsedText.left(splitIndex))));
apiUrl.setQuery(query);
#elif defined(Q_OS_WIN)
apiUrl.setQuery(query, QUrl::DecodedMode);
#endif
m_media.append(apiUrl);

// Remove the said part from the next saying
Expand Down Expand Up @@ -125,12 +122,8 @@ void QOnlineTts::generateUrls(const QString &text, QOnlineTranslator::Engine eng
// Generate URL API for add it to the playlist
QUrl apiUrl(QStringLiteral("https://tts.voicetech.yandex.net/tts"));
const QString query = QStringLiteral("text=%1&lang=%2&speaker=%3&emotion=%4&format=mp3")
.arg(QUrl::toPercentEncoding(unparsedText.left(splitIndex)), langString, voiceString, emotionString);
#if defined(Q_OS_LINUX)
.arg(QUrl::toPercentEncoding(unparsedText.left(splitIndex)), langString, voiceString, emotionString);
apiUrl.setQuery(query);
#elif defined(Q_OS_WIN)
apiUrl.setQuery(query, QUrl::DecodedMode);
#endif
m_media.append(apiUrl);

// Remove the said part from the next saying
Expand Down

0 comments on commit 9d02290

Please sign in to comment.