From 94fbdbd545bfd52885da52716fe570b13e81457d Mon Sep 17 00:00:00 2001 From: Emran <85117114+emranpy@users.noreply.github.com> Date: 2023年9月23日 08:02:31 +0000 Subject: [PATCH 1/2] add text to speech --- Text-to-speech-coverter/Readme.md | 37 ++++++++++++++++++++++ Text-to-speech-coverter/output.mp3 | Bin 0 -> 8064 bytes Text-to-speech-coverter/text_to_speech.py | 19 +++++++++++ 3 files changed, 56 insertions(+) create mode 100644 Text-to-speech-coverter/Readme.md create mode 100644 Text-to-speech-coverter/output.mp3 create mode 100644 Text-to-speech-coverter/text_to_speech.py diff --git a/Text-to-speech-coverter/Readme.md b/Text-to-speech-coverter/Readme.md new file mode 100644 index 0000000000..4b85778770 --- /dev/null +++ b/Text-to-speech-coverter/Readme.md @@ -0,0 +1,37 @@ +Certainly! Here's an example of a README file that you can use to document the code: + +pgsql +Copy +# Text-to-Speech Conversion + +This Python program converts text input into speech using the Google Text-to-Speech (gTTS) library and plays the generated audio using the `playsound` library. + +## Requirements + +- Python 3.x +- `gTTS` library (`pip install gTTS`) +- `playsound` library (`pip install playsound`) + +## Usage + +1. Install the required libraries by running the following commands: +pip install gTTS +pip install playsound + +Copy + +2. Run the `text_to_speech.py` script: +``` +python text_to_speech.py +Enter the desired text when prompted. + +The program will convert the entered text to speech and save it as an MP3 file named output.mp3. + +The generated speech will be played automatically using the default audio player on your system. + +Customization +You can modify the code to change the language or adjust the speech synthesis options by referring to the gTTS documentation. + +To change the output filename, modify the filename variable in the code. + +Feel free to incorporate the text-to-speech functionality into your own projects by importing the text_to_speech function. \ No newline at end of file diff --git a/Text-to-speech-coverter/output.mp3 b/Text-to-speech-coverter/output.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..e6c565e4e6e5ba3f3df418cd48ec72809000bb0f GIT binary patch literal 8064 zcmcK8byO68+%NE1x`f>&1Vp+)TtWp58UaB80RchjQjwN)VdaV&b>U6p_dxnWXMG%6NoBh|wCf7pJ(Lvn5$Ybb3t=tSGFlc&e@`#>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|Y55X&#$@4hKa z+5*|kqq8EKQ^w`d3))Ly(lOzZ*w=fW@EBPyd2KRR^{#Ff6s`tR^lv zAXc!xBT+GCli)Wp+xJfcW}R3}_QQYuQQx9JWF4nF2EW|E>MuMk7Ex(R#XmPKw7EU+ zr#fSO>(qcRy4R6c>E9nFEEcFCHRCN)a9q$jPkM4cN-X1*_{X2gqsv%TfwyODKR0>_ zeg&5+<8popvi_=hm8p-1-3y7aijd;rcgi6<$nzsjpqc0ach+)jq}+p36cdr-s~443 zJi|v8kUOn>g;;Aot4R2dS&=Zcdssl$t3 Date: 2023年9月23日 08:11:32 +0000 Subject: [PATCH 2/2] update Readme and requirements.txt --- Text-to-speech-coverter/Readme.md | 36 +++++++++++------------- Text-to-speech-coverter/requirements.txt | 2 ++ 2 files changed, 18 insertions(+), 20 deletions(-) create mode 100644 Text-to-speech-coverter/requirements.txt diff --git a/Text-to-speech-coverter/Readme.md b/Text-to-speech-coverter/Readme.md index 4b85778770..2bf8c8f53f 100644 --- a/Text-to-speech-coverter/Readme.md +++ b/Text-to-speech-coverter/Readme.md @@ -1,7 +1,3 @@ -Certainly! Here's an example of a README file that you can use to document the code: - -pgsql -Copy # Text-to-Speech Conversion This Python program converts text input into speech using the Google Text-to-Speech (gTTS) library and plays the generated audio using the `playsound` library. @@ -9,29 +5,29 @@ This Python program converts text input into speech using the Google Text-to-Spe ## Requirements - Python 3.x -- `gTTS` library (`pip install gTTS`) -- `playsound` library (`pip install playsound`) +- See `requirements.txt` for the required libraries and versions. + +## Installation + +1. Clone the repository:https://github.com/emranpy/Amazing-Python-Scripts.git +2. Navigate to the project directory: cd Text-to-speech-converter +3. Install the required libraries: pip install -r requirements.txt ## Usage -1. Install the required libraries by running the following commands: -pip install gTTS -pip install playsound +1. Run the `text_to_speech.py` script: + +2. Enter the desired text when prompted. -Copy +3. The program will convert the entered text to speech and save it as an MP3 file named `output.mp3`. -2. Run the `text_to_speech.py` script: -``` -python text_to_speech.py -Enter the desired text when prompted. +4. The generated speech will be played automatically using the default audio player on your system. -The program will convert the entered text to speech and save it as an MP3 file named output.mp3. +## Customization -The generated speech will be played automatically using the default audio player on your system. +- You can modify the code to change the language or adjust the speech synthesis options by referring to the `gTTS` documentation. -Customization -You can modify the code to change the language or adjust the speech synthesis options by referring to the gTTS documentation. +- To change the output filename, modify the `filename` variable in the code. -To change the output filename, modify the filename variable in the code. +- Feel free to incorporate the text-to-speech functionality into your own projects by importing the `text_to_speech` function. -Feel free to incorporate the text-to-speech functionality into your own projects by importing the text_to_speech function. \ No newline at end of file diff --git a/Text-to-speech-coverter/requirements.txt b/Text-to-speech-coverter/requirements.txt new file mode 100644 index 0000000000..111452091a --- /dev/null +++ b/Text-to-speech-coverter/requirements.txt @@ -0,0 +1,2 @@ +gTTS==2.2.3 +playsound==1.2.2 \ No newline at end of file

AltStyle によって変換されたページ (->オリジナル) /