Skip to content

Commit

Permalink
all_Automation_Git_Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
AmolKadam-Tekdi committed Jul 9, 2024
1 parent 4d58c1c commit 568019f
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions allAutomation/src/main/java/Tests/AllTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,36 +121,36 @@ private static void TexttoSpeach(String Text) throws InterruptedException {


// Ensure the directory exists
String directoryPath = "src/main/java/Pages"; // Adjust this path as needed
String fileName = "output_audio"; // Adjust the file name as needed
String outputPath = directoryPath + "/" + fileName + ".wav";

// Create directory if it doesn't exist
File directory = new File(directoryPath);
if (!directory.exists()) {
directory.mkdirs();
}

// Create a SingleFileAudioPlayer
SingleFileAudioPlayer audioPlayer = new SingleFileAudioPlayer(outputPath, javax.sound.sampled.AudioFileFormat.Type.WAVE);
voice.setAudioPlayer(audioPlayer);

voice.speak(Text);

audioPlayer.close();
// Deallocate the voice resources
voice.deallocate();

System.out.println("Audio file created successfully at: " + outputPath);

// Convert audio file to Base64
String base64Audio = convertWavToBase64(outputPath);
System.out.println("Base64 Audio: " + base64Audio);

// Save Base64 string to a file
String base64FilePath = directoryPath + "/Base64Audio.txt";
saveBase64ToFile(base64FilePath, base64Audio);
System.out.println("Base64 Audio saved successfully at: " + base64FilePath);
// String directoryPath = "src/main/java/Pages"; // Adjust this path as needed
// String fileName = "output_audio"; // Adjust the file name as needed
// String outputPath = directoryPath + "/" + fileName + ".wav";
//
// // Create directory if it doesn't exist
// File directory = new File(directoryPath);
// if (!directory.exists()) {
// directory.mkdirs();
// }
//
// // Create a SingleFileAudioPlayer
// SingleFileAudioPlayer audioPlayer = new SingleFileAudioPlayer(outputPath, javax.sound.sampled.AudioFileFormat.Type.WAVE);
// voice.setAudioPlayer(audioPlayer);
//
// voice.speak(Text);
//
// audioPlayer.close();
// // Deallocate the voice resources
// voice.deallocate();
//
// System.out.println("Audio file created successfully at: " + outputPath);
//
// // Convert audio file to Base64
// String base64Audio = convertWavToBase64(outputPath);
// System.out.println("Base64 Audio: " + base64Audio);
//
// // Save Base64 string to a file
// String base64FilePath = directoryPath + "/Base64Audio.txt";
// saveBase64ToFile(base64FilePath, base64Audio);
// System.out.println("Base64 Audio saved successfully at: " + base64FilePath);
}


Expand Down

0 comments on commit 568019f

Please sign in to comment.