Created
March 9, 2020 06:38
-
-
Save yuyyuyu/5f160b9ad9ad03ddcde69ce609820be7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import random | |
import itertools | |
import librosa | |
import IPython.display as ipd | |
import matplotlib.pyplot as plt | |
def load_audio_file(file_path): | |
input_length = 440000 | |
data = librosa.core.load(file_path,sr=22050)[0] #, sr=16000 | |
if len(data)>input_length: | |
data = data[:input_length] | |
else: | |
data = np.pad(data, (0, max(0, input_length - len(data))), "constant") | |
return data | |
sr=22050 | |
data = load_audio_file("haruhi.wav") | |
data_roll=np.roll(data,32000) | |
librosa.output.write_wav('rolled_haruhi.wav', data_roll,sr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment