ClassCastException using ttslib

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:

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

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 :cry:

2 Likes

Thanks for the quick response.

1 Like