Answers for "play wav files python"

1

how to load wav file python

import matplotlib.pyplot as plt
from scipy import signal
from scipy.io import wavfile

sample_rate, samples = wavfile.read('path-to-mono-audio-file.wav')
frequencies, times, spectrogram = signal.spectrogram(samples, sample_rate)

plt.pcolormesh(times, frequencies, spectrogram)
plt.imshow(spectrogram)
plt.ylabel('Frequency [Hz]')
plt.xlabel('Time [sec]')
plt.show()
Posted by: Guest on January-22-2021
1

how to load wav file with python

from scipy.io import wavfile
samplerate, data = wavfile.read('./output/audio.wav')

# method 2
import librosa
#Store the sampling rate as `sr`
y, sr = librosa.load(filename)
Posted by: Guest on January-18-2021

Python Answers by Framework

Browse Popular Code Answers by Language