desbma/r128gain

Tagging fails: ValueError: math domain error

Closed this issue · 1 comments

onny commented

Hey,
I have another corrupt file and maybe we can catch the exception it throws:
https://nextcloud.project-insanity.org/s/XaexSNjZZkHjANT

r128gain -c1 -s 04-There\'s\ No\ Other\ Way.mp3 
Analyzing loudness of file '04-There's No Other Way.mp3'...
Traceback (most recent call last):
  File "/usr/bin/r128gain", line 11, in <module>
    load_entry_point('r128gain==0.8.1', 'console_scripts', 'r128gain')()
  File "/usr/lib/python3.7/site-packages/r128gain/__init__.py", line 640, in cl_main
    report=logging.getLogger().isEnabledFor(logging.INFO) or args.dry_run)
  File "/usr/lib/python3.7/site-packages/r128gain/__init__.py", line 421, in process
    r128_data)
  File "/usr/lib/python3.7/site-packages/r128gain/__init__.py", line 391, in show_scan_report
    peak = "%.1f dBFS" % (scale_to_gain(peak))
  File "/usr/lib/python3.7/site-packages/r128gain/__init__.py", line 248, in scale_to_gain
    return 20 * math.log10(scale)
ValueError: math domain error

Unfortunately the tagging of the album fails with this one corrupt file.

Best regards,
Jonas

Thanks for the report and file.

That file seems invalid, but it is actually successfully decoded by FFmpeg, and contains only a few sample of digital silence, which triggers a bug in my code.

It should be fixed now.