Can't copy selected data from output window to clipboard

I’m making slow progress with my changes to the Pitch Detect plugin for my guitar string research. I’m displaying more data in the output window but have found that while I can select text in the window I can’t run a “copy to system clipboard” using either the Edit menu or the keyboard command. Am running on a Mac – anybody know if this works on Windows?

Looked at Nyquist.cpp and wasn’t sure which function was rendering Analysis plugin windows and am not sure what needs to be changed enable this behavior for these types of wxWindows. Anyone know what needs to change to make this work?

I then wondered if I could use the debug Window in a similar fashion as I can using the Nyquist Prompt plugin. Output in the debug window is easily selected and copied. But in a normal plugin the debug window only opens when the plugin generates an error. I crashed Audacity numerous types failing to get this to work :wink:

Copying text from a message dialog to the system clipboard works on Linux. It doesn’t work on Windows. I’ve not tested on Mac, but from your previous post it sounds like it doesn’t on Mac. This isn’t a fault of Audacity, it is simply how the OS interacts with wx dialogs.

Text in a debug window should be copyable on all platforms.
To print from Nyquist to the debug window, use:

(format t "print this text to debug window")

Info about FORMAT command:

Note that for Nyquist in Audacity, standard-output is the debug output. This is the destination when using (format T “text”).

To print to a message dialog, the “return value” of the script must be the string that you want printed.
Using the FORMAT command: (format nil “text”)
Using a string literal: “print me”
Using the PRINT command: (print “text”)

That works, thanks Steve!

I’m now both sending a successful result to stdout and returning it as a value from the function – so when I run with the Debug button I get two dialogs and the second one I can select and copy from.

Is there a way in the plugin to tell if it’s being run with the Debug button?

In my earlier investigation into copying selected text I noticed that I could do that successfully from the “About Audacity” window – but wasn’t easily able to tell the difference in how that window was rendered.

Nyquist has no way of knowing if the debug button was pressed.

If outputting a lot of text data is required, it may be worth considering writing to a file. This is a bit awkward in Nyquist plug-ins as there isn’t a file browser available for Nyquist plug-ins. “Sample Data Export” is an example of how writing to a file may be implemented:

Once I figure out how to process and generate the data I need for analysis of one string and scale length it will be useful to be able to process all the tracks in a collection for a set of strings. Currently I generate 12 tracks when measuring one set of strings. Each track has a sample of the tone from a single string at either 650mm or 325mm scale length.

If I have selected multiple tracks and call my Nyquist plugin are the sounds from each track passed in as an argument?

Is the name of the file and/or the names of the tracks available to my plugin?

I could use the filename to generate an appropriate variant filename for the fundamental frequency data and use the track names to identify sections of data in the report as string and scale length. If not I can add more input fields to the plugin.

It’s very interesting looking at the data I’ve collected manually and trying to determine the most accurate and repeatable way to determine a value for fundamental frequency. I’m using the pitch data from the two scale lengths and fret depression difference to calculate longitudinal stiffness. Depending on how the string is plucked and the type of string it appears the fundamental frequency can change and even oscillate. The processing needs to take into account these changes in pitch when a string is plucked from the measurement artifacts using YIN with various settings.

For anyone curious I’ve attached a png image of one section of the spreadsheet I’m analyzing the data with. It shows a surprising shift in frequency at about 1.25 s. Collecting pitch data using YIN with a smaller window size and shifting through the data using a smaller increment shows more detail.

I’m curious how much of this is real and whether any part of how the variation in pitch the data present might be is a YIN artifact.

Track name is available.

(get '*track* 'name)