Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
| 
                    pocketsphinx [Le 12/01/2014, 10:20] mmaura [modèles français]  | 
                
                    pocketsphinx [Le 11/09/2022, 11:43] (Version actuelle) moths-art Suppression des espaces en fin de ligne (détecté et corrigé via le bot wiki-corrector (https://forum.ubuntu-fr.org/viewtopic.php?id=2067892)  | 
            ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | {{tag>logiciels audio}} | ||
| <note important>Cette page est en cours de rédaction</note> | <note important>Cette page est en cours de rédaction</note> | ||
| + | ====== Pocketsphinx ====== | ||
| - | ====== Installation ====== | + | **Pocketsphinx** est une librairie permettant d'intégrer la reconnaissance vocale dans vos projets écrit en language C à l'aide des fonctionnalités du projet open source [[http://cmusphinx.sourceforge.net/|CMUSphinx]]. | 
| - | ===== à partir des dépôts ===== | + | |
| - | <note warning>Les paquet présent dans raring semblent ne pas fonctionner</note> | + | ===== Installation ===== | 
| + | ==== À partir des dépôts ==== | ||
| - | Installer les paquets **[[apt>python-pocketsphinx libpocketsphinx1 gstreamer0.10-pocketsphinx python-pyaudio]]** | + | [[:tutoriel:comment_installer_un_paquet|Installer les paquets]] **[[apt>python-pocketsphinx libpocketsphinx1 gstreamer1.0-pocketsphinx python-pyaudio]]**. | 
| + | Ou dans un [[:terminal]] avec les droits [[:sudo|administrateurs]] : | ||
| <code> | <code> | ||
| - | apt-get install python-pocketsphinx libpocketsphinx1 gstreamer0.10-pocketsphinx python-pyaudio | + | sudo apt-get install python-pocketsphinx libpocketsphinx1 gstreamer1.0-pocketsphinx python-pyaudio | 
| </code> | </code> | ||
| - | ===== à partir des sources ===== | ||
| - | D'abord il faut installer les dépendances | + | ==== À partir des sources ==== | 
| + | D'abord il faut installer les dépendances dans un [[:terminal]] avec les droits [[:sudo|administrateurs]] : | ||
| <code> | <code> | ||
| sudo apt-get build-dep pocketsphinx | sudo apt-get build-dep pocketsphinx | ||
| Ligne 19: | Ligne 22: | ||
| </code> | </code> | ||
| - | ==== sphinxbase ==== | + | === sphinxbase === | 
| On récupère ensuite les sources de **sphinxbase-0.8** | On récupère ensuite les sources de **sphinxbase-0.8** | ||
| Ligne 28: | Ligne 31: | ||
| <code> | <code> | ||
| tar -xvzf sphinxbase-0.8.tar.gz | tar -xvzf sphinxbase-0.8.tar.gz | ||
| + | </code> | ||
| + | On ce rend dans le dossier pour préparer l'installation | ||
| + | <code> | ||
| + | cd sphinxbase-0.8/ | ||
| </code> | </code> | ||
| On compile | On compile | ||
| + | |||
| + | <code> | ||
| + | ./configure --prefix=/usr/local | ||
| + | make | ||
| + | sudo make install | ||
| + | </code> | ||
| + | |||
| + | |||
| <note important> | <note important> | ||
| Si vous avez l'erreur : | Si vous avez l'erreur : | ||
| Ligne 52: | Ligne 67: | ||
| </code> | </code> | ||
| </note> | </note> | ||
| - | <code> | ||
| - | ./configure --prefix=/usr/local | ||
| - | make | ||
| - | sudo make install | ||
| - | </code> | ||
| - | |||
| - | ==== pocketsphinx ==== | + | === pocketsphinx === | 
| <code> | <code> | ||
| wget -O pocketsphinx-0.8.tar.gz http://sourceforge.net/projects/cmusphinx/files/pocketsphinx/0.8/pocketsphinx-0.8.tar.gz/download | wget -O pocketsphinx-0.8.tar.gz http://sourceforge.net/projects/cmusphinx/files/pocketsphinx/0.8/pocketsphinx-0.8.tar.gz/download | ||
| Ligne 69: | Ligne 78: | ||
| </code> | </code> | ||
| - | ===== modèles français ===== | + | === Modèles français === | 
| Téléchargement: | Téléchargement: | ||
| <code> | <code> | ||
| - | wget -O lium_french_f0.tar.gz http://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/French%20F0%20Broadcast%20News%20Acoustic%20Model/lium_french_f0.tar.gz/download | + | wget -O lium_french_f0.tar.gz http://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/Archive/French%20F0%20Broadcast%20News%20Acoustic%20Model/lium_french_f0.tar.gz/download | 
| tar -xvzf lium_french_f0.tar.gz | tar -xvzf lium_french_f0.tar.gz | ||
| cd lium_french_f0/ | cd lium_french_f0/ | ||
| Ligne 79: | Ligne 88: | ||
| sudo mv * `pkg-config --variable=modeldir pocketsphinx`/fr_FR/french_f0 | sudo mv * `pkg-config --variable=modeldir pocketsphinx`/fr_FR/french_f0 | ||
| - | wget -O french3g62K.lm.dmp.bz2 http://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/French%20Language%20Model/french3g62K.lm.dmp.bz2/download | + | wget -O french3g62K.lm.dmp http://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/French/fr.lm.dmp/download | 
| - | bzip2 -d french3g62K.lm.dmp.bz2 | + | sudo mkdir -p `pkg-config --variable=modeldir pocketsphinx`/fr_FR/ | 
| - | sudo mv french3g62K.lm.dmp /usr/share/pocketsphinx/model/FR/ | + | sudo mv french3g62K.lm.dmp `pkg-config --variable=modeldir pocketsphinx`/fr_FR/ | 
| - | + | ||
| - | wget -O frenchWords62K.dic http://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/French%20Language%20Model/frenchWords62K.dic/download | + | |
| - | sudo mv frenchWords62K.dic /usr/share/pocketsphinx/model/FR/ | + | |
| - | + | ||
| - | + | ||
| - | wget -O lium_french_f2.tar.gz http://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/French%20F2%20Telephone%20Acoustic%20Model/lium_french_f2.tar.gz/download | + | |
| + | wget -O frenchWords62K.dic http://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/French/fr.dict/download | ||
| + | sudo mv frenchWords62K.dic `pkg-config --variable=modeldir pocketsphinx`/fr_FR/ | ||
| </code> | </code> | ||
| ===== Bon alors, est ce que ça marche ? ===== | ===== Bon alors, est ce que ça marche ? ===== | ||
| ==== pocketsphinx_continuous ==== | ==== pocketsphinx_continuous ==== | ||
| + | Vous pouvez alors lancer la reconnaissance vocale depuis le micro directement avec la commande pocketsphinx_continuous. | ||
| + | Il faut simplement préciser un dictionnaire à utiliser, un modèle de langage et un modèle de Markov caché (Hidden Markov Model ou HMM). | ||
| + | Si vous avez installé pocketsphinx avec le gestionnaire de paquets, le répertoire contenant les modèles est /usr/share/pocketsphinx/model/. | ||
| + | Pour utiliser les modèles en français que vous venez de télécharger en suivant les instructions ci-dessus, il faut exécuter la commande : | ||
| <code> | <code> | ||
| - | pocketsphinx_continuous -dict /usr/share/pocketsphinx/model/FR/frenchWords62K.dic -hmm /usr/share/pocketsphinx/model/FR/ -lm /usr/share/pocketsphinx/model/FR/french3g62K.lm.dmp | + | pocketsphinx_continuous -dict /usr/share/pocketsphinx/model/fr_FR/frenchWords62K.dic -hmm /usr/share/pocketsphinx/model/fr_FR/french_f0/ -lm /usr/share/pocketsphinx/model/fr_FR/french3g62K.lm.dmp -inmic yes | 
| </code> | </code> | ||
| + | |||
| + | Si vous l'avez compilé depuis les sources comme indiqué plus haut, le répertoire contenant les modèles est /usr/local/share/pocketsphinx/model/  . Il faudra alors exécuter la commande : | ||
| + | |||
| + | <code> | ||
| + | pocketsphinx_continuous -dict /usr/local/share/pocketsphinx/model/fr_FR/frenchWords62K.dic -hmm /usr/local/share/pocketsphinx/model/fr_FR/french_f0/ -lm /usr/local/share/pocketsphinx/model/fr_FR/french3g62K.lm.dmp -inmic yes | ||
| + | </code> | ||
| + | |||
| + | Plutôt que d'utiliser le micro en entrée, vous pouvez spécifier un fichier audio d'entrée au format wav en remplaçant l'option -inmic yes par -infile <fichier_audio.wav> | ||
| + | |||
| ==== scripts python ==== | ==== scripts python ==== | ||
| Ligne 300: | Ligne 318: | ||
| os.system(cm) | os.system(cm) | ||
| </code> | </code> | ||
| - | ====== références ====== | + | ===== Références ===== | 
| - | + | ||
| - | Site officiel : http://cmusphinx.sourceforge.net/wiki/download/ | + | |
| - | + | ||
| - | Python audio : http://people.csail.mit.edu/hubert/pyaudio/docs/ | + | |
| - | Exemple en python: http://pythonism.wordpress.com/2013/06/06/pocketsphinx-voice-recognition-with-python/ | + | * Site officiel : http://cmusphinx.sourceforge.net/wiki/download/ | 
| + | * Github : https://github.com/cmusphinx/pocketsphinx | ||
| + | * Python audio : http://people.csail.mit.edu/hubert/pyaudio/docs/ | ||
| + | * http://stackoverflow.com/questions/8567366/geting-ioerror-errno-input-overflowed-9981-when-setting-pyaudio-stream-input | ||
| + | * installer sur raspberry pi :https://stackoverflow.com/questions/17778532/raspberrypi-pocketsphinx-ps3eye-error-failed-to-open-audio-device | ||
| - | http://stackoverflow.com/questions/8567366/geting-ioerror-errno-input-overflowed-9981-when-setting-pyaudio-stream-input | ||
| - | installer sur raspberry pi :http://stackoverflow.com/questions/17778532/raspberrypi-pocketsphinx-ps3eye-error-failed-to-open-audio-device | ||