Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
marytts [2016/02/19 00:08] mai created |
marytts [2019/04/25 14:08] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Mary Text-To-Speech ====== | ||
+ | {{tag> software poppy project poppy-kine}} | ||
+ | |||
+ | MaryTTS is an open-source text to speech system: http://mary.dfki.de/ and http://mary.dfki.de:59125/ and https://github.com/marytts/marytts | ||
+ | |||
+ | The main output of this project is a java program PGI_I15.jar. We have developed an API so for Poppy in the [[poppy-kine:poppy-kine-2015-s5]] project. The API is available in Java and python. The report of the project his available at {{report:rapport_mgp320-i15_josselin_fayard_tom_veillard.pdf|}} | ||
+ | |||
+ | ===== Utilisation de MaryTTS et téléchargement de nouvelles voix ===== | ||
+ | |||
+ | Trois programmes pour linux et windows sont fournis directement après le téléchargement de MaryTTS dans le dossier « bin » : | ||
+ | |||
+ | • Marytts-server | ||
+ | |||
+ | • Marytts-client | ||
+ | |||
+ | • Marytts-component-installer | ||
+ | |||
+ | |||
+ | Le premier programme permet de lancer un serveur MaryTTS sur une machine. C’est ce programme qui sera utilisé par la suite. | ||
+ | |||
+ | Le second est un client basque qui permet via une interface graphique de tester MaryTTS. | ||
+ | |||
+ | Le troisième permet de télécharger des nouvelles voix pour le serveur MaryTTS. Il se présente sous la forme suivante : | ||
+ | |||
+ | |||
+ | {{ ::mary-component-installer.png?600 |}} | ||
+ | |||
+ | On peut donc très facilement installer ou désinstaller des voix pour le serveur. Elle seront sauvegardées dans le dossier « installed » et dans le dossier « lib ». | ||
+ | |||
+ | Les voix que nous avons utilisées sont : | ||
+ | FR : //enst-dennys-hsmm// | ||
+ | EN-US : //cmu-rms-hsmm// | ||
+ | |||
+ | ===== Utilisation via Java ===== | ||
+ | |||
+ | |||
+ | Pour utiliser MaryTTS via un programme en Java, deux méthode sont possible : | ||
+ | |||
+ | • Créer une interface de type « MaryInterface » | ||
+ | |||
+ | • Utiliser une requête HTTP comme pour WebService | ||
+ | |||
+ | Il est donc possible d’utiliser MaryTTS via n’importe quel langage car il sera toujours possible d’utiliser la méthode qui utilise une requête HTTP. Ici, seule la méthode qui utilise l’interface « MaryInterface » sera développée. | ||
+ | |||
+ | Ci-dessous, quelques exemple de méthode de l’interface MaryInterface : | ||
+ | |||
+ | <code java> | ||
+ | /* création de l'interface vers le serveur MaryTT local */ | ||
+ | String host="localhost"; | ||
+ | int port = 59125; | ||
+ | MaryInterface marytts = new RemoteMaryInterface(host, port); | ||
+ | |||
+ | /* retourne un String contenant la liste des voix disponible en anglais US */ | ||
+ | String languesDispo = marytts.getAvailableVoices(Locale.US) | ||
+ | |||
+ | /* Selectionner la première voix disponible dans une langue */ | ||
+ | String country="fr"; | ||
+ | Set<String> voices = marytts.getAvailableVoices(setLocale(country)); | ||
+ | marytts.setVoice(voices.iterator().next()); | ||
+ | |||
+ | /* Afficher la voix selectionnée */ | ||
+ | System.out.println("Active voice : " + marytts.getVoice()); | ||
+ | |||
+ | /* Demander au serveur de générer un fichier audio */ | ||
+ | String sentence = ("Ceci est une phrase de test"); | ||
+ | AudioInputStream audio = marytts.generateAudio(sentence); | ||
+ | |||
+ | /* Lire le fichier audio */ | ||
+ | AudioPlayer player = new AudioPlayer(audio); | ||
+ | player.start(); | ||
+ | player.join(); | ||
+ | </code> | ||
+ | |||
+ | |||
+ | ===== Utilisation de l'API du projet: ===== | ||
+ | |||
+ | ==== The Java API ==== | ||
+ | |||
+ | |||
+ | Usage: | ||
+ | |||
+ | java example.MaryTTSEmbedded [country part side position] [--help] [-p your_personnal_tts_string country] | ||
+ | |||
+ | ARGUMENTS : | ||
+ | country : en | fr (natively supported) | ||
+ | part : arm | hand | elbow | shoulder | leg | foot | knee | hip | ||
+ | side : left | right | 0 | ||
+ | position : up | down | front | back | left | right | ||
+ | |||
+ | OPTIONS : | ||
+ | -p string country : Use your personal TTS string | ||
+ | |||
+ | ==== The python API==== | ||
+ | |||
+ | python client-mary.py [country part side position] | ||
+ | |||
+ | ARGUMENTS : | ||
+ | country : en | fr (natively supported) | ||
+ | part : arm | hand | elbow | shoulder | leg | foot | knee | hip | ||
+ | side : left | right | 0 | ||
+ | position : up | down | front | back | left | right | ||
+ | |||
+ | ==== How to install ==== | ||
+ | |||
+ | * You need to have the .jar and the python program from {{:software:mgp_i15_jar_py.zip|}}. You will also want to have {{:software:mgp_i15.rar|}} which contains the java HRI for [[poppy-kine:poppy-kine-2015-s5]] project. | ||
+ | * Download MaryTTS from https://github.com/marytts/marytts. Follow the readme to install MaryTTS. More precisely: | ||
+ | * install Maven from http://maven.apache.org/install.html | ||
+ | * Compile the MARY system itself from the folder mary-master where you downloaded the MaryTTS code, with command <code>mvn install</code> | ||
+ | |||
+ | |||
+ | |||
+ | ==== Step to step : running the python program ==== | ||
+ | |||
+ | - In folder marytts-master/target/marytts-5.2-SNAPSHOT/bin where you downloaded MaryTTS), launch marytts server <code> ./marytts-server </code> | ||
+ | - In the folder where you downloaded {{:software:mgp_i15_jar_py.zip|MGP_I15.jar}}, <code>java -jar MGP_I15.jar</code> | ||
+ | - in folder where you downloaded {{:software:mgp_i15_jar_py.zip|client-mary.py}} , launch the python script with for instance the command <code> python client-mary.py fr arm left up</code> | ||