changeset 65:029159daf3f1

Make script robust to spurious note-offs
author Chris Cannam
date Wed, 12 Aug 2015 19:15:29 +0100
parents 2e08ae56b4b5
children 194ddc4bd6b0
files multiple_f0_estimation/silvet-live/frames.py multiple_f0_estimation/silvet/frames.py
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/multiple_f0_estimation/silvet-live/frames.py	Wed Aug 12 17:45:36 2015 +0100
+++ b/multiple_f0_estimation/silvet-live/frames.py	Wed Aug 12 19:15:29 2015 +0100
@@ -25,7 +25,8 @@
         while ix < len(data) and sec >= float(data[ix][0]):
             time, freq, vely = data[ix][:3]
             if vely == "0":
-                del extant[freq]
+                if freq in extant:
+                    del extant[freq]
             else:
                 extant[freq] = vely
             ix = ix + 1
--- a/multiple_f0_estimation/silvet/frames.py	Wed Aug 12 17:45:36 2015 +0100
+++ b/multiple_f0_estimation/silvet/frames.py	Wed Aug 12 19:15:29 2015 +0100
@@ -25,7 +25,8 @@
         while ix < len(data) and sec >= float(data[ix][0]):
             time, freq, vely = data[ix][:3]
             if vely == "0":
-                del extant[freq]
+                if freq in extant:
+                    del extant[freq]
             else:
                 extant[freq] = vely
             ix = ix + 1