]> git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/blobdiff - helpers/__init__.py
Add fading
[perso/Immae/Projets/Python/MusicSampler.git] / helpers / __init__.py
index 9d6663893bc32634b1163f7a525b8b04a7bdf9a5..f5ad848b855324c7a9133a29533d4535bb9f210d 100644 (file)
@@ -131,7 +131,7 @@ def duration_to_min_sec(duration):
 
 def gain(volume, old_volume=None):
     if old_volume is None:
-        return 20 * math.log10(volume / 100)
+        return 20 * math.log10(max(volume, 0.1) / 100)
     else:
         return [
                 20 * math.log10(max(volume, 0.1) / max(old_volume, 0.1)),