# Blocking in ttslib

**URL:** <https://discourse.processing.org/t/blocking-in-ttslib/39160>\
**Category:** Libraries\
**Created:** [October 8, 2022, 12:26pm UTC](https://discourse.processing.org/t/blocking-in-ttslib/39160 "2022-10-08T12:26:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shachar](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@Shachar](https://discourse.processing.org/u/Shachar)\
**Post date:** [October 8, 2022, 12:26pm UTC](https://discourse.processing.org/t/blocking-in-ttslib/39160/1 "2022-10-08T12:26:35Z")

</div>

hi, I’m trying to use ttslib in order to apply text recognition in my code. The problem is that the code does not continue until the entire sentence has been completed, so for example in this code the word “hello” will not be printed until the entire text has been completed.

> tts.speakLeft( “I am on the left” );  
> print(“hello”);

I’ve tried to use threads for this but I’m not sure how to apply it.  
I would appreciate any help! thanks in advance!

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [October 8, 2022, 1:02pm UTC](https://discourse.processing.org/t/blocking-in-ttslib/39160/2 "2022-10-08T13:02:11Z")

</div>

> [@Shachar](#):
>
> I’ve tried to use threads for this but I’m not sure how to apply it.

Can you show us your attempt of using **thread()**?

> **[thread() / Reference](https://processing.org/reference/thread_.html)**
>
> Processing sketches follow a specific sequence of steps: setup() first, followed by draw() over and over and over again in a loop. A thread is also a series of steps with a beginning, a …

---

<div class="post-metadata">

**Author:** ![Shachar](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@Shachar](https://discourse.processing.org/u/Shachar)\
**Post date:** [October 8, 2022, 2:17pm UTC](https://discourse.processing.org/t/blocking-in-ttslib/39160/3 "2022-10-08T14:17:45Z")

</div>

Hi! Thank you very much for the reply:)  
I’ve managed to solve it by now but I have one question left: is it possible to pass parameters to the method I’m calling in the thread?

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [October 8, 2022, 2:20pm UTC](https://discourse.processing.org/t/blocking-in-ttslib/39160/4 "2022-10-08T14:20:18Z")

</div>

> [@Shachar](#):
>
> Is it possible to pass parameters to the method I’m calling in the thread?

No. You’d need to rely on “global” variables or create an actual [Thread](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Thread.html) subclass:

---

<div class="post-metadata">

**Author:** ![Shachar](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@Shachar](https://discourse.processing.org/u/Shachar)\
**Post date:** [October 8, 2022, 2:22pm UTC](https://discourse.processing.org/t/blocking-in-ttslib/39160/5 "2022-10-08T14:22:02Z")

</div>

great, thank you very much!

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [October 8, 2022, 2:25pm UTC](https://discourse.processing.org/t/blocking-in-ttslib/39160/6 "2022-10-08T14:25:22Z")

</div>

Hi

[https://www.local-guru.net/blog/pages/ttslib](https://www.local-guru.net/blog/pages/ttslib)
