Skip to content

Commit

Permalink
test local added to travis
Browse files Browse the repository at this point in the history
  • Loading branch information
astorfi committed Mar 3, 2018
1 parent 6d2b892 commit 41fd0e9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions speechpy/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ def cmvn(vec, variance_normalization=False):
Return:
array: The mean(or mean+variance) normalized feature vector.
"""
eps = 2**-30
rows, cols = vec.shape

# Mean calculation
Expand All @@ -189,7 +190,7 @@ def cmvn(vec, variance_normalization=False):
if variance_normalization:
stdev = np.std(mean_subtracted, axis=0)
stdev_vec = np.tile(stdev, (rows, 1))
output = mean_subtracted / stdev_vec
output = mean_subtracted / (stdev_vec + eps)
else:
output = mean_subtracted

Expand All @@ -209,6 +210,7 @@ def cmvnw(vec, win_size=301, variance_normalization=False):
array: The mean(or mean+variance) normalized feature vector.
"""
# Get the shapes
eps = 2**-30
rows, cols = vec.shape

# Windows size must be odd.
Expand Down Expand Up @@ -236,7 +238,7 @@ def cmvnw(vec, win_size=301, variance_normalization=False):
for i in range(rows):
window = vec_pad_variance[i:i + win_size, :]
window_variance = np.std(window, axis=0)
variance_normalized[i, :] = mean_subtracted[i, :] / window_variance
variance_normalized[i, :] = mean_subtracted[i, :] / (window_variance + eps)
output = variance_normalized
else:
output = mean_subtracted
Expand Down

0 comments on commit 41fd0e9

Please sign in to comment.