Made with ❤️ for Lê Thảo Hiền
A simple desktop application built with Python and Flet to generate AI voice from text using the Murf.ai API.
- Multi-line text input for text-to-speech conversion.
- Select voices from a dynamically updated list of available US English (en-US) and UK English (en-UK) voices from Murf.ai.
- Choose appropriate moods/styles for the selected voice.
- Adjust the pitch of the generated speech.
- Generate and open a dialog to save the audio file (MP3) to a user-selected location.
- Update the Murf.ai API Key through a dedicated settings dialog.
- Automatically persists the API Key in an
api_key.pyfile for subsequent runs. - Displays the current API Key status (set or not set).
- User-friendly interface built with Flet.
- Python 3.11+
- pip (Python package installer)
- A Murf.ai account and a valid API Key. You can obtain your API Key from your Murf.ai account dashboard.
-
Clone the Repository:
git clone https://github.com/trieuntu/AIVoice-MurfAI.git cd AIVoice-MurfAI -
Create and Activate a Virtual Environment (Recommended):
# Windows python -m venv venv .\venv\Scripts\activate # macOS/Linux python3 -m venv venv source venv/bin/activate
-
Install Dependencies: Run:
pip install -r requirements.txt
-
Configure API Key:
- Add the following line to
api_key.py, replacing"YOUR_MURFAI_API_KEY"with your actual Murf.ai API Key:API_KEY = "YOUR_MURFAI_API_KEY"
- Add the following line to
-
Run the Application: Open your terminal or command prompt in the project's root directory (with the virtual environment activated, if used) and run:
python main.py
(Or
python3 main.pydepending on your system configuration) -
Using the Interface:
- Enter the text you want to convert in the large text area.
- Select a Voice and Mood from the dropdown menus.
- Adjust the Pitch slider if desired.
- Click the "Generate and Save Audio" button.
- A file dialog will appear; choose a location and filename to save the MP3 file.
- The audio file will play automatically after saving.
You can package this application into a standalone Windows executable (.exe) using Flet's built-in packaging tool (which utilizes PyInstaller). This allows users to run the application without needing Python or installing dependencies.
Prerequisites:
- Ensure the application runs correctly using
python main.py. - Have an icon file ready, preferably in
.icoformat for best results on Windows (e.g.,assets/favicon.ico).
Steps:
-
Open your Terminal, Command Prompt, or PowerShell.
-
Navigate (
cd) to the root directory of your project (wheremain.pyis located). -
Activate your virtual environment (if you are using one):
# Windows Command Prompt / PowerShell .\venv\Scripts\activate
-
Run the
flet packcommand. Use the command that worked successfully for you:flet pack main.py --name "AIVoiceGenerator" --icon "assets/favicon.ico" --add-data "assets;assets" --add-data "api_key.py;."
main.py: Your main application script.--name "AIVoiceGenerator": Sets the name of the executable and the output folder.--icon "assets/favicon.ico": Specifies the icon file for the.exe.--add-data "assets;assets": Bundles the entireassetsfolder into the package, makingassets/favicon.ico(for the window icon) accessible.--add-data "api_key.py;.": Bundles theapi_key.pyfile into the root directory of the package, allowing the application to read it on startup and potentially overwrite it.
-
Wait for the process to complete. This might take several minutes. Ignore warnings unless there are specific errors.
-
Find the Result: Once finished, you'll find the packaged application inside the
distdirectory, within a sub-folder named after your--nameargument (e.g.,dist/AIVoiceGenerator).
Running the Packaged App:
- Navigate into the
dist/AIVoiceGeneratorfolder. - Double-click the
AIVoiceGenerator.exefile to run the application. - You can copy the entire
AIVoiceGeneratorfolder to another Windows machine (even one without Python installed) and run the.exefrom there.
- Flet: Build cross-platform Flutter frontends in Python.
- Murf Python Library: Python client for the Murf.ai API.
- Requests: Python library for making HTTP requests (used for downloading the audio file).
This project is licensed under the MIT License. See the LICENSE file for details (You should create a LICENSE file containing the MIT license text).
