Program fails to run on certain kinds of files (.mp3s)
- Dominant language
- Python
- Stars
- 504
- Forks
- 38
- Avg merge
- 9h 44m
- Merged PRs (30d)
- 9
Description
I was trying to run STAMMER on some mp3 files, but instead got this error:
```
Calculating video length
reading audio
analyzing audio
Traceback (most recent call last):
File "C:\Users\tyryry\Desktop\STAMMER\stammer.py", line 307, in
main()
File "C:\Users\tyryry\Desktop\STAMMER\stammer.py", line 303, in main
process(**vars(args))
File "C:\Users\tyryry\Desktop\STAMMER\stammer.py", line 246, in process
matcher = BasicAudioMatcher(carrier_audio, modulator_audio, INTERNAL_SAMPLERATE, frame_length)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tyryry\Desktop\STAMMER\audio_matching.py", line 19, in __init__
self.make_best_matches()
File "C:\Users\tyryry\Desktop\STAMMER\audio_matching.py", line 66, in make_best_matches
self.modulator_bands = self.make_normalized_bands(self.modulator_frames)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tyryry\Desktop\STAMMER\audio_matching.py", line 40, in make_normalized_bands
spectra = abs(transforms[:,1:len(transforms[0])//2])
~~~~~~~~~~^^^
IndexError: index 0 is out of bounds for axis 0 with size 0
```
It seems to happen everytime I'm using an mp3 file as the carrier track.
_However_, I found out that if I were to delete the first few milliseconds of silence at the start of the mp3 track (as mp3 files are) the program worked as expected.
Based on the error
```IndexError: index 0 is out of bounds for axis 0 with size 0```
I think the error might be because of the silence (which have empty frames in them), and the empty frames cause issues when trying to create an array (hence out of bounds for an empty array of 0). I tried creating a file with ONLY silence to test this, but STAMMER seemed to work just fine with the silent file, even when it was a .mp3.
I think when I tried this with .oggs the program also worked just fine.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in audio_matching.py at make_normalized_bands, then reproduce the failure by running stammer.py with an MP3 carrier that has leading silence. Compare it with a trimmed MP3, an OGG, and an all-silence file. Done means the affected MP3 input no longer raises the reported IndexError and STAMMER completes processing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- audio-video-rtc
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100