Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: A tool to check for silent beginnings and endings? (Read 1939 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

A tool to check for silent beginnings and endings?

Is there a tool that I can easily run in batch over many tracks at once that can check whether tracks start and end with digital silence or not, and just what the levels are if not?
Would be great to have as a foobar2000 component, but I'll take anything that can do this on many tracks at once.

Re: A tool to check for silent beginnings and endings?

Reply #1
I don't know, but Audacity has some macro features and stuff that might let you do something like that, so that's what I would look at.


Re: A tool to check for silent beginnings and endings?

Reply #3
mpTrim can trim off leading/trailing silence:
https://www.mptrim.com/

The paid version can do so in batch mode.

 

Re: A tool to check for silent beginnings and endings?

Reply #4
Thanks for the suggestions so far.

@Apesbrain I don't want to trim, I just want to verify, and it's going to be on lossless/flac files anyway.

@Brand I don't know... it takes a lot of time and RAM to open a whole album in audacity, and then, after running whatever macro I come up with, I'll have to browse manually to see what it's found, and all that I can think of with that would be the "find silence" function, which has a minimum of 100ms I think, and the results are displayed as label tracks. It would be less cumbersome to do as I do now, loading a single track with a spectrogram with a 60dB gain so that digital silence is visibly evident. But that's exactly the kind of visual checking that I want to avoid. I would like something that just scanned the starts and ends of track and said whether they start and end with digital silence or not (even if it's a very small, less than 100ms, chunk) or not, and, additionally, if there's a "silent enough" and/or "just background noise"  start and end.

@smok3 I guess that could work... if I knew enough scripting to make it, which I don't. In any case, I'm not scanning image files to find inter-track silences, like in the example you link, but scanning individual track files' beginnings and endings only. I don't care if there's silence in the middle or whatever. Would you say that should be achievable with SoX or FFMPEG and some scripting?

Re: A tool to check for silent beginnings and endings?

Reply #5
Sox
I'am looking at my own script from 2004 (and since I'd have to reread sox docs to understand it, I'am hesitant to post it), I think this might be helpful
https://digitalcardboard.com/blog/2009/08/25/the-sox-of-silence/comment-page-2/

Especially the
Code: [Select]
sox in.wav temp.wav silence 1 0.1 1% reverse
sox temp.wav out.wav silence 1 0.1 1% reverse
part looks familiar (again read the sox docs to understand whats up).

edit: Actually that will cut out 'silence', so I'am guessing not exactly what you are looking for.

Ffmpeg
This looks like a promising start (bash syntax)
Code: [Select]
 # get duration in seconds
ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "$file"
171.964082
# silence detect in seconds
ffmpeg -i "$file" -af silencedetect=n=-50dB:d=0.01 -f null 2>&1 - | grep silencedetect
[silencedetect @ 0x7fffee38f440] silence_start: 0
[silencedetect @ 0x7fffee38f440] silence_end: 0.414762 | silence_duration: 0.414762
[silencedetect @ 0x7fffee38f440] silence_start: 166.15
[silencedetect @ 0x7fffee38f440] silence_end: 166.162 | silence_duration: 0.0110884
[silencedetect @ 0x7fffee38f440] silence_start: 166.3
[silencedetect @ 0x7fffee38f440] silence_end: 166.321 | silence_duration: 0.0218367
[silencedetect @ 0x7fffee38f440] silence_start: 166.33
[silencedetect @ 0x7fffee38f440] silence_end: 166.356 | silence_duration: 0.0256463
[silencedetect @ 0x7fffee38f440] silence_start: 166.367
[silencedetect @ 0x7fffee38f440] silence_end: 166.38 | silence_duration: 0.0130612
[silencedetect @ 0x7fffee38f440] silence_start: 166.395
[silencedetect @ 0x7fffee38f440] silence_end: 166.414 | silence_duration: 0.0188209
[silencedetect @ 0x7fffee38f440] silence_start: 166.425
[silencedetect @ 0x7fffee38f440] silence_end: 166.438 | silence_duration: 0.0131293
[silencedetect @ 0x7fffee38f440] silence_start: 166.438
[silencedetect @ 0x7fffee38f440] silence_end: 166.459 | silence_duration: 0.0207256
[silencedetect @ 0x7fffee38f440] silence_start: 166.461
[silencedetect @ 0x7fffee38f440] silence_end: 166.533 | silence_duration: 0.071542
[silencedetect @ 0x7fffee38f440] silence_start: 166.533
[silencedetect @ 0x7fffee38f440] silence_end: 166.57 | silence_duration: 0.0369841
[silencedetect @ 0x7fffee38f440] silence_start: 166.57
[silencedetect @ 0x7fffee38f440] silence_end: 166.593 | silence_duration: 0.0226984
[silencedetect @ 0x7fffee38f440] silence_start: 166.593
[silencedetect @ 0x7fffee38f440] silence_end: 166.615 | silence_duration: 0.0218367
[silencedetect @ 0x7fffee38f440] silence_start: 166.615
[silencedetect @ 0x7fffee38f440] silence_end: 171.913 | silence_duration: 5.29803
There is -to position and -sseof position which could be used to limit the amount of file to be scanned.
http://ffmpeg.org/ffmpeg.html#Main-options

An attempt at script

Usage example:
Code: [Select]
detectsilence *.m4a

may return
Code: [Select]
---
Jennifer Lopez - Jenny from the Block (Official Music Video)-dly6p4Fu5TE.m4a
no silence at start

no silence at the end
---
Jimmy Eat World - The Middle (Official Music Video)-oKsxPW6i3pM.m4a
no silence at start

[silencedetect @ 0x7fffcaeec7c0] silence_start: 4.02608
[silencedetect @ 0x7fffcaeec7c0] silence_end: 4.99921 | silence_duration: 0.973129
---
J-Kwon - Tipsy (Video)-VwXeN2FsE7w.m4a
[silencedetect @ 0x7fffd0f6c180] silence_start: 0
[silencedetect @ 0x7fffd0f6c180] silence_end: 1.2537 | silence_duration: 1.2537

no silence at the end
---
John Mayer - Your Body Is A Wonderland (Official Music Video)-N5EnGwXV_Pg.m4a
no silence at start

no silence at the end
---
JoJo - Leave (Get Out) Official Music Video [2004]-ggWyUEuGcWY.m4a
no silence at start

no silence at the end
PANIC: CPU 1: Cache Error (unrecoverable - dcache data) Eframe = 0x90000000208cf3b8
NOTICE - cpu 0 didn't dump TLB, may be hung