@@ -89,28 +89,24 @@ def __init__(self, ir_files, n_fft=2048, rolloff_value=-24):
8989 self .rolloff_value = rolloff_value
9090 self ._register (".*" , self .deform_times )
9191
92+ @staticmethod
93+ def metadata (metadata , state ):
94+ # Extend the annotation time
95+ metadata .duration += state ['ir_groupdelay' ]
96+
9297 @staticmethod
9398 def deform_times (annotation , state ):
9499 # Deform time values for all annotations.
95100
96- ir_groupdelay = state ["ir_groupdelay" ]
101+ # Extend the observation duration by the estimated delay
102+ if annotation .duration is not None :
103+ annotation .duration += state ['ir_groupdelay' ]
97104
105+ # Shift all observations forward in time
98106 for obs in annotation .pop_data ():
99- # Drop obervation that fell off the end
100-
101- if obs .time + ir_groupdelay > annotation .duration :
102- # Drop the annotation if its delayed onset out of the range of duration
103- annotation = annotation .slice (0 , annotation .duration , strict = False )
104- else :
105- # truncate observation's duration if its offset fell off the end of annotation
106- if obs .time + obs .duration + ir_groupdelay > annotation .duration :
107- deformed_duration = annotation .duration - obs .time - ir_groupdelay
108- else :
109- deformed_duration = obs .duration
110-
111107 annotation .append (
112- time = obs .time + ir_groupdelay ,
113- duration = deformed_duration ,
108+ time = obs .time + state [ ' ir_groupdelay' ] ,
109+ duration = obs . duration ,
114110 value = obs .value ,
115111 confidence = obs .confidence ,
116112 )
0 commit comments