desbma / r128gain

Fast audio loudness scanner & tagger (ReplayGain v2 / R128)
GNU Lesser General Public License v2.1
172 stars 9 forks source link

Tagging fails: ValueError: math domain error #6

Closed onny closed 5 years ago

onny commented 5 years ago

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

desbma commented 5 years ago

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.