Skip to content

Python, gTTS, os. Extracts text from a Microsoft Word document (.docx) and converts it into an audio file (MP3) using Google Text-to-Speech (gTTS).

License

Notifications You must be signed in to change notification settings

tim-andes/docx-to-audio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Text-to-Speech from Docx

This Python script extracts text from a Microsoft Word document (.docx) and converts it into an audio file (MP3) using Google Text-to-Speech (gTTS).

Features:

  • Reads text content from a .docx file.
  • Converts the extracted text into an audio file using gTTS (English language supported).
  • Provides a user-friendly interface for specifying the input .docx file path.
  • Handles errors if the input file doesn't exist.

Installation:

  1. Make sure you have Python 3 installed.

  2. Install the required libraries:

pip install docx gtts

Usage:

  1. Clone or download this repository.
  2. Open a terminal or command prompt and navigate to the directory containing the script (docx-to-audio.py).  
  3. Run the script:
python text_to_speech_docx.py
  1. You will be prompted to enter the path of your .docx file.
  2. If the file exists, the script will extract the text and convert it to an audio file named output.mp3.

Example Output

Enter the path of your .docx file: path/to/your/file.docx
Creating audio file `output.mp3`, please wait...
Success! Audio saved to output.mp3

About

Python, gTTS, os. Extracts text from a Microsoft Word document (.docx) and converts it into an audio file (MP3) using Google Text-to-Speech (gTTS).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages