Hi. I am able to read the label track in audacity using the code below but not able to create an empty track and load these values. Please help.
;nyquist plug-in
;version 4
;type process
;name "Load Labels"
;action "Load Labels"
; Define the label file path with spaces
(setq label-file "C:/Users/audio_master/T_6006.txt")
; Open the label file for reading
(setq input-port (open label-file "r"))
; Read and process each line of the label file
(loop
(setq line (read-line input-port))
(if (null line) (return))
(format t "~a~%" line))
; Close the label file
(close input-port)
;nyquist plug-in
;version 4
;type generate
;name "Load Labels"
;control LABEL-FILE "Label File" string "" "C:/Users/audio_master/T_6006.txt"
(defun import-labels (fname)
(let ((file-pointer (open fname "r"))
labels)
; Read and process each line of the label file
(do ((line (read-line file-pointer) (read-line file-pointer)))
((not line))
; Convert string to a list
(setf label (eval-string (format nil "'(~a)" line)))
; Set third element to an empty string.
(setf (nth 2 label) "")
(push label labels))
; Close the label file
(close file-pointer)
labels))
(import-labels LABEL-FILE)