aboutsummaryrefslogtreecommitdiff
path: root/helpers/__init__.py
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2016-07-18 21:17:12 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2016-07-20 21:48:54 +0200
commitaee1334ca47ff55c815eee204fe03683a572be0f (patch)
treeba9beef4beca1ab9ac86430016ff223eece31e75 /helpers/__init__.py
parentb37c72a236806f02e5538ba7e607f6add0cc6fb6 (diff)
downloadMusicSampler-aee1334ca47ff55c815eee204fe03683a572be0f.tar.gz
MusicSampler-aee1334ca47ff55c815eee204fe03683a572be0f.tar.zst
MusicSampler-aee1334ca47ff55c815eee204fe03683a572be0f.zip
Add fading
Diffstat (limited to 'helpers/__init__.py')
-rw-r--r--helpers/__init__.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/helpers/__init__.py b/helpers/__init__.py
index 9d66638..f5ad848 100644
--- a/helpers/__init__.py
+++ b/helpers/__init__.py
@@ -131,7 +131,7 @@ def duration_to_min_sec(duration):
131 131
132def gain(volume, old_volume=None): 132def gain(volume, old_volume=None):
133 if old_volume is None: 133 if old_volume is None:
134 return 20 * math.log10(volume / 100) 134 return 20 * math.log10(max(volume, 0.1) / 100)
135 else: 135 else:
136 return [ 136 return [
137 20 * math.log10(max(volume, 0.1) / max(old_volume, 0.1)), 137 20 * math.log10(max(volume, 0.1) / max(old_volume, 0.1)),