Calculate, then place results in a label

working with nyquist and aud-do,
selecting audio then calculating a result (in this case a guess at the note),
then creating a label at the selection, and placing the result into the label.

These two don’t work:
(1) PasteNewLabel,
because I haven’t found a way to put the result into the pastebuffer/clipboard.
(2) AddLabel and then SetLabel,
because you have to know the number of the new label…
but you don’t, because the numbering is timeline-chronologic, not creation-time-chronologic,
so even if you can get the current count of #labels,
(and p.s. how to do that?)
you’ll be filling in the wrong label if the new label is not the last on the timeline.

Any suggestions?

If you only need to deal with one label track at a time, you can create labels directly from Nyquist rather than using AUD-DO. This is faster and more efficient than AUD-DO. You just have to return a correctly formatted list.

See the “Labels” section here: https://web.archive.org/web/20230405064412/https://wiki.audacityteam.org/wiki/Nyquist_Plug-ins_Reference#Return_Values
Also, look at the “Regular Interval Labels” plug-in (equallabels.ny) for an example of producing labels directly from Nyquist.

There is a known and logged bug re pasting into labels:

Copying label text with ‘Ctrl+C’ doesn’t work when label track isn’t selected #2854

Peter

Thanks, steve,
I found equalabel.ny https://github.com/audacity/audacity/blob/master/plug-ins/equalabel.ny (so different spelling)
and it was really informative…
it works! so I have begun to study it.

This topic was automatically closed after 30 days. New replies are no longer allowed.