Last active
June 11, 2018 10:48
-
-
Save paramsen/b7dc45a127194e3e92623fa38a99599d to your computer and use it in GitHub Desktop.
Script that reads a file with raw pcm data in little endian float32 and prints the mean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import numpy | |
import struct | |
f = sys.argv[1] | |
avg = lambda f: numpy.mean(numpy.absolute(numpy.fromfile(f, '<f4')), dtype=numpy.float64) | |
print('average of %s: %.16f' % (f, avg(f))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment