<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Hakim Bahati on Medium]]></title>
        <description><![CDATA[Stories by Hakim Bahati on Medium]]></description>
        <link>https://medium.com/@frrehakimbahati?source=rss-ca0bfe5e6e9f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Yw6hfBtLQshxxPyF.</url>
            <title>Stories by Hakim Bahati on Medium</title>
            <link>https://medium.com/@frrehakimbahati?source=rss-ca0bfe5e6e9f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 05:47:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@frrehakimbahati/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Super choix d’article technique !]]></title>
            <link>https://medium.com/@frrehakimbahati/super-choix-darticle-technique-30b4c179b85d?source=rss-ca0bfe5e6e9f------2</link>
            <guid isPermaLink="false">https://medium.com/p/30b4c179b85d</guid>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Hakim Bahati]]></dc:creator>
            <pubDate>Wed, 21 May 2025 13:09:51 GMT</pubDate>
            <atom:updated>2025-05-21T13:09:51.556Z</atom:updated>
            <content:encoded><![CDATA[<h3>Super choix d’article technique ! Voici un <strong>tutoriel complet “Créer un assistant vocal avec Python en 15 minutes”</strong>, structuré comme un article Medium, prêt à publier (code inclus, simple et fonctionnel). Ce projet est <strong>idéal pour initier les lecteurs à la reconnaissance vocale et à la synthèse vocale</strong>, tout en gardant le code accessible.</h3><h3>🗣️ Créer un assistant vocal avec Python en 15 minutes</h3><h3>🎯 Objectif : Créer un assistant vocal simple qui :</h3><ul><li><strong>Écoute votre voix</strong></li><li><strong>Comprend ce que vous dites</strong></li><li><strong>Vous répond par la voix</strong></li></ul><h3>🧰 Prérequis</h3><p>Installez ces bibliothèques via pip :</p><pre>pip install speechrecognition pyttsx3 pyaudio</pre><blockquote><em>⚠️ Si </em><em>pyaudio donne une erreur sous Windows, essayez :</em></blockquote><pre>pip install pipwin<br>pipwin install pyaudio</pre><h3>🧠 Étape 1 : Importer les modules</h3><pre>import speech_recognition as sr<br>import pyttsx3</pre><h3>🗣️ Étape 2 : Initialiser la synthèse vocale</h3><pre>engine = pyttsx3.init()</pre><pre>def parler(texte):<br>    engine.say(texte)<br>    engine.runAndWait()</pre><h3>🎤 Étape 3 : Reconnaître la voix</h3><pre>def ecouter():<br>    r = sr.Recognizer()<br>    with sr.Microphone() as source:<br>        print(&quot;🎧 Je vous écoute...&quot;)<br>        audio = r.listen(source)</pre><pre>    try:<br>        texte = r.recognize_google(audio, language=&quot;fr-FR&quot;)<br>        print(f&quot;Vous avez dit : {texte}&quot;)<br>        return texte<br>    except sr.UnknownValueError:<br>        print(&quot;Désolé, je n’ai pas compris.&quot;)<br>        parler(&quot;Je n’ai pas compris.&quot;)<br>        return &quot;&quot;<br>    except sr.RequestError:<br>        print(&quot;Erreur avec le service de reconnaissance.&quot;)<br>        parler(&quot;Problème de connexion.&quot;)<br>        return &quot;&quot;</pre><h3>🤖 Étape 4 : Créer un comportement basique</h3><pre>def repondre(texte):<br>    texte = texte.lower()<br>    if &quot;bonjour&quot; in texte:<br>        parler(&quot;Bonjour ! Comment puis-je vous aider ?&quot;)<br>    elif &quot;ton nom&quot; in texte:<br>        parler(&quot;Je suis un assistant vocal créé avec Python.&quot;)<br>    elif &quot;au revoir&quot; in texte:<br>        parler(&quot;Au revoir ! À bientôt.&quot;)<br>        exit()<br>    else:<br>        parler(&quot;Je n’ai pas encore appris cela.&quot;)</pre><h3>🔁 Étape 5 : Boucle principale</h3><pre>while True:<br>    commande = ecouter()<br>    if commande:<br>        repondre(commande)</pre><h3>✅ Résultat</h3><p>Dès que vous exécutez le script, votre micro s’active. Vous pouvez dire :</p><ul><li>“Bonjour” → Il vous répond</li><li>“Quel est ton nom ?” → Il vous dit son nom</li><li>“Au revoir” → Il s’arrête</li></ul><h3>🚀 Et ensuite ?</h3><ul><li>Connectez-le à une API (météo, Google Search, ChatGPT)</li><li>Ajoutez une interface graphique</li><li>Enregistrez l’historique des commandes</li></ul><h3>🧑‍💻 Code source complet (copier/coller) :</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30b4c179b85d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>