Wish List: Find Maximum

It was suggested by a poster in another thread of mine, that I post my request here. The original thread is at: https://forum.audacityteam.org/t/find-maximum-and-other-suggestions/18837/5

I have pasted the important parts below:

A Find Maximum would be very useful. Here’s why, and below is a suggestion how it could operate. Often I want to manually decrease the dynamic range by reducing some of the peaks, so that the overall volume increases after I normalise. I’d rather not use automatic functions because I assume they would affect the entire sound file and I’d like to keep the sound as close to original as possible. In one situation, a friend asked me to improve a sound recording made in Cairo during WW2. Street vendors offered passing soldiers the opportunity to step into a sound booth, record 30 seconds of greetings to family, and then they were given a flexible record which could be mailed home. The one I was given was full of crackles, so I worked my way through several hundred pops, manually reducing the peak between the zero-crossing. Seemed to work pretty well, though very time consuming.

A more recent example was a recording of someone with Alzheimers who got distracted by the microphone in front of him and would start stroking and tapping it, introducing very loud, clipped noises. I have manually reduced the levels of some of the clipped peaks so that the dynamic range is reduced, thus allowing an overall higher volume (after normalising). But again, it was very time consuming.

This is how I suggest a Find Maximum would work:

  1. The user selects Find Maximum. Dialog Box 1 appears, asking for how many peaks to find, the amount of volume reduction required (dB), and whether the process is to be manual or automatic. For example, after the user enters the details, the dialog box might look like this:

Number of peaks: 20
Volume reduction (dB): 6
Manual/Auto: M

  1. Audacity then scans the sound file for the highest 20 peaks, stores them in an array for quick access, takes the user (if “manual” was chosen) to the highest peak at the highest zoom, and highlights the waveform that will be reduced.

  2. Dialog Box 2 appears, asking the user for confirmation to reduce the waveform.

  3. After reducing the waveform, the user is automatically taken to the next highest peak.

An additional feature that may come in useful, particularly is there are a lot of peaks close to each other, is the ability of the user to set the “width” of the waveform to be reduced. The width of the reduction is measured in zero-crossings. If the user only wants one half-cycle waveform reduced (imagine a positive-going peak), they choose 2 as the width. Audacity looks for the closest zero-crossings on both sides of the peak and the sound between those crossings will be reduced. If the user selects 4 zero-crossings, they are asking for the positive peak to be reduced as well as the two negative half-cycles on either side. This feature could be added to Dialog Box 2, so that after the user is taken to a peak to be reduced, if they see that there are several that need reduction, they can enter the width in zero-crossings, the extra waveform is highlighted, and the user can give the go ahead.

If someone is able to write such a function, I am more than willing to help with testing, further suggestions, and documentation.

I’m sorry to tell but I think here is a general misunderstanding what Nyquist in Audacity can do and what not. Nyquist has no access to the Audacity GUI, so there is no way to pop up a “Dialog Box 2” or to highlight parts of the waveform with Nyquist in Audacity.

If you choose a Nyquist Plugin, then Audacity pops up a “Dialog Box 1” and all the values of the sliders and gadgets are given together with the sound (the Audacity selection) as variable values to the Nyquist interpreter, which returns either:

  • A sound, which is re-inserted into the Audacity selecion.
  • A string, which is displayed in a read-only text pop-up window (for error messages or similar things)
  • A list of labels, which produces a new “labels track” in Audacity below the selected audio track.

There is no way to interact with Nyquist after the “analysis” part of the plugin via the Audacity GUI.

The only possible way with Nyquist in Audacity would be to break the plugin into several plugins, where another problem is that functions like “Find Maximum” as well as “Find Zero-Crossings” with Nyquist in Audacity have severe memory problems. Audacity forces Nyquist to compute all samples and the resulting analysis data in the computer’s memory, what has to the consequence that Audacity crashes if the amount of data is bigger than the free memory available in the computer. This Audacity bug is known since approx. ten years but unfortunately still not fixed yet.

As Edgar has said, there are a number of issues that limit what can be done with Nyquist. However, the reason that I suggested that you posted here is because one of the key points in your wish list could probably be accomplished fairly easily, and that is for a plug-in for detecting peaks.

What I have in mind is something along the same lines as the “Silence Finder” and “Sound Finder” plug-ins (in the “Analyze” menu in Audacity 1.3.13).
To broaden the usefulness of a “peak finder” plug-in I think it would probably better for it to mark all peaks that exceed a given threshold, rather than marking a given number of peaks. If the plug-in outputted the peak value into the label text then by exporting the label track it would be easy to use a spreadsheet program to access a variety of data from the raw data of the label text file. I’ll probably have some time over the weekend to have a look at this further. (that’s not intended to exclude anyone else from investigating this plug-in proposal).

I’d go with Steve approach on this one. Label with the peak value sound like a good idea.

Edgar-rft posted a Peak Finder plug-in which is available on the Audacity wiki:
(late post because I’ve just updated it to fix a minor bug)

I have also updated one of my old Peak Finder plug-ins and posted it here: https://forum.audacityteam.org/t/peak-finder/34443/1

Thanks for the Find Max plug-in. I’ll test it out. Because Audacity was lacking a Find Max and a Match Volume, I do most of my audio work in Audition now. But Audacity is so easy to use I still jump into it regularly.