Created
December 10, 2019 01:41
-
-
Save aidiary/681677aa21c42b3a138cd87db1fa20e3 to your computer and use it in GitHub Desktop.
Jupyter Notebookで音声の簡易再生
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 os | |
import glob | |
from scipy.io import wavfile | |
import matplotlib.pyplot as plt | |
import IPython.display | |
%matplotlib inline | |
target_dir = '/path/to/*.wav' | |
for f in sorted(glob.glob(os.path.join(target_dir)))[:10]: | |
print(f) | |
sr, y = wavfile.read(f) | |
plt.figure() | |
plt.plot(y) | |
plt.ylim((-32768, 32767)) | |
plt.show() | |
IPython.display.display(IPython.display.Audio(f, rate=22050)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment