mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-28 22:30:40 -04:00
Text2speech set gain to 2 (6db)
This commit is contained in:
parent
dbd3996fb6
commit
5dfa4cc691
1 changed files with 10 additions and 1 deletions
|
@ -337,9 +337,18 @@ class Scratch3SpeakBlocks {
|
|||
}
|
||||
};
|
||||
this.runtime.audioEngine.decodeSoundPlayer(sound).then(soundPlayer => {
|
||||
soundPlayer.connect(this.runtime.audioEngine);
|
||||
const context = this.runtime.audioEngine.audioContext;
|
||||
soundPlayer.setPlaybackRate(playbackRate);
|
||||
soundPlayer.play();
|
||||
|
||||
// Increase the loudness of the speech sound
|
||||
const gainNode = context.createGain();
|
||||
gainNode.gain.setValueAtTime(2, context.currentTime);
|
||||
// Note that this connect must be done after play is called,
|
||||
// which initializes the soundPlayer's output node.
|
||||
soundPlayer.outputNode.connect(gainNode);
|
||||
gainNode.connect(this.runtime.audioEngine.inputNode);
|
||||
|
||||
soundPlayer.on('stop', resolve);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue