diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-07-18 21:17:12 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-07-20 21:48:54 +0200 |
commit | aee1334ca47ff55c815eee204fe03683a572be0f (patch) | |
tree | ba9beef4beca1ab9ac86430016ff223eece31e75 /helpers/__init__.py | |
parent | b37c72a236806f02e5538ba7e607f6add0cc6fb6 (diff) | |
download | MusicSampler-aee1334ca47ff55c815eee204fe03683a572be0f.tar.gz MusicSampler-aee1334ca47ff55c815eee204fe03683a572be0f.tar.zst MusicSampler-aee1334ca47ff55c815eee204fe03683a572be0f.zip |
Add fading
Diffstat (limited to 'helpers/__init__.py')
-rw-r--r-- | helpers/__init__.py | 2 |
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 | ||
132 | def gain(volume, old_volume=None): | 132 | def 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)), |