diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-07-02 22:49:26 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-07-02 22:49:26 +0200 |
| commit | db3a5fcd8edaa45ef05a6250e7f9452f0ed87250 (patch) | |
| tree | 871703028cef31309102d452197d737bc5cc76e8 /python | |
| parent | ef0d6a05a1717b9cb9b52fca9285c9ba8c191b0c (diff) | |
resample to 16bit 44100hz aiff
Diffstat (limited to 'python')
| -rw-r--r-- | python/spectrum.py | 11 |
1 files changed, 6 insertions, 5 deletions
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) |
