Improving Sound Finder

Share your Audacity/Nyquist plug-ins here, or test drive the latest plug-ins submitted by Audacity users.

After testing a plug-in from this forum, please post feedback for the plug-in author.
steve
Site Admin
Posts: 81227
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Improving Sound Finder

Post by steve » Mon Apr 13, 2020 3:22 pm

In Audacity 2.4.0 (due to be released next month), the "Silence Finder" has been updated, but functionally remains almost unchanged from previous versions. The only differences are:
  • Bug fix: The level for stereo tracks is now measured correctly
  • The "Treat audio below this level as silence (dB)" control now has a range of -100 dB to 0 dB (default -30dB) whereas the old version had a range of 0 to 100 (default 26) with units of "-dB" :shock:
  • The "Debug" button has been removed (this is a release version).
  • Square brackets in the GUI have been replaced by parentheses (consistent with other effects).
Although it would have been possible to merge the "Silence Finder" and "Sound Finder" into one effect, I resisted doing that for reasons that Gale Andrews frequently cited:
  • "Silence Finder" is a relatively simple effect, suitable for use by even the most novice users.
  • There's a lot of old documentation that refers to using Silence Finder.
Given that the "simple" Silence Finder has been retained, I think it would be good to add a bit more functionality to "Sound Finder" as a more "advanced" option. It is too late to change Sound Finder in Audacity 2.4.0, but this delay provides an opportunity to fully test, and tweak if necessary, an updated effect for a future Audacity release. To this end, I propose....

Label Sounds...

The name, as recommended by Apple's 'Human Interface Guidelines', uses the action verb "label", and is descriptive of what the effect does - it labels sounds.

The interface:

label-sounds.png
label-sounds.png (51.76 KiB) Viewed 1300 times

Controls:
  • Threshold level (dB): [-100 to 0 dB] (default -30)
    When audio is below this level, it is considered to be 'silence'.
  • Threshold measurement: ["Peak level" | "Average level" | "RMS level"] (default "Peak level")
    • Peak level: The threshold level is measured as the peak level
    • Average level: The threshold is measured as the absolute average level for each 100 ms. This setting may help
      avoid labelling clicks in vinyl recording. Note that the average level will usually be lower than the peak level.
    • RMS level: The threshold is measured as RMS level. Like the 'Average level' measurement, this is less likely to
      label clicks. RMS level may be measured with the 'Measure RMS' or 'Contrast' effects.
  • Minimum silence duration: [0.01 seconds to 1 hour] (default 1 second)
    When 'silence' of this duration (or longer)
    is found, preceding sound and following sound are considered to be separate sounds, provided that the previous
    sound is at least the 'Minimum sound duration'.
  • Minimum sound duration: [0.01 seconds to 10 hours] (default 1 second)
    If a sound less than this length is interrupted
    by silence, the silence will be ignored. This means that labels will be at intervals of this length or more, other than
    the final label (which may be shorter).
  • Label type: [Point labels | Region labels] (default: Region labels)
    Sounds are labelled either with a point label before the sound, or a region label around the sound.
  • Maximum leading silence: [0 seconds or more] (default: 1 second)
    A point label, or the start of a region label will be placed before the start of a sound by this amount, if there is room to do so. Labels will not be placed before time=0, and will not overlap previous sounds.
  • Maximum trailing silence: [0 seconds or more] (default 1 second)
    This setting is used by region labels only. The end of a region label will be placed this distance after the end of a sound, provided that there is room to do so before the next sound.
  • Maximum number of labels: [0 to 10000] (default 99)
    The maximum number of labels that will be produced. Note that the maximum number of tracks for a normal audio CD is 99.
  • Label text: [text] (default "Sound ##1")
    This is the text that will be entered in each label.
    • The '#' symbol is a special 'placeholder' character for adding a counter.
    • The number of successive '#' symbols determines the number of digits and if followed by an integer number, the starting number is defined.
    • Example: ###3 will add a three digit counter that counts up: 003, 004, 005... for consecutive labels.
    • A counter may be placed before, after or withing the label text, but only one counter may be used in a label.
Precision:

The amplitude measurements are made at intervals of 0.01 seconds, thus the label placement may be up to 0.01 seconds before / after a sound.


Tips:
  • If the 'Threshold' is set too low then 'silences' may be above the Threshold level, causing the 'silence' to be seen as a 'sound'.
  • If the 'Threshold' is set too high, the beginning or end of sounds may be missed.
  • If 'Minimum silence duration' is too short, there may be more labels than intended due to short gaps being seen as 'silence'.
  • If 'Minimum silence duration' is too long, gaps between songs may not be seen.
  • For vinyl recordings, 'Average' or 'RMS' measurement is recommended so as to reduce the chance of crackles registering as 'sounds'.
The plug-in:

Latest version:
label-sounds.ny
new version - updated for Audacity 2.4.2 and later
(10.88 KiB) Downloaded 64 times

old version:
label-sounds.ny
old version
(10.86 KiB) Downloaded 35 times

Installation Instructions:

This is a "Nyquist plug-in" and may be installed in the usual way: https://manual.audacityteam.org/man/cus ... l#plug-ins
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: Improving Sound Finder

Post by Edgar » Tue Apr 14, 2020 2:52 pm

steve wrote:
Mon Apr 13, 2020 3:22 pm
Note that the peak level will usually be lower than the peak level.

Precission:

If the 'Threshold' is set too low, then 'silences' may be above the Threshold level, causing the 'silence' to be seen as a 'sound'.
Assuming that what you have posted will eventually become the "documentation"…
"peak level will usually be lower than the peak level" makes no sense to me.
I think that you misspelled "Precision".
Throughout there are superfluous commas (according to Connie):
"If the 'Threshold' is set too low, then 'silences' may be above the Threshold level, causing the 'silence' to be seen as a 'sound'."
If the 'Threshold' is set too low 'silences' may be above the Threshold level causing the 'silence' to be seen as a 'sound'.
Note also that Connie says that the "American" standard would probably suggest:
"then 'silences' may"
then "silences" may
Sorry, though I like the GUI, I have not yet tried the effect <grin>.
-Edgar
running Audacity personally customized 2.0.6 daily in a professional audio studio
occasionally using current Audacity alpha for testing and support situations
64-bit Windows Pro 10

steve
Site Admin
Posts: 81227
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Improving Sound Finder

Post by steve » Tue Apr 14, 2020 4:41 pm

Thanks for the comments Edgar. I've made some corrections to the text. Of course official documentation will be proof read before the manual is released - clearly something I didn't bother doing in a forum post ;)
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

tlm
Posts: 91
Joined: Thu Nov 22, 2012 4:32 am
Operating System: macOS 10.15 Catalina or later

Re: Improving Sound Finder

Post by tlm » Thu Nov 26, 2020 12:15 pm

I have used the Label Sounds plug-in (new version) many times and really like it.

The only thing I don't like is that it lacks a "Maximum sound duration" setting. For that reason, I keep finding sounds that are longer than I want. For example, if I could set the maximum sound duration at 10s, the 13s sound labeled "017" in the example below could be avoided.
Screen Shot 2020-11-26 at 1.09.16 PM.jpg
Screen Shot 2020-11-26 at 1.09.16 PM.jpg (87.23 KiB) Viewed 863 times
I've tried playing around with all the other settings (adjusting threshold, minimum sound duration have been the most useful) with different files and keep running into the same problem. Is there a way around this I'm not seeing? I've also tried using Sound Finder, but of course it has even fewer settings.

Thanks

steve
Site Admin
Posts: 81227
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Improving Sound Finder

Post by steve » Thu Nov 26, 2020 1:23 pm

tlm wrote:
Thu Nov 26, 2020 12:15 pm
if I could set the maximum sound duration at 10s, the 13s sound labeled "017" in the example below could be avoided.
Why did it not detect a "silence" between 1:42 and 1:43? Was it because the silence was too short, or not silent enough?

The problem with having a "maximum sound duration" is: "What should happen if there is no silence within the specified maximum?"
For example, if "Maximum sound duration" is 10 seconds, and there is 11 seconds of continuous sound, what should happen? I don't see how a plug-in can predict what a user might want in this case, so my current thinking is that it's better to leave it to the user to decide what to do. In your example, I guess that you would delete label 017 and replace it with two labels (017a and 017b) with the split around 1:42.5.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

tlm
Posts: 91
Joined: Thu Nov 22, 2012 4:32 am
Operating System: macOS 10.15 Catalina or later

Re: Improving Sound Finder

Post by tlm » Thu Nov 26, 2020 2:02 pm

Steve thank you for your response.

I can appreciate the difficulty you mention, but I still think it can be done. Is there anyway that I could see the source code and then attempt to modify it to make my own plug-in? If it's not too difficult, hopefully I can handle it, especially if I'm just modifying code rather than coming up with it from scratch.

Thanks

steve
Site Admin
Posts: 81227
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Improving Sound Finder

Post by steve » Thu Nov 26, 2020 2:46 pm

tlm wrote:
Thu Nov 26, 2020 2:02 pm
Is there anyway that I could see the source code
Sure, the plug-in IS the source code. Just open the "label-sounds.ny" file in a text editor. The plug-in is written in "Nyquist", which is a dialect of the LISP programming language. Nyquist is an interpreted language. More info here: https://wiki.audacityteam.org/wiki/Nyqu ... _Reference

Also please note that even the "Latest version" has some bugs. They are fixed in my current version, but my current version is incomplete.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

tlm
Posts: 91
Joined: Thu Nov 22, 2012 4:32 am
Operating System: macOS 10.15 Catalina or later

Re: Improving Sound Finder

Post by tlm » Mon Dec 07, 2020 8:36 pm

Steve,

I did look at the .ny code, and my hats off to you and others who can manage it. Since the main loop is defined (it seems to me) based on just the minimum sound and minimum silence parameters, I can see why there is no easy way to introduce a maximum sound parameter, as you suggested.

So, I looked for another way, and eventually came up with a work-around. It involves collecting both long duration and short duration silence labels (labled now with thanks to your help here: viewtopic.php?f=47&t=114296&p=410550&hi ... ls#p410550), exporting them to Excel, and then running some VBA to generate the desired region labels.

Below is an application to the same problem I mentioned in my original post. In the image below, I've repeated that previous image on top, for comparison with the region labels generated using my work-around.
workaround.jpg
workaround.jpg (217.86 KiB) Viewed 828 times
Notice that the region originally labeled "017" now is broken into 3 regions, as desired. To do this my routine prioritizes the longer silence labels over the shorter ones, but choses the shorter ones to comply with both a minimum and maximum sound duration.

While a plug-in would be cleaner, this gives me a way to solve my problem.

Thanks

steve
Site Admin
Posts: 81227
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Improving Sound Finder

Post by steve » Mon Dec 07, 2020 8:55 pm

I'm pleased that you found a solution, but something I still don't understand:
steve wrote:
Thu Nov 26, 2020 1:23 pm
Why did it not detect a "silence" between 1:42 and 1:43? Was it because the silence was too short, or not silent enough?
or was it something else?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

tlm
Posts: 91
Joined: Thu Nov 22, 2012 4:32 am
Operating System: macOS 10.15 Catalina or later

Re: Improving Sound Finder

Post by tlm » Tue Dec 08, 2020 10:45 am

Steve,

I think the reason I didn't address your question originally was because I didn't really know the answer. At that point, I had tried many combinations and was frustrated about region labels always present with greater than my desired maximum sound length. But now that I've thought of it more, I realize that I was also wanting the tool to prioritize longer silences, indicated by arrows in the figure below. So that is why I eventually decided to write my own code to both (1) prioritize longer silences and (2) specify a maximum sound length.

In the attached project (corresponding to the small portion of audio shown in my original post), I did my best to reproduce what I experienced earlier (it's a zip archive of a project with just the labels and an mp3 you can drag in). The screenshot below shows 8 label tracks generated with Label Sounds using average level measurement and the parameters shown in the name for each label track. For example, -40, 0.5, 4.0 means threshold -40dB, minimum silence duration 0.5, and minimum sound duration 4.0
alice.jpg
alice.jpg (244.58 KiB) Viewed 815 times
The red circles show problems for each label track involving either (1) not prioritizing longer silences or (2) not being able to specify a maximum sound length. I didn't circle all the problems, just enough to indicate what I mean. Hope this makes sense.

Thanks,
-Tony
Attachments
Archive.zip
(1.05 MiB) Downloaded 29 times

Post Reply