PyMusicLooper icon indicating copy to clipboard operation
PyMusicLooper copied to clipboard

Using split-audio with --format "ogg" results in silent crash

Open churipputori opened this issue 1 year ago • 1 comments

Before continuing with the bug report, does updating to the latest version fix this issue? [Yes/No] No, tested on both newest stable and nightly

Describe the bug When using the command split-audio with the option --format "ogg", the will silently exit back to the prompt, outputting an unplayable 5kb .ogg file. This occurred with both a .wav and .flac input file and .ogg output. This occurred regardless of input music. This does not occur with any input file and a .mp3 or .wav output.

Debugging Information Verbose:

PS C:\Users\user\Music\work> pymusiclooper.exe -v split-audio --path '.\E199_BGM00_L_16 test.wav' --format "OGG" INFO Loaded ".\E199_BGM00_L_16 test.wav". Analyzing... INFO Detected 666 beats at 112 bpm INFO Finished initial audio processing in 4.375s INFO Found 40 possible loop points in 0.080s INFO Filtered to 40 best candidate loop points INFO Total analysis runtime: 4.519s PS C:\Users\user\Music\work>

Debug:

PS C:\Users\user\Music\work> pymusiclooper.exe --debug split-audio --path '.\E199_BGM00_L_16 test.wav' --format "OGG" C:\Users\user\pipx\venvs\pymusiclooper\Lib\site-packages\librosa\core\intervals.py:15: DeprecationWarning: path is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice. with resources.path("librosa.core", "intervals.msgpack") as imsgpack: C:\Users\user\pipx\venvs\pymusiclooper\Lib\site-packages\audioread\rawread.py:16: DeprecationWarning: 'aifc' is deprecated and slated for removal in Python 3.13 import aifc C:\Users\user\pipx\venvs\pymusiclooper\Lib\site-packages\audioread\rawread.py:17: DeprecationWarning: 'audioop' is deprecated and slated for removal in Python 3.13 import audioop C:\Users\user\pipx\venvs\pymusiclooper\Lib\site-packages\audioread\rawread.py:19: DeprecationWarning: 'sunau' is deprecated and slated for removal in Python 3.13 import sunau C:\Users\user\pipx\venvs\pymusiclooper\Lib\site-packages\librosa\core\convert.py:1870: RuntimeWarning: divide by zero encountered in log10

  • 2 * np.log10(f_sq) PS C:\Users\user\Music\work>

(It should be noted that the progress bar still continues for some time after these warnings before exiting silently)

Expected behavior The file exports just as it does with .wav as the output, just already in the required format.

Environment Information (please complete the following information):

  • OS: Windows 10 21H2
  • PyMusicLooper version being used (execute pymusiclooper --version in the terminal if unsure): pymusiclooper 3.4.1
  • Is FFmpeg installed and working? (execute ffmpeg --version in the terminal if unsure): Yes

Additional context In interactive mode, it is able to find loop points and interact as expected. It is only when the file writing process begins that the process terminates, leaving an almost empty (5kb) file.

churipputori avatar May 24 '24 06:05 churipputori

It looks like libsndfile runs into a segfault on Windows, causing the silent crash. Enabling the python faulthandler import faulthandler; faulthandler.enable() shows the following message (truncated for clarity):

Windows fatal exception: stack overflow

Current thread 0x000024dc (most recent call first):
 File "C:\[...]\lib\site-packages\soundfile.py", line 1353 in _cdata_io
  File "C:\[...]\lib\site-packages\soundfile.py", line 1344 in _array_io
  File "C:\[...]\lib\site-packages\soundfile.py", line 1020 in write
  File "C:\[...]\lib\site-packages\soundfile.py", line 345 in write
  File "C:\[...]\pymusiclooper\core.py", line 143 in export

Strangely enough, I've only run into this issue on Windows, not on Linux.

Unfortunately, since this isn't an issue with PyMusicLooper itself, but an upstream dependency, I don't have an ETA for a fix. However, in the meantime, the other supported formats should work and can be used instead on Windows. As a workaround, if initial size and quality for external OGG conversion is a concern, consider using FLAC instead of the default WAV format.

arkrow avatar May 25 '24 19:05 arkrow