From 3a9e3a4da735d22f2dad877073d6c9f55b68c5e1 Mon Sep 17 00:00:00 2001 From: sg3510 Date: Thu, 26 Feb 2015 14:33:41 +0000 Subject: [PATCH] adding limit support --- dejavu/decoder.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dejavu/decoder.py b/dejavu/decoder.py index 69eab52..960fbd8 100755 --- a/dejavu/decoder.py +++ b/dejavu/decoder.py @@ -44,9 +44,12 @@ def read(filename, limit=None): except audioop.error: fs, _, audiofile = wavio.readwav(filename) + if limit: + audiofile = audiofile[:limit * 1000] + audiofile = audiofile.T audiofile = audiofile.astype(np.int16) - + channels = [] for chn in audiofile: channels.append(chn)