Closed alrhalford closed 5 years ago
You are dealing with audio, which is generally sinusoidal. The average value of a sinusoid is 0 or a constant value.
You should look into the "root mean square value", rather than the average to determine loudness. That will likely be better suited for what you are trying to do.
Good point, ok, but if I use RMS, that should be fine?
Yeah that should work. If it does not then there might be issues with the file that was loaded. you can try running some error checks to make sure it was loaded properly:
clip = wavio.read(file)
length_in_seconds = len(clip.data)/clip.rate # length of loaded data in seconds
type(clip.data) #this should return numpy.ndarray
mean_amplitude = numpy.mean(clip.data)
Yep, perfect. Had a bit of an issue with integer overflow, but got there in the end. Thank you!
Hi, I have a wav file, and I need a crude estimate of its average loudness (to measure ambient noise levels in a room). Does the following make sense:
or have I fundamentally misunderstood what wavio returns when it read a wav file?