From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from o16.ptr6223.mail.beehiiv.com (o16.ptr6223.mail.beehiiv.com [159.183.141.192]) by sourceware.org (Postfix) with ESMTPS id E3E9838582B3 for ; Wed, 3 Jan 2024 10:56:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E3E9838582B3 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=mail.beehiiv.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=em2003.mail.beehiiv.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E3E9838582B3 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=159.183.141.192 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704279393; cv=none; b=K14Jfx5wAOBIeVZwLAJjOmOluhrOgJIbbQ0yGM0voRUvtlrvxldY65h/WVQIs1YURNpnwNOZ2l77/EGn1/JC26KmS+NI+L53oYg8BDDrIBgivr0jmtrkZV3uYJEuKD/opgtwQtlisi2ReW1xK4LOedPmsZPqWVVHeiOfixjB+zw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704279393; c=relaxed/simple; bh=uJvElOT47X7kXU4IoXzk/zrGfQ/JCGi4MuWL1FVBi2w=; h=DKIM-Signature:Date:From:Mime-Version:Message-ID:Subject:To; b=wA480ML92oN1AXnS075JkgipbqPugb9fybPJCjk2eQILZpRetowcA0MzINuiON9cSrfJlAQ81NA/Jhh8Ci/1iuhbPNwQFCBqTbcRGbt26ApN75mI7guZ0a+YU7rjWGntZ7M2rlMka4K/y+k9NRwW3MjjtYkM0z0NuAfTRCrbVZo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.beehiiv.com; h=content-type:from:mime-version:subject:reply-to:list-unsubscribe:to: cc:content-type:from:subject:to; s=s1; bh=vsHZTLmyZKUVtC+dMXR+aGmLQNy1iSJ/Krs83eWOAJc=; b=aino2hkXhPPVIApDApCn+fBvXu5c9Du1ZQAhjmDtIAZxTInUFsT6Y0lgjxJOkas6chyL K+Ttozdp20/RLKqwXlDektqEM1GJaS5YiS3ahrE2KoaIbNJx0G6hGs25jkeDn/2k/IT1Q6 ppj+YWxZaUmR+J3tr1PSCxF/JJNM4PaRSzKCalot5eOZt5VHDBnBS1oUxLNNFAdqqEFnmD N/mtF/chbvMFIOlqsWDPo0OThuO7QHpqb4mZLYtFgRmuey01cCqONeZq0JFE8OMwdoqona jhIY8a3lUs6ibVDWk+YNz8i8QrbccH1+yk4OAjwA1+ngBf4OIwa5ibgC4lkQ070w== Received: by filterdrecv-655bd866f5-c4wvc with SMTP id filterdrecv-655bd866f5-c4wvc-1-65953D52-13 2024-01-03 10:56:18.186470986 +0000 UTC m=+1968790.003790975 Received: from Mzk2NzA0Mjk (unknown) by geopod-ismtpd-14 (SG) with HTTP id 57iEd8UBR-C3RPhFWI3NUg Wed, 03 Jan 2024 10:56:18.147 +0000 (UTC) Content-Type: multipart/alternative; boundary=f71d1222d5d20e04ed5da0698835b447456e2edf2a8712ebf60a7233acc9 Date: Wed, 03 Jan 2024 10:56:30 +0000 (UTC) From: Blue Writers Mime-Version: 1.0 Message-ID: <57iEd8UBR-C3RPhFWI3NUg@geopod-ismtpd-14> Subject: How I Built a Voice Imitator with Python Step-by-Step Reply-To: Blue Writers List-Unsubscribe: =?us-ascii?Q?=3Cmailto=3A205c6e43-b34b-4c5a-a08d-ec6d790df0c9+854a4378-dc72-4ea?= =?us-ascii?Q?0-b4cc-0efa226647fd+447a1ee4-48e0-4977-?= =?us-ascii?Q?b270-e6c14d7b7a55=40unsub=2Ebeehiiv=2Ecom=3E=2C?= =?us-ascii?Q?_=3Chttps=3A=2F=2Fbluewriters=2Ebeehiiv=2Ecom=2Fsubscribe=2F854a4378-dc72-4ea0-?= =?us-ascii?Q?b4cc-0efa226647fd=2Fmanage=3Fpost=5Fid=3D447a1e?= =?us-ascii?Q?e4-48e0-4977-b270-e6c14d7b7a55=3E?= x-beehiiv-ids: =?us-ascii?Q?{=22account=5Fname=22=3A=22https=3A=2F=2Fbluewriters=2Ebeehiiv=2Ecom=2F=22=2C=22campaign=5Fi?= =?us-ascii?Q?d=22=3A=22447a1ee4-48e0-4977-b270-e6c14d7b7a5?= =?us-ascii?Q?5=22=2C=22category=22=3A=22newsletter=22=2C=22email=5Fgener?= =?us-ascii?Q?ated=5Fat=22=3A1704279377=2C=22user=5Fid=22=3A=22205c6e43?= =?us-ascii?Q?-b34b-4c5a-a08d-ec6d790df0c9=22}?= x-newsletter-signup: https://bluewriters.beehiiv.com/subscribe x-newsletter: https://bluewriters.beehiiv.com/p/built-voice-imitator-python-stepbystep Feedback-ID: =?us-ascii?Q?447a1ee4-48e0-4977-b270-e6c14d7b7a55=3Anewsletter=3A205c6e43-b34b-?= =?us-ascii?Q?4c5a-a08d-ec6d790df0c9=3A70ae014eff15f18?= x-list-id: 205c6e43-b34b-4c5a-a08d-ec6d790df0c9 x-list-owner: x-beehiiv-type: newsletter sId: 205c6e43-b34b-4c5a-a08d-ec6d790df0c9 x-newsletter-id: https://bluewriters.beehiiv.com/ X-SG-EID: =?us-ascii?Q?PHWWMyEVDyq=2FVr658afI0YiNRLIxSpD=2F3wZPafq5IjYL=2F91ne2V0zuVcOgWcue?= =?us-ascii?Q?vh6oI+4hfP7oROrL7qOOtICejzs9tyX6BjlY+yC?= =?us-ascii?Q?dBu+yWmNv31BbfeEab7UoywnJ3R1pBkG6p4aWhy?= =?us-ascii?Q?eQDQotMKYUUVLZA6dTr1THfZdBXSUXHN6lJi=2F3M?= =?us-ascii?Q?V9VupWJinmd2m01wbQbuWqDZDEWI5M1Klkx83Gi?= =?us-ascii?Q?g3sOhlXa+eOeklG9nAr1Ru1d1o7FYSUa7LYXdtO?= =?us-ascii?Q?UEKUq3NDk=2Fr+wGHhk9rdw=3D=3D?= X-SG-ID: =?us-ascii?Q?N2C25iY2uzGMFz6rgvQsb8raWjw0ZPf1VmjsCkspi=2FLxVM69ceEc1HIRn6NgiB?= =?us-ascii?Q?p7Ipegr3bxx9fvamjZ6kwuc7YvgDnbaVyr2eXf+?= =?us-ascii?Q?MZAhArJ5JWrV95UXvWWbRt+yOxgWaEF99AOw926?= =?us-ascii?Q?s6jy6T8mIPCcEMeb61HGGWwRjuv9k2b48Ws8M+F?= =?us-ascii?Q?WXeyuy2OIl3sd8Q3Fw010PPY+xgWoFsfcdfskNE?= =?us-ascii?Q?5bO7b6fgfdsX6EcJEMpcaIB7t8sO+SSRgNBRNwi?= =?us-ascii?Q?iGRzLqLGFhXbDU+eNxPOA=3D=3D?= To: "gcc-rust@gcc.gnu.org" X-Entity-ID: Sn6JQwEy75FLSpra3XaYEQ== X-Spam-Status: No, score=4.4 required=5.0 tests=BAYES_50,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_REPLYTO,HTML_MESSAGE,HTTPS_HTTP_MISMATCH,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP,T_KAM_HTML_FONT_INVALID,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: **** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --f71d1222d5d20e04ed5da0698835b447456e2edf2a8712ebf60a7233acc9 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 Hello, friend What=E2=80=99s up! In today=E2=80=99s article, we will build = together a Voice Imitator with Python, pyttsx3, and SpeechRecognition libra= ries the project is short, simple, and beginner-friendly. View image: (https://images.unsplash.com/photo-1555949963-ff9fe0c870eb?crop= =3Dentropy&cs=3Dtinysrgb&fit=3Dmax&fm=3Djpg&ixid=3DM3w0ODM4NTF8MHwxfHNlYXJj= aHw4fHwlMjBQWVRIT058ZW58MHx8fHwxNzA0MjEwNjM2fDA&ixlib=3Drb-4.0.3&q=3D80&w= =3D1080&utm_source=3Dbeehiiv&utm_medium=3Dreferral) Caption: Photo by Shahadat Rahman on Unsplash # **Ready? Let=E2=80=99s get started!** # **REQUIREMENT** First of all, you need to install Python on your machine if you have Python= on your device skip this To install Python, visit the official Python website: [ _[https://www.pytho= n.org/downloads/](https://www.python.org/downloads/)_ ] and download it **Done? Great!** Now, install the library we will be using for this project To install the library, type this command into your command prompt or termi= nal: ``` pip install SpeechRecognition ``` ``` pip install pyttsx3 ``` **SpeechRecognition**: To record the voice and turn it into a text **pyttsx3**: when the voice returns to a text, the pyttsx3 turns the text i= nto a voice # **Coding Part** # **STEP.1** Import the libraries we=E2=80=99re going to use in our projects Like this: ``` import speech_recognition as sr import pyttsx3 ``` Why =E2=80=9Cas sr=E2=80=9D: To make it short, For example, instead of writ= ing `speech_recognition.Recognizer()`, you can write `sr.Recognizer()` # **STEP.2** ``` rec =3D sr.Recognizer() ``` The line `rec =3D sr.Recognizer()` creates a new Recognizer object called `= rec`. # **STEP.3** ``` with sr.Microphone() as src: print("Say something...") audio =3D rec.listen(src) text =3D rec.recognize_google(audio) ``` `with sr.Microphone() as src:`: This line tells the computer to start liste= ning to the microphone. The microphone is now called `src`. `print("Say something...")`: This line tells the computer to print a messag= e that says "Say something..." to the person using the program. This is a r= eminder for the person to speak into the microphone. `audio =3D rec.listen(src)`: This line tells the computer to listen to the = microphone for a while and store the recorded sound as `audio`. `text =3D rec.recognize_google(audio)`: This line tells the computer to use= Google Speech Recognition to convert the recorded sound (`audio`) into tex= t. The text is stored as `text`. # **STEP.4** ``` engine =3D pyttsx3.init() ``` This line tells the computer to activate the voice synthesizer, which is us= ed to turn text into a voice. # **STEP.5** ``` engine.say(text) ``` This line tells the computer to use the voice generator (`engine`) to read = aloud the text (`text`) that the person just said. It's like pressing the "= play" button on a recording device to listen to what the person just record= ed. # **STEP.6** ``` engine.runAndWait() ``` This line tells the computer to wait until the voice generator (`engine`) h= as finished reading aloud the text (`text`) before moving on to the next st= ep. It's like waiting for the recording to finish playing before turning of= f the device. # **STEP.7** Run the program and say something **NOTE**: If the program doesn=E2=80=99t work try to do this ``` pip install setuptools ``` # **FULL CODE** ``` import speech_recognition as sr import pyttsx3 rec =3D sr.Recognizer() with sr.Microphone() as src: print("Say something...") audio =3D rec.listen(src) text =3D rec.recognize_google(audio) engine =3D pyttsx3.init() engine.say(text) engine.runAndWait() ``` **Ready to share your passion? Easily launch your newsletter **__**[with Be= ehiiv and reach a wider audience.](https://flight.beehiiv.net/v2/clicks/eyJ= hbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cmwiOiJodHRwczovL2ZsaWdodC5iZWVoaWl2L= m5ldC92Mi9jbGlja3MvZXlKaGJHY2lPaUpJVXpJMU5pSXNJblI1Y0NJNklrcFhWQ0o5LmV5SjFj= bXdpT2lKb2RIUndjem92TDNkM2R5NWlaV1ZvYVdsMkxtTnZiUzhfZG1saFBXSnNkV1VtZFhSdFg= zTnZkWEpqWlQxaWJIVmxkM0pwZEdWeWN5NWlaV1ZvYVdsMkxtTnZiU1oxZEcxZmJXVmthWFZ0UF= hKbFptVnljbUZzSm5WMGJWOWpZVzF3WVdsbmJqMXdlWFJvYjI0dGNISnZhbVZqZEMxbWIzSXRZb= VZuYVc1dVpYSnpMV3hsZEMxekxXSjFhV3hrTFhOcGJYQnNaUzFqWVd4amRXeGhkRzl5SWl3aWNH= OXpkRjlwWkNJNklqazNORGRqTURSa0xXSTBObUl0TkRReE55MWlZVEprTFdNME5ETTVaVEprTVR= jek5TSXNJbkIxWW14cFkyRjBhVzl1WDJsa0lqb2lNakExWXpabE5ETXRZak0wWWkwMFl6VmhMV0= V3T0dRdFpXTTJaRGM1TUdSbU1HTTVJaXdpZG1semFYUmZkRzlyWlc0aU9pSmtaRE5pWlRVME1TM= HhObVU1TFRSbE1UTXRZbVl3TnkxaE5EWTRZVGc1WkRSa00yUWlMQ0pwWVhRaU9qRTNNRFF5TURn= Mk16Z3NJbWx6Y3lJNkltOXlZMmhwWkNKOS5pYnBtcjNsQ0duakdiTU1xVzVQUEtYaXRodndQSjZ= DM0U4a3AtWlRQUG04P3V0bV9zb3VyY2U9Ymx1ZXdyaXRlcnMuYmVlaGlpdi5jb20mdXRtX21lZG= l1bT1yZWZlcnJhbCZ1dG1fY2FtcGFpZ249cHl0aG9uLXByb2plY3QtZm9yLWJlZ2lubmVycy1sZ= XQtcy1idWlsZC1pbnRlcm5ldC1zcGVlZC10ZXN0ZXIiLCJwb3N0X2lkIjoiZDMyZTU5NDUtNDNj= Yi00YmU4LTljODUtOTZiOWRhMzlmNzQyIiwicHVibGljYXRpb25faWQiOiIyMDVjNmU0My1iMzR= iLTRjNWEtYTA4ZC1lYzZkNzkwZGYwYzkiLCJ2aXNpdF90b2tlbiI6ImRkM2JlNTQxLTE2ZTktNG= UxMy1iZjA3LWE0NjhhODlkNGQzZCIsImlhdCI6MTcwNDIxMDcwNCwiaXNzIjoib3JjaGlkIn0.T= ZEiQdce35mrmFeE1TgU6wEdyx1-jpic_wLeK150neA)**__ _**Thanks for reading a have great day friend **_=F0=9F=98=8D=F0=9F=98=8D =E2=80=94=E2=80=94=E2=80=94 You are reading a plain text version of this post. For the best experience,= copy and paste this link in your browser to view the post online: https://bluewriters.beehiiv.com/p/built-voice-imitator-python-stepbystep --f71d1222d5d20e04ed5da0698835b447456e2edf2a8712ebf60a7233acc9--