Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add natural pauses during speech. #8

Closed
burntcarrot opened this issue Jan 3, 2023 · 1 comment
Closed

Add natural pauses during speech. #8

burntcarrot opened this issue Jan 3, 2023 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@burntcarrot
Copy link
Owner

burntcarrot commented Jan 3, 2023

It would be nice to have some small pauses during speech. Currently, the audio is continuously played, the best way to simulate natural pauses would be to have either a constant duration or a randomized duration for a pause.

The pauses can be triggered on whitespaces.

The current implementation has the following mechanism set up, but the speech sounds monotonic. Investigate this.

@burntcarrot burntcarrot added enhancement New feature or request good first issue Good for newcomers labels Jan 3, 2023
burntcarrot pushed a commit that referenced this issue Jan 8, 2023
* feat: add random intervals to timeouts.

I add a function to generate random timeouts for the execution of the speak function. This adds a more natural speech as was intended by the issue #8.

* refactor: reorganize code by using functions.

* refactor: change  to number.

* fix: write to dialogueText now matches the speak timeout.

* feat: add extra treatment to remove extra white spaces.

* docs: update some of the JSDocs to match new functions.

* refactor: separate white space treatments to its own function.

* refactor: make random intervals relative to interval chosen.

Now, all the random intervals are inversely proportional to the interval
chosen. Which means:

  + if the interval chosen is low, the random interval is high.
  + if the interval chosen is high, the random interval is low.

This makes the voices more natural.

* refactor: remove unecessary console.log.

* fix: make only one audio context available for the code.

* refactor: follow suggestions for refactoring.
@burntcarrot
Copy link
Owner Author

Resolved via #9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant