librosa.output.write_wav

librosa.output.write_wav(path, y, sr, norm=True)[source]

Output a time series as a .wav file

Parameters:

path : str

path to save the output wav file

y : np.ndarray [shape=(n,) or (2,n)]

audio time series (mono or stereo)

sr : int > 0 [scalar]

sampling rate of y

norm : boolean [scalar]

enable amplitude normalization

Examples

Trim a signal to 5 seconds and save it back

>>> y, sr = librosa.load(librosa.util.example_audio_file(),
...                      duration=5.0)
>>> librosa.output.write_wav('file_trim_5s.wav', y, sr)