I am trying to load label tracks using pipe-mod-script. It is working fine for one sample label file but for the second label file it is writing the outputs in the same label track. How can I change the label track. Below is the code
# docimages_labels.py
# Sends commands to get images for the manual.
# Images for https://alphamanual.audacityteam.org/man/Removing_Labels_-_Examples
# Make sure Audacity is running first and that mod-script-pipe is enabled
# before running this script.
# Modified by me
#load and run the common core.
exec( open("docimages_core.py" ).read() )
import numpy as np
import argparse
def read_audacity_labels(filename):
lbls = np.genfromtxt(filename, dtype=[('start', 'f',),('stop','f'),('label','S20')], delimiter = '\t', autostrip=True)
return lbls
def addLabels(label_num, st_time, end_time, label_txt):
#do( 'Select: Start=0 End=1' )
do( 'AddLabel' )
do( 'SetLabel: Label={} Text={} Start={} End={} '.format(label_num, label_txt, st_time, end_time))
def new_track():
do( 'NewLabelTrack' )
#imageSet("Labels")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=""" Audacity label file mod-script parser""")
parser.add_argument("--labelpath", type = str,help= 'audacity label path')
args = parser.parse_args()
label_file = args.labelpath
lbls = read_audacity_labels(label_file)
count = 0
#new_track()
for i in lbls:
addLabels(count,i['start'], i['stop'], i['label'])
#count += 1
To run the pipeline (suppose filename is mod_label.py):
python mod_label.py --labelpath "./aud_labelfile.txt"
Please guide.
Regards