chaosparrot / parrot.py

Computer interaction using audio and speechrecognition
MIT License
139 stars 36 forks source link

What is causing this error during Learning? #42

Closed John-Keyberg closed 10 months ago

John-Keyberg commented 11 months ago

I am using Windows 11. Not a programmer.

Selecting categories to train on... ( [Y]es / [N]o / [S]kip )
 - pt-ba
 - pt-li
 - pt-po
 - pt-za
 - pt-ze
 - pt-zi
 - pt-zo
 - pt-zu
--------------------------
Loading in pt-ba
C:\Users\fblim\AppData\Local\Programs\Python\Python38\lib\site-packages\librosa\util\decorators.py:88: UserWarning: n_fft=2048 is too small for input signal of length=480
  return f(*args, **kwargs)
C:\Users\fblim\AppData\Local\Programs\Python\Python38\lib\site-packages\librosa\util\decorators.py:88: UserWarning: n_fft=2048 is too small for input signal of length=480
  return f(*args, **kwargs)
Loading in pt-li
Loading in pt-po
Loading in pt-za
Loading in pt-ze
Loading in pt-zi
Loading in pt-zo
Loading in pt-zu
Traceback (most recent call last):
  File "settings.py", line 47, in <module>
    root_navigation( True )
  File "settings.py", line 24, in root_navigation
    select_mode()
  File "settings.py", line 32, in select_mode
    learn_data()
  File "C:\Parrot\parrot.py-master\lib\learn_data.py", line 96, in learn_data
    dataset = AudioDataset( grouped_data_directories, settings )
  File "C:\Parrot\parrot.py-master\lib\audio_dataset.py", line 53, in __init__
    all_samples = load_wav_data_from_srt(listed_files[full_filename], full_filename, self.settings['FEATURE_ENGINEERING_TYPE'], False)
  File "C:\Parrot\parrot.py-master\lib\wav.py", line 106, in load_wav_data_from_srt
    raw_wav = wf.readframes(frames_to_read * number_channels)
  File "C:\Users\fblim\AppData\Local\Programs\Python\Python38\lib\wave.py", line 239, in readframes
    self._data_chunk.seek(pos, 0)
  File "C:\Users\fblim\AppData\Local\Programs\Python\Python38\lib\chunk.py", line 114, in seek
    self.file.seek(self.offset + pos, 0)
  File "C:\Users\fblim\AppData\Local\Programs\Python\Python38\lib\chunk.py", line 113, in seek
    raise RuntimeError
RuntimeError
John-Keyberg commented 11 months ago

I believe that the error has something to do with pressing backspace during the recording of one of the sounds included. The sound "pt-zu" was the only one in which I pressed backspace and the problem was gone after removing it.

mimuki commented 10 months ago

I had the same issue on debian 12. making a new recording (where I didn't press backspace) solved it for me as well

lamdevhs commented 10 months ago

had the exact same issue, except I used backspace for almost all the recordings!! and it took me so long to record them too... please fix this issue!

to salvage my corrupted audio files, I looped back the output of my computer as a recording input so I can make parrot listen again to everything I've already saved. It would be a lot easier though if I could just tell it to import pre-existing .wav files (that I would fix). Is there a way to do that? the [v] menu doesn't seem to include an import option but then I barely understand what most of the options do...

chaosparrot commented 10 months ago

I've done a quick debugging and what seems to be the problem is that the SRT files that it generates when backspacing is used aren't made well. While I investigate how to fix this, there is a workaround that won't require you to re-record any sounds.

The workaround is as follows: Go to the segments folder inside of the faulty recording label and delete all the files ending with .srt. When you next open the settings page using py settings.py, it will do resegmenting which seemed to have allowed me to learn the backspaced labels.

I'll have a crack at fixing this in the weekend.

lamdevhs commented 10 months ago

Thank you so much for this solution! I had already wasted an hour recording again two of my folders, I am so glad that I am not going to have to do that for the others!