script that analyzes the volume stored in the wav file written in Python. Average value is calculated in a window of length N. The next window is k, k + N-1, 2 * k 2 * k + N-1, ... Where k
__author__ = "daniel"
__date__ = "2010-03-04 0:21:00 $ $"
scipy.io import from wavfile
import matplotlib.pyplot as pyplot
if __name__ == "__main__": <= length:
# load file
< srednia[-1]):
fs, data = wavfile.read ("/ home / daniel / Music / labedzie.wav)
# combining two channels into one
data = data [:, 0] / 2.0 + data [:, 1] / 2.0
# normalization
data = data / max (data)
# of samples will be enough to jump at the analysis
k = fs / 10
# length window analysis N = 2 ** 13 < N to okna się nakładają. Na końcu z pomocą biblioteki matplotlib rysowany jest wykres głośności.
# number of samples in the file
length, = dane.shape
average = []
while i * k + N
srednia.append (abs (data [i * k i * k + N-1]. mean ()))
i + = 1
pyplot.plot (average)
pyplot.title ("volume graph")
pyplot . show ()
0 comments:
Post a Comment