Can't copy selected data from output window to clipboard

Using Nyquist scripts in Audacity.
Post and download new plug-ins.

If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like

Can't copy selected data from output window to clipboard

Permanent link to this post Posted by stepheneb » Sat Jan 20, 2018 4:17 pm

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 ;-)
stepheneb
 
Posts: 13
Joined: Wed Jan 17, 2018 3:51 am
Operating System: OS X 10.11 El Capitan or later (macOS)

Re: Can't copy selected data from output window to clipboard

Permanent link to this post Posted by steve » Sat Jan 20, 2018 6:02 pm

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:
Code: Select all
(format t "print this text to debug window")
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 46815
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Can't copy selected data from output window to clipboard

Permanent link to this post Posted by steve » Sat Jan 20, 2018 6:09 pm

Info about FORMAT command: http://www.audacity-forum.de/download/e ... ef-121.htm

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.
Examples:
Using the FORMAT command: (format nil "text")
Using a string literal: "print me"
Using the PRINT command: (print "text")
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 46815
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Can't copy selected data from output window to clipboard

Permanent link to this post Posted by stepheneb » Sat Jan 20, 2018 7:31 pm

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.
stepheneb
 
Posts: 13
Joined: Wed Jan 17, 2018 3:51 am
Operating System: OS X 10.11 El Capitan or later (macOS)

Re: Can't copy selected data from output window to clipboard

Permanent link to this post Posted by steve » Sun Jan 21, 2018 1:59 am

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: http://manual.audacityteam.org/man/samp ... xport.html
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 46815
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Can't copy selected data from output window to clipboard

Permanent link to this post Posted by stepheneb » Sun Jan 21, 2018 6:35 am

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.

Martin-M540-light-650mm-9070g-G3.png
Martin-M540-light-650mm-9070g-G3.png (156.15 KiB) Viewed 664 times
Last edited by steve on Sun Jan 21, 2018 8:26 am, edited 1 time in total.
Reason: Change img tag to attachment tag (to embed attachment into post)
stepheneb
 
Posts: 13
Joined: Wed Jan 17, 2018 3:51 am
Operating System: OS X 10.11 El Capitan or later (macOS)

Re: Can't copy selected data from output window to clipboard

Permanent link to this post Posted by steve » Sun Jan 21, 2018 8:29 am

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

Track name is available.
Code: Select all
(get '*track* 'name)

See: http://wiki.audacityteam.org/wiki/Nyqui ... 2ATRACK.2A
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 46815
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu


Return to Nyquist



Who is online

Users browsing this forum: No registered users and 1 guest