This project allows you to upload an audio file or record audio and convert it into text using AssemblyAI's API. You can also translate the transcribed text to different languages using Google Cloud Translation API.
Before running the application, ensure the following prerequisites are met:
- Java: JDK 8 or later installed.
- Maven: Installed and set up to handle project dependencies.
- AssemblyAI API Key: For transcription services.
- Google Cloud Account: For language translation services.
- Create an account at AssemblyAI if you don't already have one.
- Obtain your API Key from the AssemblyAI dashboard.
- Set the API Key as an environment variable:
- On Windows:
- Open Command Prompt (cmd).
- Run the following command:
setx API_KEY "your-assemblyai-api-key"
- On macOS/Linux:
- Open a terminal window.
- Add the following line to your
.bashrc
or.zshrc
file:export API_KEY="your-assemblyai-api-key"
- Then, run the following command to load the new environment variable:
source ~/.bashrc # or ~/.zshrc for zsh users
- On Windows:
This environment variable will be used by the application to authenticate and interact with the AssemblyAI API.
- Visit Google Cloud and sign up for an account if you don't have one.
- You may need to enter billing information, but there is a free tier with limited usage.
- After signing in to Google Cloud Console, click on Select a Project at the top.
- Click New Project and enter a name for your project (e.g.,
audio-to-text-converter
). - Click Create.
- Go to the Google Cloud Console.
- In the search bar, type Translation API and select it.
- Click Enable to activate the Google Cloud Translation API for your project.
- In the Google Cloud Console, navigate to IAM & Admin → Service Accounts.
- Click on Create Service Account.
- Fill out the Service Account Details:
- Service Account Name:
translation-service-account
- Role: Select
Project
→Editor
orViewer
. TheEditor
role allows full access to the project, whileViewer
gives only read access (choose based on your needs). - Leave the Key section as JSON (this is important for authentication).
- Service Account Name:
- Click Done.
- After creating the service account, you'll be presented with the option to download the service account key. Click Create Key and select JSON.
- Save the downloaded
.json
file securely on your machine.
- The downloaded
.json
file is required for authenticating your application with Google Cloud services. - Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to the path of the JSON file.
- On Windows:
- Open Command Prompt (cmd) and run the following command:
setx GOOGLE_APPLICATION_CREDENTIALS "C:\path\to\your\service-account-file.json"
- Open Command Prompt (cmd) and run the following command:
- On macOS/Linux:
- Open a terminal window and run the following command:
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/service-account-file.json"
- To make this change permanent, add the above line to your
.bashrc
or.zshrc
file, and then run:source ~/.bashrc # or ~/.zshrc for zsh users
- Open a terminal window and run the following command:
- On Windows:
This environment variable tells the application where to find the service account credentials needed for authentication with Google Cloud APIs.
- Clone the repository to your local machine:
git clone https://github.com/your-repository/audio-to-text-converter.git cd audio-to-text-converter