shithub: aubio

Download patch

ref: 8d29cfe3df450227c100acf2c9051737b0dd95d7
parent: f72a10dce69fce873fa5b89335934fdba35d1114
author: Paul Brossier <piem@altern.org>
date: Mon Feb 20 06:33:18 EST 2006

add support for delay to task onset, invert silence output, remove unused import
add support for delay to task onset, invert silence output, remove unused import


--- a/python/aubio/tasks.py
+++ b/python/aubio/tasks.py
@@ -1,5 +1,4 @@
 from aubioclass import * 
-from bench.node import bench
 
 def get_onset_mode(nvalue):
         """ utility function to convert a string to aubio_onsetdetection_type """
@@ -201,6 +200,7 @@
 		self.silence = -70
 		self.derivate = False
 		self.localmin = False
+		self.delay = 0.
 		self.storefunc = False
 		self.bufsize = 512
 		self.hopsize = 256
@@ -271,9 +271,9 @@
 			else: self.issilence = -1 
 			self.wassilence = 0
 		if self.issilence == -1:
-			return -1, self.frameread 
+			return self.frameread, -1
 		elif self.issilence == 2:
-			return 2, self.frameread 
+			return self.frameread, 2 
 
 class taskpitch(task):
 	def __init__(self,input,params=None):
@@ -373,6 +373,7 @@
                                 now = (self.frameread+1-i)
                         else:
                                 now = self.frameread
+			if self.params.delay != 0.: now -= self.params.delay
                         if now < 0 :
                                 now = 0
 			return now, val