From 972dd4b7151ec69eea6d353b200471f8fadf28c6 Mon Sep 17 00:00:00 2001 From: yomguy <> Date: Thu, 21 Aug 2008 15:16:03 +0000 Subject: [PATCH] * Fix syntax --- telemeta/analysis/core.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/telemeta/analysis/core.py b/telemeta/analysis/core.py index 7b8dca08..5ccf68c1 100644 --- a/telemeta/analysis/core.py +++ b/telemeta/analysis/core.py @@ -52,7 +52,7 @@ class AudioProcessor(Component): samples = samples[:,0] return samples - def read(self, start, size, resize_if_less=False): +def read(self, start, size, resize_if_less=False): """ read size samples starting at start, if resize_if_less is True and less than size samples are read, resize the array to size and fill with zeros """ @@ -63,7 +63,10 @@ class AudioProcessor(Component): if start < 0: # the first FFT window starts centered around zero if size + start <= 0: - return numpy.zeros(size) if resize_if_less else numpy.array([]) + if resize_if_less: + return numpy.zeros(size) + else: + return numpy.array([]) else: self.audio_file.seek(0) @@ -85,7 +88,10 @@ class AudioProcessor(Component): samples = self.audio_file.read_frames(to_read) except IOError: # this can happen for wave files with broken headers... - return numpy.zeros(size) if resize_if_less else numpy.zeros(2) + if resize_if_less: + return numpy.zeros(size) + else: + return numpy.zeros(2) # convert to mono by selecting left channel only if self.channels > 1: @@ -175,8 +181,11 @@ class AudioProcessor(Component): if local_min_value < min_value: min_value = local_min_value min_index = local_min_index - - return (min_value, max_value) if min_index < max_index else (max_value, min_value) + + if min_index < max_index: + return (min_value, max_value) + else: + return (max_value, min_value) \ No newline at end of file -- 2.39.5