Нужно извлечь текст из любого аудио файла

Я пытаюсь извлечь текст из аудио файла. Я пытался с FreeTTS, но я могу сделать текст в речь.

вот мой код,

package video_audio_text.project;

import javax.sound.sampled.AudioFileFormat.Type;
import com.sun.speech.freetts.FreeTTS;
import com.sun.speech.freetts.Voice;
import com.sun.speech.freetts.VoiceManager;
import com.sun.speech.freetts.audio.AudioPlayer;
import com.sun.speech.freetts.audio.SingleFileAudioPlayer;

public class AudioToText {

    /**
     * Example of how to list all the known voices.
     */


    public static void main(String[] args) {

       // listAllVoices();
        System.setProperty("freetts.voices", "com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory");

        FreeTTS freetts;
        AudioPlayer audioPlayer = null;
        String voiceName = "kevin16";

        System.out.println();
        System.out.println("Using voice: " + voiceName);

        /* The VoiceManager manages all the voices for FreeTTS.
         */
        VoiceManager voiceManager = VoiceManager.getInstance();
        Voice helloVoice = voiceManager.getVoice(voiceName);

        if (helloVoice == null) {
            System.err.println(
                "Cannot find a voice named "
                + voiceName + ".  Please specify a different voice.");
            System.exit(1);
        }

        /* Allocates the resources for the voice.
         */
        helloVoice.allocate();

        /* Synthesize speech.
         */
//create a audioplayer to dump the output file
       audioPlayer = new SingleFileAudioPlayer("/Users/user/Documents/test",Type.WAVE);
//attach the audioplayer 
       helloVoice.setAudioPlayer(audioPlayer);


        helloVoice.speak("Thank you for giving me a voice. "
                         + "I'm so glad to say hello to this world." + 
                        + "here you go good way");



        /* Clean up and leave.
         */
        helloVoice.deallocate();
        audioPlayer.close();
        System.exit(0);
    }

}

Но мне нужно дать аудио файл и извлечь текст из аудио файла.

Пожалуйста, предложите мне, как я могу достичь.

Пожалуйста, предложите, какую библиотеку, например, FFMPEG или любую другую, которая может помочь мне достичь этого.

0 ответов

Другие вопросы по тегам