Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Program fails to run on certain kinds of files (.mp3s) #75

Open
tyryry1107 opened this issue Jun 4, 2023 · 0 comments
Open

Program fails to run on certain kinds of files (.mp3s) #75

tyryry1107 opened this issue Jun 4, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@tyryry1107
Copy link

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 <module>
    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.

@Firepal Firepal added the bug Something isn't working label Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants