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

refactor speak.js to allow pre-loaded voices. #7

Merged
merged 13 commits into from
Jan 3, 2023
Merged

refactor speak.js to allow pre-loaded voices. #7

merged 13 commits into from
Jan 3, 2023

Conversation

skippyr
Copy link
Contributor

@skippyr skippyr commented Jan 3, 2023

Hello, @burntcarrot. I have refactored the speak.js file, now renamed to script.js. The changes I have done:

  • add documentation to your code.
  • remove some global variables, by replacing them for functions.
  • apply descriptive names to variables.
  • fix the issue Increase dialogue text size on mobile devices #6 by making the font size fixed at 1.5rem and controlling overflow with the overflow rule.
  • fix the issue Add dropdown menu for selecting pre-loaded sounds #3 by creating a selector with some of the options of pre-loaded audio I have found at assets/voice, now renamed to assets/voices. Three of the voices: moo.mp3, santa.wav and woof.mp3 were long, causing the audio to overlap each other, making too much noise. For this reason, I have not used them.

I hope these changes help you.

Sherman Rofeman added 10 commits January 2, 2023 16:34
I have identified that the problem reported in the issue #6 is due to the fact that the dialogue text font size uses the `vw` unit. This make it look small in small screen and look large in large screen size as well. Marked for further refactor.
I have added a voice selector that allows the user to select between the pre-loaded audio files. Later, I will be adding a custom option to insert an audio file. These are the requiments for the issues #3 and #4.
Some of the audio files have not been included because they overlap itself when playing, causing a loud noise: ,  and .
I added a function to avoid the audio to overlap each other.
@vercel
Copy link

vercel bot commented Jan 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
quackspeak ✅ Ready (Inspect) Visit Preview Jan 3, 2023 at 0:23AM (UTC)

Previously, the code was giving the warning 'The AudioContext was not allowed to start'. This commit fixes this issue and adds the @async flag to all the async functions.
@burntcarrot
Copy link
Owner

add documentation to your code.
apply descriptive names to variables.

Thanks for doing this! I didn't focus on writing clean code much; I made this project in ~5 hours as a part of a hackathon where the main theme was to create projects that have no value whatsoever. (I'll need to add this in the README; could you add this a part of the README?)

Three of the voices: moo.mp3, santa.wav and woof.mp3 were long, causing the audio to overlap each other, making too much noise. For this reason, I have not used them.

Yes, I should have let you know about them earlier - the audio files aren't clipped yet.

script.js Outdated Show resolved Hide resolved
@skippyr
Copy link
Contributor Author

skippyr commented Jan 3, 2023

I have changed localVoicesDecodedAudioData to localVoices.

Copy link
Owner

@burntcarrot burntcarrot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thanks for the the work here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increase dialogue text size on mobile devices Add dropdown menu for selecting pre-loaded sounds
2 participants