amazon-sumerian-hosts icon indicating copy to clipboard operation
amazon-sumerian-hosts copied to clipboard

Sound is weak and muffled

Open IvanFarkas opened this issue 3 years ago • 4 comments

The sound is very weak and muffled.

How do I make it loud and clear? Compare to generated wav files it pales in comparison.

IvanFarkas avatar Jun 27 '21 00:06 IvanFarkas

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!');

IvanFarkas avatar Jun 27 '21 00:06 IvanFarkas

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.

jkerste avatar Jun 30 '21 18:06 jkerste

Hi @jkerste. I like your isGlobal idea.

IvanFarkas avatar Jul 15 '21 16:07 IvanFarkas

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,
});

jkerste avatar Sep 21 '21 23:09 jkerste