joaen / maya-auto-lip-sync

A tool to automatically generate lip sync animations in Autodesk: Maya using Montreal Forced Aligner.
MIT License
29 stars 6 forks source link

error with generating keyframe #9

Open enigma-dy opened 11 months ago

enigma-dy commented 11 months ago

LOG select -r POLYWINK_Louise ; import auto_lip_sync auto_lip_sync.start()

b'Setting up corpus information...\r\n' b'Number of speakers in corpus: 1, average number of utterances per speaker: 1.0\r\n' b'Creating dictionary information...\r\n' b'Setting up training data...\r\n' b'Calculating MFCCs...\r\n' b'Calculating CMVN...\r\n' b'Number of speakers in corpus: 1, average number of utterances per speaker: 1.0\r\n' b'Done with setup.\r\n' b'Done! Everything took 6.46065616607666 seconds\r\n' b'\r 0%| | 0/2 [00:00<?, ?it/s]\r 50%|##### | 1/2 [00:01<00:01, 1.03s/it]\r100%|##########| 2/2 [00:02<00:00, 1.18s/it]\r\n'

Traceback (most recent call last):

File "C:\Users/solomon/Documents/maya/2024/scripts\auto_lip_sync\auto_lip_sync.py", line 322, in generate_animation

self.create_keyframes()

File "C:\Users/solomon/Documents/maya/2024/scripts\auto_lip_sync\auto_lip_sync.py", line 373, in create_keyframes

tg = textgrid.TextGrid.fromFile(textgrid_path)

File "C:\Users/solomon/Documents/maya/2024/scripts\textgrid\textgrid.py", line 807, in fromFile

tg.read(f)

File "C:\Users/solomon/Documents/maya/2024/scripts\textgrid\textgrid.py", line 698, in read

encoding = detectEncoding(f)

File "C:\Users/solomon/Documents/maya/2024/scripts\textgrid\textgrid.py", line 87, in detectEncoding

with codecs.open(f, 'r', encoding='utf-16') as source:

File "C:\Program Files/Autodesk/Maya2024\Python\lib\codecs.py", line 905, in open

file = builtins.open(filename, mode, buffering)

FileNotFoundError: [Errno 2] No such file or directory: ''

adamgravois commented 10 months ago

I am having the same error, currently trying to track it down. I have one wav + txt pair that works, and another that doesn't. Here is what I know: when it fails, it's because MontrealForcedAligner isn't creating a .TextGrid file Why not? IDK!

MFA log messages amount to, "yep, it failed" but never why: tri_fmllr/log/align2.0.log Good run: (gmm-align-compiled[5.4-win]:main():e:\dev\tools\kaldi\src\gmmbin\gmm-align-compiled.cc:135) Overall log-likelihood per frame is -96.5823 over 1166 frames. tri_fmllr/log/align2.0.log Bad run: (gmm-align-compiled[5.4-win]:main():e:\dev\tools\kaldi\src\gmmbin\gmm-align-compiled.cc:135) Overall log-likelihood per frame is -nan(ind) over 0 frames. OK, nan = Not A Number, so that ain't good.

But why? It isn't the audio format. It isnt the text file. Is there something weird about that piece of audio? I tried re-recording with a different voice, and no joy.

If I come up with a solution (upgrade to MFA v3, lol) I'll update this post.

adamgravois commented 10 months ago

update: Running a longer piece of audio (18 sec vs 10 sec) seems to avoid the problem. Same speaker, same words, slightly different recording (but not by much).

joaen commented 10 months ago

Interesting. I'm pretty swamped with work at the moment, but I will take a closer look when I have more time. Like @adamgravois said it seems to be related to MFA failing for some reason.

I'm gonna see if I can repro this on my end, can someone please share a .wav-file that I can use when debugging this?

adamgravois commented 10 months ago

Possibly an easy fix would be trapping that failure and reporting a meaningful error message "MFA couldn't parse that audio, maybe try a silghtly different clip?"

Goodness knows, I tried to make sense of the MFA documentation, but it is super jargon-y. Very very deep in its own expertise subculture.

Thanks for taking my pull req! Audio Samples for MFA.zip

EnigmaDY commented 10 months ago

I'm sorry i really dont know much about coding or how report a bg or error. I just copied what maya output and pated it here

joaen commented 10 months ago

@adamgravois Thanks for the files! I'll try to repro the issue with the files you provided.

adamgravois commented 10 months ago

I'm sorry i really dont know much about coding or how report a bg or error. I just copied what maya output and pated it here

That's a good first step :)