That’s my blog
Mostly it’s about using Nyquist in Audacity, but there’s not (yet) much about using Audacity’s macro scripting commands with Nyquist on that site - I may add some stuff as and when I have time.
It could be. Could you provide exact steps for a test case that I can try?
Unfortunately no. “AUD-DO” (and “AUD-DO-COMMAND”) calls Audacity’s “macro scripting” commands (Scripting Reference - Audacity Manual) and they always use seconds for time, with precision limited to 5 decimal places.
Nyquist itself is sample accurate, but cannot access audio outside of the selection at the time that the effect is launched.
Hmm. Unfortunately your code as posted produces a different effect on my end. Ahh… the joys of isolating all the variables.
Both codes (yours and mine, which should be equiv to yours) produce a selection that is not sample accurate (smaller on the preceding side and larger on the following side). Could there be something in my configuration at work here? I am using the latest Audactiy v3.2.2, 64 bit.
The original WAV data was extracted from an MP4 file. This WAV data produces the behavior which is not sample accurate, as noted previously.
I extracted a subset of this data (for testing) and saved as 32-bit float WAV (current format selection) using Audacity. When I load this data into another instance of Audacity, I can produce sample accurate selections using our code. I suspect that my WAV data (when originally extracted by Audacity) was not saved in 32-bit float WAV format, which feeds my hypothesis of rounding error. Does this track? Is there a way I can confirm my suspicion that my WAV data is not 32-bit float on disk?
Thinking about the rounding error, I exported a section of my test data to work with a smaller size. After saving it in a 32-bit float WAV format, I see our code works as nearly sample accurate. (+/- 1, which is good enough for this use case)
So, I went back to my original MP4 and performed an export as 32-bit float WAV format. The scripts work as expected. I’m now able to edit my data in a fraction of the time!
Thanks Steve for the guidance. It’s always difficult to find the root cause, eh?