MontrealCorpusTools / Montreal-Forced-Aligner

Command line utility for forced alignment using Kaldi
https://montrealcorpustools.github.io/Montreal-Forced-Aligner/
MIT License
1.3k stars 243 forks source link

[BUG] sox FAIL formats error with .wav file #543

Closed yash-atreya closed 1 year ago

yash-atreya commented 1 year ago

Debugging checklist

[x] Have you updated to latest MFA version? [x] Have you tried rerunning the command with the --clean flag?

Describe the issue Kaldi seems to have an error on running sox. This is what it produces in the log file: sox FAIL formats: can't open input file `/Users/yash/Desktop/Dev/mfa-test/inputs/test.wav': WAVE: RIFF header not found

The full error is as follows:

(aligner) yash@Yashs-MacBook-Air mfa-test % mfa validate /Users/yash/Desktop/Dev/mfa-test/inputs english_us_arpa english_us_arpa --clean
INFO - Setting up corpus information...
INFO - Loading corpus from source files...
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:02<00:00,  2.03s/it]
INFO - Found 1 speaker across 1 file, average number of utterances per speaker: 1.0
INFO - Initializing multiprocessing jobs...
WARNING - Number of jobs was specified as 3, but due to only having 1 speakers, MFA will only use 1 jobs.
INFO - Creating corpus split for feature generation...
INFO - Generating base features (mfcc)...
INFO - Generating MFCCs...
  0%|                                                                                                                                                                         | 0/1 [00:00<?, ?it/s]/
MultiprocessingError:

  Job 0 encountered an error:
  Traceback (most recent call last):

    File "/Users/yash/opt/anaconda3/envs/aligner/lib/python3.10/site-packages/montreal_forced_aligner/abc.py", line 73, 
    in run
      yield from self._run()

    File 
    "/Users/yash/opt/anaconda3/envs/aligner/lib/python3.10/site-packages/montreal_forced_aligner/corpus/features.py", 
    line 251, in _run
      self.check_call(copy_proc)

    File "/Users/yash/opt/anaconda3/envs/aligner/lib/python3.10/site-packages/montreal_forced_aligner/abc.py", line 100,
     in check_call
      raise KaldiProcessingError([self.log_path])

  montreal_forced_aligner.exceptions.KaldiProcessingError: KaldiProcessingError:

    There were 1 job(s) with errors when running Kaldi binaries.
    See the log files below for more information.
    /Users/yash/Documents/MFA/inputs_validate_pretrained/inputs/split1/log/make_mfcc.0.log
  0%|                                                                                                                                                                         | 0/1 [00:02<?, ?it/s]
ERROR - There was an error in the run, please see the log.

For Reproducing your issue Please fill out the following:

  1. Corpus structure
    • What language is the corpus in? English
    • How many files/speakers? 1 Speaker
    • Are you using lab files or TextGrid files for input? .lab files
  2. Dictionary
    • Are you using a dictionary from MFA? If so, which one? english_us_arpa
    • If it's a custom dictionary, what is the phoneset? NA
  3. Acoustic model
    • If you're using an acoustic model, is it one download through MFA? If so, which one? english_us_arpa
    • If it's a model you've trained, what data was it trained on? NA

Log file Log file error:

/Users/yash/opt/anaconda3/envs/aligner/bin/extract-segments scp:/Users/yash/Documents/MFA/inputs_validate_pretrained/inputs/split1/wav.0.scp /Users/yash/Documents/MFA/inputs_validate_pretrained/inputs/split1/segments.0.scp ark:- 
/Users/yash/opt/anaconda3/envs/aligner/bin/copy-feats --verbose=2 --compress=true ark:- ark,scp:/Users/yash/Documents/MFA/inputs_validate_pretrained/inputs/split1/feats.0.ark,/Users/yash/Documents/MFA/inputs_validate_pretrained/inputs/split1/feats.0.scp 
sox FAIL formats: can't open input file `/Users/yash/Desktop/Dev/mfa-test/inputs/test.wav': WAVE: RIFF header not found
ERROR (extract-segments[5.5.1016]:Read4ByteTag():feat/wave-reader.cc:56) WaveData: expected 4-byte chunk-name, got read error
WARNING (extract-segments[5.5.1016]:Read():feat/wave-reader.h:197) Exception caught in WaveHolder::Read(). kaldi::KaldiFatalError
WARNING (extract-segments[5.5.1016]:HasKeyInternal():util/kaldi-table-inl.h:1776) Error reading object from stream 'sox "/Users/yash/Desktop/Dev/mfa-test/inputs/test.wav" -t wav -b 16 -r 16000 - |'
ERROR (extract-segments[5.5.1016]:Value():util/kaldi-table-inl.h:1681) Could not get item for key 1, rspecifier is scp:/Users/yash/Documents/MFA/inputs_validate_pretrained/inputs/split1/wav.0.scp [to ignore this, add the p, (permissive) option to the rspecifier.
WARNING (extract-segments[5.5.1016]:Close():util/kaldi-io.cc:515) Pipe sox "/Users/yash/Desktop/Dev/mfa-test/inputs/test.wav" -t wav -b 16 -r 16000 - | had nonzero return status 512
kaldi::KaldiFatalErrorLOG (copy-feats[5.5.1016]:main():featbin/copy-feats.cc:143) Copied 0 feature matrices.
/Users/yash/opt/anaconda3/envs/aligner/bin/compute-mfcc-feats --verbose=2 --use-energy=false --frame-shift=10 --frame-length=25 --low-freq=20 --high-freq=7800 --sample-frequency=16000 --allow-downsample=true --allow-upsample=true --snip-edges=true ark:- ark:-
LOG (compute-mfcc-feats[5.5.1016]:main():featbin/compute-mfcc-feats.cc:185)  Done 0 out of 0 utterances.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

mmcauliffe commented 1 year ago

It looks like there's something wrong with your test.wav file. Can you open it in other programs? If you can recreate/redownload/save it from praat/audacity/etc, it should work.

RickyL-2000 commented 1 year ago

Met the same problem. The wav file looks fine and can be opened and played.