[Python] Forced alignment with aeneas

Discussão em 'Python' iniciado por Stack, Março 24, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to build a simple dataset for speech recognition using aeneas, following the instructions here. However, I'm stuck at the forced alignment. Here is my code:

    from aeneas.executetask import ExecuteTask
    from aeneas.task import Task

    config_string = "task_language=eng | is_text_type=plain | os_task_file_format=json"
    task = Task(config_string=config_string)

    task.audio_file_path_absolute = "D:/documents/AI/open_door.mp3"
    task.text_file_path_absolute = "D:/documents/AI/open_door.txt"

    task.sync_map_file_path_absolute = "D:/documents/AI/syncmap.json"

    ExecuteTask(task).execute()

    task.output_sync_map_file()


    Which gives the following error:

    Traceback (most recent call last):
    File "C:\Users\ACER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aeneas\ffprobewrapper.py", line 222, in read_properties
    proc = subprocess.Popen(
    File "C:\Users\ACER\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
    File "C:\Users\ACER\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
    FileNotFoundError: [WinError 2] The system cannot find the file specified

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "C:\Users\ACER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aeneas\audiofile.py", line 357, in read_properties
    properties = FFPROBEWrapper(
    File "C:\Users\ACER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aeneas\ffprobewrapper.py", line 233, in read_properties
    self.log_exc(u"Unable to call the '%s' ffprobe executable" % (self.rconf[RuntimeConfiguration.FFPROBE_PATH]), exc, True, FFPROBEPathError)
    File "C:\Users\ACER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aeneas\logger.py", line 351, in log_exc
    raise raise_type(raise_message)
    aeneas.ffprobewrapper.FFPROBEPathError: Unable to call the 'ffprobe' ffprobe executable : [WinError 2] The system cannot find the file specified

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "D:\documents\AI\forced_alignment.py", line 9, in <module>
    task.audio_file_path_absolute = "D:/documents/AI/open_door.mp3"
    File "C:\Users\ACER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aeneas\task.py", line 120, in audio_file_path_absolute
    self._populate_audio_file()
    File "C:\Users\ACER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aeneas\task.py", line 241, in _populate_audio_file
    self.audio_file.read_properties()
    File "C:\Users\ACER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aeneas\audiofile.py", line 363, in read_properties
    self.log_exc(u"Unable to call ffprobe executable", None, True, AudioFileProbeError)
    File "C:\Users\ACER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aeneas\logger.py", line 351, in log_exc
    raise raise_type(raise_message)
    aeneas.audiofile.AudioFileProbeError: Unable to call ffprobe executable
    [Finished in 0.4s]


    Intuitively, I think it is because of the file paths, but changing it doesn't seem to work. I have never worked with python before so show me where I did wrong. Thank you.

    Continue reading...

Compartilhe esta Página