Skip to content

Commit

Permalink
Merge pull request #164 from grammatek/fix/varying_pitch
Browse files Browse the repository at this point in the history
Use the voice settings for the pitch.
  • Loading branch information
lumpidu authored Mar 1, 2024
2 parents d29425f + f2874a3 commit e4a1a66
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
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

0 comments on commit e4a1a66

Please sign in to comment.