I want to use Python to access a wav-file and write its content in a form which allows me to analyze it (let\'s say arrays).
pydub provides an even easier solution without any dependencies needing to be installed (for wav files). I'm currently using this method in production without any issues.
from pydub import AudioSegment
awesome_song = AudioSegment.from_wav('awesome_song.wav')
print('Duration in seconds is {}'.format(awesome_song.duration_seconds))
This is good enough for me
import numpy as np
x = np.fromfile(open('song.wav'),np.int16)[24:]
It ignores the first 24 values, because that's not audio, it the header.
Also, if the file was stereo, your channels will have alternating indexes, So I usually just reduce it to mono with Audacity first.