Mac: Problem Using Nyquist Prompt

Hi all,

A short while ago, I created this forum topic asking for accessible suggestions on how to create amplitude-modulated sine tones (see link for details). @Trebor told me to generate silence, select it and use the Nyquist Prompt feature to generate the tone, providing the following sample code which works on Windows:

(sim (mult 0.3 (osc-tri 18.5) (osc-tri 18.5) (hzosc 3700)))

However, on pasting this into the Nyquist Prompt box in Audacity I get the following error message:

Nyquist Prompt: Error in Nyquist code
Your code looks like SAL syntax, but there is no ‘return’ statement.
For SAL, use a return statement such as:
return track * 0.1
or for LISP, begin with an open parenthesis such as:
(mult track 0.1).

Since this seems to work for Trebor on Windows, I’m wondering if there is anything specific to Mac which makes this not work as expected. Are there any solutions or workarounds? My coding knowledge is nonexistent, so unfortunately I’m not sure I can figure this one out myself. For context, I’m running Audacity 3.4.2 on MacOS Sonoma 14.3.1, and I use the VoiceOver screen reader.

Thanks in advance,

Still working in Audacity 2 & 3 on Windows 8.

Here’s another Mac user reporting the same error message with Nyquist code

but no solution in that thread. :frowning_face:

@steve @kozikowski

(sim (mult 0.3 (osc-tri 18.5) (osc-tri 18.5) (hzosc 3700)))

Ensure that there are no spaces before the first “(”.

@Steve Thanks. Unless they are being automatically generated when I paste in the code, there shouldn’t be any. However there’s a quirk in which VoiceOver will not read out the contents of this and many other Audacity text boxes. This is new in Audacity version 3.4 I think, but I am still able to type and paste into boxes.

Copying code from a website and pasting into the Nyquist prompt can sometimes add leading spaces. (This is not a bug in Audacity, it is a problem with some web page / browser interactions.)

I copied the code into a .txt file (which opens in the TextEdit app on Mac) and paste it from there.

Can you try typing directly into the Nyquist Prompt? (ensure that the code entry box is completely empty before typing)
Try something really simple first, such as:
(print 42)

@Steve So I did try typing, but as soon as I hit the space bar it thinks I’m done inputting and I get an error message. I don’t think this is just a trick of how the VoiceOver screen reader handles buttons, as I believe this also happened when I turned VO off. But I can investigate again.

The same error message? (“…Your code looks like SAL syntax, …”)

So here’s what happens when I type with VoiceOver on and off:

When starting to type @trebor’s code, as soon as I type the space after "(sim ", I get the same error message as above, regardless of whether VoiceOver is on or off.

When typing “(print 42)”, sometimes it acts as if I’ve clicked the “load” button to load a Nyquist script, and sometimes it gives me the same error. I only got it to want to load a script when VoiceOver was on.

When typing into the Nyquist Prompt’s code window, nothing should happen other than the typed characters going into the code window. Nyquist (the programming language) is not launched until the “Apply” or “Debug” buttons are pressed / activated.

Do you see similar problems (plugins running before activating “Apply”) in any other effects?
Have you previously run any older versions of Audacity, and if so, did you experience the same or similar problem?

I seem to be getting mixed behavior in other effects. For example, when typing in boxes within the normalize or amplify dialogs, when I hit the space bar it checks and unchecks the ‘allow clipping’ box. But I think the reason for this is because the decibels or peak amplitude field doesn’t expect a space. Otherwise I don’t really use enough plugins to know what a good test subject would be. I have also not tried to run Nyquist Prompt in previous versions. I can tell you that VoiceOver does not read out my typing in the export or save as dialogs, but the typing works and my files do save with the expected names, spaces included.

EDIT: It sounds to me like there are two issues here. One is that it doesn’t seem to like my code, but the other is that when I press the space bar in Nyquist Prompt it thinks I’m clicking the OK or Debug buttons. Is there any way to solve this?

EDIT 2: I tried messing around with keyboard command assignments on Mac without results, but I may be getting closer to a solution on my own by focusing on the textbox using the tab key without VoiceOver enabled…

EDIT 3: It now seems to work! Thanks @trebor and @steve for bearing with me. The problem appears to have been that VoiceOver was not focusing properly on the code box, but rather on one of the buttons. This meant that characters other than space were being typed into the text box, but because the space activates the selected item it tried to apply an incomplete code. I’ve noticed a similar behavior in other areas of MacOS, but I didn’t realize it was happening here.

Thanks again for all your help!

That would explain the weird behaviour. Pleased to hear that you have resolved the issue.
Is there any advice you could give to other macOS users to get VoiceOver working correctly with Audacity?

VoiceOver support is famously spotty, and there are some controls for which I haven’t had an accessible workaround. However, ensuring that you have focused on an edit box with the Tab key, rather than Ctrl-Option-Down Arrow, may help with some uncooperative edit boxes.

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