Hello,
I have two label tracks as tab separated text files for a given .wav file. I load the wav file using commands over named pipe and additional I can load one of the label tracks by sending addLabel and setLabel: from inside a loop. That works. But if I want to load the second one additionally The first label track is messed up and the second label track has empty text labels and start and end is always the full span.
I guess, there is a problem with label index, but the label index is ascending from 0 and looks good.
This is the relevant code
def import_label_track(file_name, title):
global lastLabelIndex
print("Last index", lastLabelIndex)
doCommand('NewLabelTrack')
doCommand("SetTrack: Name=" "\"" + title + "\"")
with open(file_name, 'r') as label_file:
lines = label_file.readlines()
for index, each_line in enumerate(lines):
fields = each_line.strip().split()
doCommand("AddLabel")
# time.sleep(1.5)
command_string = "SetLabel: Label=" + str(lastLabelIndex) + " Text=\"" + fields[2] + "\"" + " Start=" + fields[0] + " End=" + fields[1]
# command_string = "SetLabel: Text=\"" + fields[2] + "\"" + " Start=" + fields[0] + " End=" + fields[1]
print(command_string)
doCommand(command_string)
lastLabelIndex = index
Any ideas, whats wrong? I am using audacity git from 19. April 2021under Ubuntu 20.04
Thank you
Enno