Skip to content

Commit

Permalink
fix: allocate temporal value to eps
Browse files Browse the repository at this point in the history
  • Loading branch information
keonlee9420 committed Apr 23, 2021
1 parent 089b4a9 commit c396a3a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions data/noise_mixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def audioread(path, tg_path=None, norm=True, start=0, stop=None):
# Funtion to write audio
def audiowrite(data, fs, destpath, norm=False):
if norm:
eps = 1e-6
rms = (data ** 2).mean() ** 0.5
scalar = 10 ** (-25 / 10) / (rms+eps)
data = data * scalar
Expand Down
1 change: 1 addition & 0 deletions data/noise_mixer_refs.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def audioread(path, tg_path=None, norm=True, start=0, stop=None):
# Funtion to write audio
def audiowrite(data, fs, destpath, norm=False):
if norm:
eps = 1e-6
rms = (data ** 2).mean() ** 0.5
scalar = 10 ** (-25 / 10) / (rms+eps)
data = data * scalar
Expand Down

0 comments on commit c396a3a

Please sign in to comment.