Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the voice settings for the pitch. #164

Merged
merged 1 commit into from
Mar 1, 2024
Merged
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
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ android {
minSdkVersion 26
compileSdkVersion 34
targetSdkVersion 34
versionCode 35
versionName "2.0.3"
versionCode 36
versionName "2.0.4"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/java/com/grammatek/simaromur/TTSService.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,16 @@ protected void onSynthesizeText(SynthesisRequest request,
Log.i(LOG_TAG, "onSynthesizeText: speechrate from settings: (" + settingsSpeechRate + ")");
float clientSpeechRate = speechrate / (settingsSpeechRate / 100.0f);
speechrate = (int) (adaptedSettingsSpeechRate * clientSpeechRate);
// Use the voice settings for the pitch. In contrast to the speech rate, the pitch is
// not changeable by e.g. TalkBack, but somehow, we get strange pitch variations via
// the request itself and cannot trust it. See also issue #24
pitch = Settings.Secure.getInt(getContentResolver(), Settings.Secure.TTS_DEFAULT_PITCH);
} catch (Exception ex) {
ex.printStackTrace();
}

Log.v(LOG_TAG, "onSynthesizeText: (" + language + "/" + country + "/" + variant
+ "), callerUid: " + callerUid + " effective speed: " + speechrate + " pitch: " + pitch
+ "), callerUid: " + callerUid + " effective speed: " + speechrate + ", effective pitch: " + pitch
+ " bundle: " + params);

String loadedVoiceName = mRepository.getLoadedVoiceName();
Expand Down
Loading