Spectral Preview

Greetings all,

I did a search for what I am about to request, and though I could not find it, it may already be posted and if it is I apologize in advance.

As a voice artist I spend a good deal of time removing clicks and mouth noises from my recordings that have snuck past the RX9 mouth-noise filter (and despite my efforts to stop such occurrences in the recording process). What I think would be of tremendous help is have a function that could be assigned to a hot-key that would give an audio preview of just what is selected in spectral view.

So often I have an idea of where the click or sound I wish to remove is located, but it takes a lot of making edits, playing the area containing the edit, undoing the edit, making another edit, playing the area around the edit (again), and so on and so forth.

It would be so nice to just hear what I have selected isolated from the unselected frequencies so I could tell if I’ve ‘hit it’ or not.

Anyway, that is my request.

Cheers all,
-Mr. M.

There are plugins which allow you to only hear part of the audio spectrum,
e.g. TDR nova you can drag a solo’d band across the spectrum, while the audio is looping on the problem area.
Now the bad news, for some reason TDR Nova’s band-solo feature does not work in Audacity 3.1.x :frowning:

[ Band-solo feature does work in the VST3-compatible version of Audacity, but that’s 3.2.0-alpha-20220829 ]

Try this code in the Nyquist Prompt effect.

(let ((highhz (get '*selection* 'high-hz))
      (lowhz (get '*selection* 'low-hz)))
  (setf sound (highpass8 (lowpass8 *track* highhz) lowhz))
  (play sound))

If that’s close to what you want, you could turn the code into a Nyquist plug-in and assign a shortcut to run it.

In Audacity 3.1.3 (on Windows 8) that code is not working at all: silent failure …
Audacity 3.2.0-alpha-20220829 it’s working, but gives an error message …

That’s not an “error” message, it’s just a “message”.
It’s actually the peak level found by the PLAY command. The message can easily be suppressed or modified according to need, for example, this will return the word “Done”:

(play <my-sound>)

and this will return an empty string (which is ignored by Audacity):

(play <my-sound>)

and this returns a more meaningful message:

(format nil "Peak level = ~a" (play *track*))

This may be due to your sound settings (either in Windows or in Audacity).
Nyquist’s “PLAY” command does not use Audacity’s audio device settings, it uses it’s own device settings. By default, this should be the default PortAudio device. If the default device is not available to Nyquist, then playback will fail.

Try setting Audacity to use “MME → Sound Mapper” for playback.


I’ve not tested on Windows, but I think it “should” be possible to override the PortAudio default by looking in “Help > Diagnostics > Audio Device Info” to find the “Device ID” number of the device that you want to use, then pass that number to Nyquist before calling “PLAY”.
For example, to use Device ID: 4

(setf *snd-device* 4)
(let ((highhz (get '*selection* 'high-hz))
      (lowhz (get '*selection* 'low-hz)))
  (setf sound (highpass8 (lowpass8 *track* highhz) lowhz))
  (play sound))

Also note that setting snd-device to an unsupported value may cause Audacity to crash. I’m not going to log this as a bug, as manually overriding the default playback device isn’t “officially” supported in Audacity as far as I’m aware, so this is all “hack at your own risk”.

I’ve just tried that, and all other permutations of Audio-Host & PlayBack device on 3.1.3, (64-bit).
All silent failures: no sound, no message.
Yet on “audacity-win-3.2.0-alpha-1” your code works: the bandpass sound is played, and a message is shown afterwards.

In my case 3.1.3. & 3.2.0-alpha-1 both running on the same machine, and same OS, Windows 8.

Strange. Maybe there’s a bug in 3.1.3 on Windows. It works for me on Linux with 3.1.3.