# ClassCastException using ttslib

**URL:** <https://discourse.processing.org/t/classcastexception-using-ttslib/45805>\
**Category:** Libraries\
**Created:** [February 20, 2025, 4:51pm UTC](https://discourse.processing.org/t/classcastexception-using-ttslib/45805 "2025-02-20T16:51:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![john55](https://avatars.discourse-cdn.com/v4/letter/j/ea5d25/32.png) [@john55](https://discourse.processing.org/u/john55)\
**Post date:** [February 20, 2025, 4:51pm UTC](https://discourse.processing.org/t/classcastexception-using-ttslib/45805/1 "2025-02-20T16:51:20Z")

</div>

Running ttstest example sketch on Mac results in ClassCastException.

ClassCastException: class com.sun.speech.freetts.en.us.cmu\_time\_awb.AlanVoiceDirectory cannot be cast to class com.sun.speech.freetts.VoiceDirectory (com.sun.speech.freetts.en.us.cmu\_time\_awb.AlanVoiceDirectory is in unnamed module of loader com.sun.speech.freetts.DynamicClassLoader @6d861d6a; com.sun.speech.freetts.VoiceDirectory is in unnamed module of loader ‘app’)

Code:

```Processing
import guru.ttslib.*;

TTS tts;

void setup() {
  size(100,100);
  smooth();
  tts = new TTS();
}

void draw() {
  background(255);
  fill(255);
  ellipse( 35, 30, 25, 35 );
  ellipse( 65, 30, 25, 35 );
  fill(0);
  ellipse( 40, 35, 10, 10 );
  ellipse( 60, 35, 10, 10 );
  noFill();
  arc(50,50,50,50,0,PI);
  
}

void mousePressed() {
  tts.speak("Hi! I am a speaking Processing sketch");
}

```

ttslib 0.4  
processing 4.3.2  
macOS Sequoia 15.3

---

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [February 20, 2025, 10:21pm UTC](https://discourse.processing.org/t/classcastexception-using-ttslib/45805/2 "2025-02-20T22:21:06Z")

</div>

I tried using Processing 3.5.4 - installed the library through the contributions manager and ran the library example and it worked.

The library is very old and I suspect that it has not been updated for Processing 4 😢

---

<div class="post-metadata">

**Author:** ![john55](https://avatars.discourse-cdn.com/v4/letter/j/ea5d25/32.png) [@john55](https://discourse.processing.org/u/john55)\
**Post date:** [February 21, 2025, 2:10am UTC](https://discourse.processing.org/t/classcastexception-using-ttslib/45805/3 "2025-02-21T02:10:23Z")

</div>

Thanks for the quick response.
