# Voice spelling letters and numbers with p5.js

**URL:** <https://discourse.processing.org/t/voice-spelling-letters-and-numbers-with-p5-js/3468>\
**Category:** Libraries\
**Created:** [September 11, 2018, 5:33pm UTC](https://discourse.processing.org/t/voice-spelling-letters-and-numbers-with-p5-js/3468 "2018-09-11T17:33:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TeslaVector](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/teslavector/32/1489_2.png) [@TeslaVector](https://discourse.processing.org/u/TeslaVector)\
**Post date:** [September 11, 2018, 5:33pm UTC](https://discourse.processing.org/t/voice-spelling-letters-and-numbers-with-p5-js/3468/1 "2018-09-11T17:33:19Z")

</div>

Hi guys!

I have a BIG problem. ☹ I make program when user push button like ‘a’, ‘s’, ‘g’, ‘0-9’ etc. The Program repeats letters with voice command. It is useful for blind person. Problem is when users fast typing. If you typing (fast) “My name is John”, program voice tell you first letter ‘M’ and then ‘N’,‘N’,‘N’…‘N’ It repeat only ‘N’, but if you typing (slow) it is ok. Does anybody know how this resolve?

You can looked code on CodePen: [link](https://codepen.io/Spacman/project/editor/Xqkmyg)

Please help me!

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [September 12, 2018, 3:53pm UTC](https://discourse.processing.org/t/voice-spelling-letters-and-numbers-with-p5-js/3468/2 "2018-09-12T15:53:19Z")

</div>

I thought at first the problem was the `rate()` attribute for the Speech object. However I looked at the documentation [here](https://w3c.github.io/speech-api/speechapi.html#tts-section) and the rate just defines the speed of sound generation, aka fast or sloooww enunciation. I believe the problem is that you are detecting your key strokes in `draw()` directly. Unfortunately I was not able to modify the code pen to test this, something odd with my current network. I suggest you generate a sound only when a key is pressed.

Kf

---

<div class="post-metadata">

**Author:** ![TeslaVector](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/teslavector/32/1489_2.png) [@TeslaVector](https://discourse.processing.org/u/TeslaVector)\
**Post date:** [September 12, 2018, 9:39pm UTC](https://discourse.processing.org/t/voice-spelling-letters-and-numbers-with-p5-js/3468/3 "2018-09-12T21:39:02Z")

</div>

First thank you so much for help, man! 😀

I resolved problem ([solution](https://jsfiddle.net/TeslaVector/tha3y9gL/)). Now that is OK, but I think the voice is late. I am set rate() on maximum, but that is still slow. It doesn’t work instantly. Why is it happens? Does it problem with framework?. 😕

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [September 13, 2018, 7:33am UTC](https://discourse.processing.org/t/voice-spelling-letters-and-numbers-with-p5-js/3468/4 "2018-09-13T07:33:14Z")

</div>

I am not familiar with this library but based on [this](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis/pending) it seems that there is a queue and the letters are managed through this queue. You will always face a challenge as some people can type faster than the time it takes to speaks those letters being typed. As a programmer, you need to identify this situation and defined strategies to handle it. Would you put a constraint (you might have to) limiting the speed you can type? Or would you only pronounce the letters if the typing is slower than certain typing speed?

You can always explore in google and see how people are approaching this problem of speech vs. typing speed. Or you could go into literature and find people that are working in these concepts, not only the text to speech but also speech tools designed for the visually impair.

Kf
