Skip to content

Commit

Permalink
Merge pull request #416 from librosa/write_wav_norm
Browse files Browse the repository at this point in the history
write_wav only normalizes on floating point data
  • Loading branch information
bmcfee committed Oct 4, 2016
2 parents b0e7669 + 5ccfafe commit d1fb51a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions librosa/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def times_csv(path, times, annotations=None, delimiter=',', fmt='%0.3f'):
writer.writerow([(fmt % t), lab])


def write_wav(path, y, sr, norm=True):
def write_wav(path, y, sr, norm=False):
"""Output a time series as a .wav file
Parameters
Expand All @@ -198,7 +198,8 @@ def write_wav(path, y, sr, norm=True):
sampling rate of `y`
norm : boolean [scalar]
enable amplitude normalization
enable amplitude normalization.
For floating point `y`, scale the data to the range [-1, +1].
Examples
--------
Expand All @@ -214,7 +215,7 @@ def write_wav(path, y, sr, norm=True):
util.valid_audio(y, mono=False)

# normalize
if norm:
if norm and np.issubdtype(y.dtype, np.float):
wav = util.normalize(y, norm=np.inf, axis=None)
else:
wav = y
Expand Down

0 comments on commit d1fb51a

Please sign in to comment.