LoginSignup
1
1

More than 5 years have passed since last update.

Python 標準パッケージ だけで wav ファイルを読み込む

Posted at

問題

scikits.audiolab とか numpy とかの Python 追加パッケージを
入れられない状況で、 wav ファイルを読み込みたい。

解決方法

wave, array で読み込む。

import wave
import array

wavdata = wave.open(YOUR_WAV_FILE).readframes(-1)
audio = array.array("h", wavdata)   # wav のビット幅が 16bit の場合
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1