I am trying to run the diariazation pipeline on multiple file segments which are continuous parts of a long audio file.
Here is what I am doing. To put it simple and ideally, I just need to set the timestamp_shift correctly for each segment.
timestamp_shift=0
#initialize pipeline here
for fsplit in split_file_paths:
args.source = fsplit
padding = config.get_file_padding(args.source)
audio_source = src.FileAudioSource(args.source, config.sample_rate, padding, block_size)
pipeline.set_timestamp_shift(-padding[0] + timestamp_shift)
#timestamp_shift += (audio_source.duration-config.duration)
timestamp_shift += (audio_source.duration)
inference = StreamingInference(
pipeline,
source=audio_source,
batch_size=config.batch_size,
do_profile=True,
show_progress=False,
)
# Attach observers for required side effects
observers = []
# observers = [pipeline.suggest_writer(audio_source.uri, args.output)]
if not args.no_plot:
observers.append(pipeline.suggest_display())
inference.attach_observers(*observers)
#inference.source=audio_source
res=inference()
But the result is incorrect. Specifically, the result of each segment after the first one is always one duration (5 seconds in my config) forward. Here is an example diariazation result to explain the probem. To check if the timestamp is correct, I have done a dummy test. I used the same file segment in two consecutive running of the pipeline. The duration of this file segment is 300 seconds. You can see that in the first segment, the speech starts at 7.820 seconds which is correct. In the second segment, it is supposed to start at roughly 307.820 seconds, but the result is starting at 312.820 seconds. The difference is exactly 5 seconds. I have gone into the code by debugging. It looks like that the last_end_time of audio_buffer in the end of each segment is always 5 seconds forward. But I do not know how to fix it .
#diariazation of first segment, total duration is 300 seconds
0.000-- 0.800 Music. 7.820--12.140 Hello and welcome to Close Up with The Hollywood Reporter. Actresses, I'm Matthew Bellany. 12.360--16.220 I'd like to welcome our guest today, Sarsha
Ronan, Allison Janney. 16.620--20.360 Mary J. Blige Emma Stone Jennifer Lawrence 20.830--21.890 and Jessica Chastain. 22.270--26.490 Let's get started. Obviously the headlines in Hollywood
#diariazation of second segment, totoal duration is 300 seconds
305.000--305.840 Music. 312.820--317.160 Hello and welcome to Close Up with The Hollywood Reporter. Actresses, I'm Matthew Bellany. 317.380--321.220 I'd like to welcome our guest today,
Sarsha Ronan, Allison Janney. 321.620--325.360 Mary J. Blige Emma Stone Jennifer Lawrence 325.830--326.890 and Jessica Chastain. 327.270--331.490 Let's get started. Obviously the headlines
I am trying to run the diariazation pipeline on multiple file segments which are continuous parts of a long audio file.
Here is what I am doing. To put it simple and ideally, I just need to set the
timestamp_shiftcorrectly for each segment.But the result is incorrect. Specifically, the result of each segment after the first one is always one duration (5 seconds in my config) forward. Here is an example diariazation result to explain the probem. To check if the timestamp is correct, I have done a dummy test. I used the same file segment in two consecutive running of the pipeline. The duration of this file segment is 300 seconds. You can see that in the first segment, the speech starts at 7.820 seconds which is correct. In the second segment, it is supposed to start at roughly 307.820 seconds, but the result is starting at 312.820 seconds. The difference is exactly 5 seconds. I have gone into the code by debugging. It looks like that the
last_end_timeof audio_buffer in the end of each segment is always 5 seconds forward. But I do not know how to fix it .