amazon-sumerian-hosts
amazon-sumerian-hosts copied to clipboard
Sound is weak and muffled
The sound is very weak and muffled.
How do I make it loud and clear? Compare to generated wav files it pales in comparison.
I thought about this.
It's using THREE.PositionalAudio()
, so getting closer it becomes louder, but it's still very dull and muffled.
I was able to make it louder by calling setRefDistance()
and setDirectionalCone()
functions in src/three.js/awspack/TextToSpeechFeature.js
:
// Create positional audio if there's an attach point
result.threeAudio = new THREE.PositionalAudio(this._listener);
result.threeAudio.setRefDistance(5);
result.threeAudio.setDirectionalCone(90, 90, 0.5);
console.log('Audio made louder!');
Hey @IvanFarkas, that is correct for the positional audio. There is existing functionality to support creating a THREE.Audio
which is a global audio source, when the _attachTo
property is undefined. However, this value currently defaults to the host object itself when not specified in the TextToSpeechFeature
constructor.
if (this._attachTo !== undefined) {
// Create positional audio if there's an attach `point`
result.threeAudio = new THREE.PositionalAudio(this._listener);
this._attachTo.add(result.threeAudio);
} else {
// Create non-positional audio
result.threeAudio = new THREE.Audio(this._listener);
}
An option could be added to the TextToSpeechFeature
constructor, like isGlobal
, that would indicate when a non-positional audio source should be used for the speech.
Hi @jkerste. I like your isGlobal
idea.
Hey @IvanFarkas this feature is now merged into mainline. You can set up the TextToSpeech as "global audio" by modifying the options passed into the TextToSpeech constructor like:
// Set up text to speech
host.addFeature(HOST.aws.TextToSpeechFeature, false, {
scene,
attachTo: audioAttachJoint,
isGlobal: true,
voice,
engine,
});