summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/plotpeaks.py2
-rw-r--r--simpl/mq.py2
-rw-r--r--simpl/plot/__init__.py4
3 files changed, 4 insertions, 4 deletions
diff --git a/examples/plotpeaks.py b/examples/plotpeaks.py
index ea9ff4c..adf9110 100644
--- a/examples/plotpeaks.py
+++ b/examples/plotpeaks.py
@@ -10,7 +10,7 @@ if len(sys.argv) != 2:
audio = simpl.read_wav(sys.argv[1])[0]
# take just a few frames
-audio = audio[len(audio) / 2:(len(audio) / 2) + 4096]
+audio = audio[len(audio) // 2:(len(audio) // 2) + 4096]
# peak detection using the SndObj library
pd = simpl.SndObjPeakDetection()
diff --git a/simpl/mq.py b/simpl/mq.py
index d8a701d..ef5acdd 100644
--- a/simpl/mq.py
+++ b/simpl/mq.py
@@ -186,7 +186,7 @@ class MQPartialTracking(simpl.PartialTracking):
free_peaks = [p for p in free_peaks if p.amplitude > 0]
distances = [abs(peak.frequency - p.frequency) for p in free_peaks]
if len(distances):
- min_distance_position = min(xrange(len(distances)),
+ min_distance_position = min(range(len(distances)),
key=distances.__getitem__)
if min(distances) < self._matching_interval:
return free_peaks[min_distance_position]
diff --git a/simpl/plot/__init__.py b/simpl/plot/__init__.py
index 75441c6..65d45e9 100644
--- a/simpl/plot/__init__.py
+++ b/simpl/plot/__init__.py
@@ -6,7 +6,7 @@ def plot_peaks(frames):
"Plot peaks found by a peak detection algorithm"
# Get the maximum peak amplitude, used to select an appropriate
# colour for each peak.
- max_amp = None
+ max_amp = 0
for frame in frames:
if frame.peaks:
max_amp = max(max_amp, max([p.amplitude for p in frame.peaks]))
@@ -26,7 +26,7 @@ def plot_partials(frames, show_peaks=False):
"Plot partials created by a partial tracking algorithm"
# Get the maximum peak amplitude, used to select an appropriate
# colour for each peak.
- max_amp = None
+ max_amp = 0
for frame in frames:
if frame.partials:
max_amp = max(max_amp, max([p.amplitude for p in frame.partials]))