init.py 376 B

12345678910
  1. import scipy.io.wavfile
  2. def wavfile_read_mono(path):
  3. # https://docs.scipy.org/doc/scipy/reference/generated/scipy.io.wavfile.read.html
  4. rate, data = scipy.io.wavfile.read(path)
  5. data_first_channel = data[:, 0]
  6. for channel_index in range(1, data.shape[1]):
  7. assert (data_first_channel == data[:, channel_index]).all()
  8. return rate, data_first_channel