shithub: aubio

Download patch

ref: 9d1606df257583bf622e31216d060c289c5b6716
parent: c7d8cb1a1c0e482e8c9ed63f0ebb3d0ba989f198
author: Paul Brossier <piem@piem.org>
date: Sat Jan 11 07:45:18 EST 2014

python/scripts/aubiocut: use stamp, not onset

--- a/python/scripts/aubiocut
+++ b/python/scripts/aubiocut
@@ -173,10 +173,10 @@
         g = sink(new_sink_name(source_base_name, 0.), samplerate)
         total_frames = 0
         # get next region
-        next_onset = int(timestamps.pop(0))
+        next_stamp = int(timestamps.pop(0))
         while True:
             vec, read = s()
-            remaining = next_onset - total_frames
+            remaining = next_stamp - total_frames
             if remaining <= read:
                 # write remaining samples from current region
                 g(vec[0:remaining], remaining)
@@ -183,14 +183,14 @@
                 # close this file
                 del g
                 # create a new file for the new region
-                g = sink(new_sink_name(source_base_name, next_onset / float(samplerate)), samplerate)
+                g = sink(new_sink_name(source_base_name, next_stamp / float(samplerate)), samplerate)
                 # write the remaining samples in the new file
                 g(vec[remaining:read], read - remaining)
                 #print "new slice", total_frames_written, "+", remaining, "=", start_of_next_region
                 if len(timestamps):
-                    next_onset = int(timestamps.pop(0))
+                    next_stamp = int(timestamps.pop(0))
                 else:
-                    next_onset = 1e120
+                    next_stamp = 1e120
             else:
                 g(vec[0:read], read)
             total_frames += read