Skip to content

Instantly share code, notes, and snippets.

@aidiary
Created December 10, 2019 01:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aidiary/681677aa21c42b3a138cd87db1fa20e3 to your computer and use it in GitHub Desktop.
Save aidiary/681677aa21c42b3a138cd87db1fa20e3 to your computer and use it in GitHub Desktop.
Jupyter Notebookで音声の簡易再生
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