Loading...
Logo
Processing Forum
I just released a new ttslib version

It can be downloaded on my tts lib project page
This version can use mbrola voices from the processing sketch, if mbrola is installed on the system.

I also wrote a blogpost that explains how mbrola voices can be used from processing
Using Mbrola-Voices with the Processing ttslib

cu guru

Replies(2)

I have installed the tts library and gotten the example working. I also found some example code on the old forum for a 'Basnik' class and got that working too, but now I'm trying to write my own program that speaks letters and characters.

An important thing is though that the pitch or tone of the voice changes with my control - I have an array of letters and luminance values (0-255) and I want the letter to be read out but the pitch to change according to the luminance value.

I saw voice.setPitch in the Basnick class (code below) but changing it doesn't alter the voice.  Having little experience I'm still learning how classes work and the freetts documentation isn't as friendly as Processing's so I can't fathom where all the functions in the basnick class come from what they do and how to get them into processing. Have you got any pointers please?

I tried to modify the tts example: 

...
Copy code
  1. void mousePressed() {
  2.   tts.setPitch(1);
  3.   tts.speak( "Hello this is a test.");
  4. }

but get error "The function setPitch(int) does not exist" where as this doesn't occur in the example below which runs fine.

Basnik example below.



In Tab 2
Copy code
  1. import guru.ttslib.*;

    public class Basnik {
Copy code
  1.   String voiceName = "kevin16";
  2.   VoiceManager voiceManager;
  3.   Voice voice; 

  4.   Basnik(String name) {
  5.     voiceName = name;     
  6.     this.setup();
  7.   }


  8.   void listAllVoices() {
  9.     System.out.println();
  10.     System.out.println("All voices available:");   
  11.     VoiceManager voiceManager = VoiceManager.getInstance();
  12.     Voice[] voices = voiceManager.getVoices();
  13.     for (int i = 0; i < voices.length; i++) {
  14.       System.out.println("    " + voices[i].getName()
  15.         + " (" + voices[i].getDomain() + " domain)");
  16.     }
  17.   }

  18.   void setup() {
  19.     listAllVoices();
  20.     System.out.println();
  21.     System.out.println("Using voice: " + voiceName);

  22.     voiceManager = VoiceManager.getInstance();
  23.     voice = voiceManager.getVoice(voiceName);

  24.     voice.setPitch(1.75);
  25.     voice.setPitchShift(0.75);
  26.     // voice.setPitchRange(10.1); //mutace
  27.     voice.setStyle("breathy");  //"business", "casual", "robotic", "breathy"

  28.     if (voice == null) {
  29.       System.err.println(
  30.       "Cannot find a voice named "
  31.         + voiceName + ".  Please specify a different voice.");
  32.       System.exit(1);
  33.     }
  34.     voice.allocate();
  35.   }

  36.   void mluv(String _a) {     

  37.     if(_a==null) {
  38.       _a= "nothing";
  39.     }
  40.     voice.speak(_a);
  41.   }

  42.   void exit() {
  43.     voice.deallocate();
  44.   }
  45. }
In Tab 1

Copy code
  1. void setup(){
     verlaine = new Basnik("kevin16");
     verlaine.mluv("hello, ohtravioso, do you hear me?") ;
    }  
Hi, 

Basnik  doesn't use my wrapper-class, but he uses the voicemanager of freetts directly. 

But i like the idea of changing the voice pitch. I think i will include it the next version.

cu guru