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

Got ZeroDivisionError with high sample path... #9

Open
nandoflorestan opened this issue Feb 5, 2018 · 1 comment
Open

Got ZeroDivisionError with high sample path... #9

nandoflorestan opened this issue Feb 5, 2018 · 1 comment

Comments

@nandoflorestan
Copy link
Contributor

The file leveler.py sometimes has run into a ZeroDivisionError, printing out the line "Got ZeroDivisionError with high sample path"... But I don't know what this means exactly, so here are a couple of questions:

  • How does the leveler work?
  • Why is there a division by zero issue?
  • Is there any way we could recover from that error automatically?
  • If not, can we at least let the user know how to work around the error?
@psobot
Copy link
Owner

psobot commented Apr 3, 2018

That error message is certainly confusing! That could be made simpler.

  • The leveler works according to this algorithm. Because SampleScanner doesn't normalize its output, the leveler performs the following algorithm:
    1. Determine the layer RMS volumes in decibels.
    2. For each layer below the loudest, determine the difference in decibels -- ddd.
    3. Calculate the equivalent velocity: sqrt( 127^2 / arclog( ddd / 20 ) ) and call this vvv.
    4. Tag each layer with lovel=xxx, hivel=vvv and amp_velcurve_vvv=1, where xxx is one more than the lower layer's hivel, as usual.
  • The ZeroDivisionError comes about if the peak_rms of the higher sample is 0, which basically means it's silent. This can happen in exceptional conditions, and SampleScanner doesn't have any logic to catch and ignore empty samples at the moment.
  • We can recover from that error automatically by changing that code path to produce different operators when one or more of the samples is blank, or more completely, by changing the code path so we exclude empty samples anyways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants