From db3a5fcd8edaa45ef05a6250e7f9452f0ed87250 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 2 Jul 2017 22:49:26 +0200 Subject: resample to 16bit 44100hz aiff --- python/spectrum.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'python') diff --git a/python/spectrum.py b/python/spectrum.py index 267f368..1ea9ce5 100644 --- a/python/spectrum.py +++ b/python/spectrum.py @@ -4,11 +4,12 @@ import numpy import scipy import matplotlib.pyplot as plt -if len(sys.argv) < 2: - print "python spectrum.py file.wav" +if len(sys.argv) < 3: + print "python spectrum.py in.aiff out.png" sys.exit() -FILENAME = sys.argv[1] +IN_FILENAME = sys.argv[1] +OUT_FILENAME = sys.argv[2] N_FFT = 2048 @@ -18,7 +19,7 @@ def read_audio_spectum(filename): S = numpy.log1p(numpy.abs(S)) return S, fs -a_spectrum, fs = read_audio_spectum(FILENAME) +a_spectrum, fs = read_audio_spectum(IN_FILENAME) a_spectrum = numpy.flipud(a_spectrum) print a_spectrum.shape @@ -29,4 +30,4 @@ img = plt.imshow(a_spectrum) img.set_cmap('hot') plt.set_cmap('hot') plt.axis('off') -plt.savefig(FILENAME + '.png', transparent=True, bbox_inches='tight', pad_inches=0) +plt.savefig(OUT_FILENAME, transparent=True, bbox_inches='tight', pad_inches=0) -- cgit v1.2.3-70-g09d2