import com.sun.speech.freetts.audio.AnimatedAudioPlayer; import com.sun.speech.freetts.en.us.AnimatedDiphoneVoice; import com.sun.speech.freetts.en.us.CMULexicon; import com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory; (Web design programs)

import com.sun.speech.freetts.audio.AnimatedAudioPlayer; import com.sun.speech.freetts.en.us.AnimatedDiphoneVoice; import com.sun.speech.freetts.en.us.CMULexicon; import com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory; import com.sun.speech.freetts.relp.Animator; public class Player extends JFrame { private PlayerPanel playerPanel; Constructor The following code constructs the Player frame. It sets the Look and Feel for Swing, and adds a WindowListener in order to react to window close events. It then constructs an Animator object and uses this object to connect the newly created AnimatedDiphoneVoice with the Face GUI object. Finally it constructs the PlayerPanel and creates a data model instance for the player. /** * @see java.awt.Frame#Frame(String) */ public Player(String title) { super(title); // Set Look&Feel for Swing setDefaultLookAndFeelDecorated(true); // WindowListener for close button event handling addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); // Create new Animator object Animator a = new Animator(); // Get URL of the voice database URL url = KevinVoiceDirectory.class.getResource(”cmu_us_kal16.bin”); // Create Voice object // see com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory AnimatedDiphoneVoice voice = new AnimatedDiphoneVoice(”kevin16″, Gender.MALE, Age.YOUNGER_ADULT, “default 16-bit diphone voice”, Locale.US, “general”, “cmu”, new CMULexicon(), url, a); // Use AnimatedAudioPlayer as audio player // for this voice // Register Animator object as LineListener voice.setAudioPlayer(new AnimatedAudioPlayer(a)); // Create Face object Face face = new Face(); // Set face border area face.setBorder(BorderFactory.createEmptyBorder(30, 30, 10, 30)); // Set face size face.setPreferredSize(new Dimension(400, 300)); 107 Project One: Duke Speaks
Our unmatched NT experience allows us to provide the most reliable and affordable hosting for our customers, just check NT Web Hosting services.

Leave a Reply