Hi guys, this module is awsome, but i wonder if exist any chance to make the voice louder, like Directions of google maps o the voice of WAZE.
i new on android, i tried to use Equalizer y BassBoost with a audioSessionId from audiomanager and pass this to params on speak method. But without luck
public void speak(String utterance, ReadableMap params, Promise promise) {
if(notReady(promise)) return;
**int audioSessionId = audioManager.generateAudioSessionId();**
if(ducking) {
int amResult;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
...
} else {
amResult = audioManager.requestAudioFocus(afChangeListener, AudioManager.STREAM_MUSIC,
AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK);
Log.d(TAG, "REACT NATIVE TTS: audioSessionId audio session ID: " + audioSessionId);
mEqualizer = new Equalizer(0, **audioSessionId**);
mBassBoost = new BassBoost(0, **audioSessionId**);
mBassBoost.setStrength((short) ((short) 1000 / 100 * 90));
mBassBoost.setEnabled(true);
short bands = mEqualizer.getNumberOfBands();
final short minEQLevel = mEqualizer.getBandLevelRange()[0];
final short maxEQLevel = mEqualizer.getBandLevelRange()[1];
for (short i = 0; i < bands; i++) {
final short band = i;
Log.d(TAG, "REACT NATIVE TTS: bandLevel: " + mEqualizer.getBandLevel(band));
mEqualizer.setBandLevel(band, (short) maxEQLevel);
}
mEqualizer.setEnabled(true);
}
if(amResult != AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
promise.reject("Android AudioManager error, failed to request audio focus");
return;
}
}
String utteranceId = Integer.toString(utterance.hashCode());
int speakResult = speak(utterance, utteranceId, params, **audioSessionId**);
if(speakResult == TextToSpeech.SUCCESS) {
promise.resolve(utteranceId);
} else {
promise.reject("unable to play");
}
}
Hi guys, this module is awsome, but i wonder if exist any chance to make the voice louder, like Directions of google maps o the voice of WAZE.
i new on android, i tried to use Equalizer y BassBoost with a audioSessionId from audiomanager and pass this to params on speak method. But without luck