[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: A sox Question about the silence Module



On Thu, 21 Dec 2017, Martin McCormick wrote:

	I am not new to sox but I am asking to see if I have
missed something because a sox script I am using is mostly
working but not quite.

	I am attempting to remove long silent pauses in a
recording of people talking and what is supposed to happen is
that sound is recorded during voice or noises and the recording
should continue for a short period of time after the noise so as
to smooth out what one hears and make the conversation sound
more normal.  I test the script with a recording of 3 beeps with
dead silence in between of periods ranging from 4 or 5 seconds up
to a minute.  The silence parameters are such that one should
hear 3 beeps, each a half-second apart in the processed output.

	For those familiar with an electronic voice operated
relay or VOX, the delay is set to 1/2 second and there is where
the trouble is.

	To get this effect, one sets a line of sox script as follows:

#! /bin/sh
sox -t .wav input.wav -t .wav output.wav silence -l 1 0 '-39d' -1 0.5 '-45d'

The field containing 0.5 which is the second-to-the-last  field
is the only thing that does not work.  The script records while
there is sound but the 0.5 seconds of blank recording after the
sound doesn't happen.

Below is an excerpt from the online manual at
http://sox.sourceforge.net/sox.html

[synopsis of _silence_ effect...]

| silence [−l] above-periods [duration threshold[d|%] [below-periods duration threshold[d|%]]

[discussion of its terms...]

| The option −l indicates that _below-periods_ _duration_ length of
| audio should be left intact at the beginning of each period of
| silence. For example, if you want to remove long pauses between
| words but do not want to remove the pauses completely.

| _duration_ is a time specification with the peculiarity that a bare
| number is interpreted as a sample count, not as a number of
| seconds. For specifying seconds, either use the t suffix (as in
| ‘2t’) or specify minutes, too (as in ‘0:02’).

Note that the second paragraph in the above excerpt indicates that the
argument "0.5" in the sox command in your script is not being
interpreted the way you want.

Instead, you ought to replace "0.5" with something like "0.5t" or
"0:00.5".

Good luck with your project.

--
@gwern 16 Oct 2017 | "Darth Mozilla, the data was to be left under my
		   | supervision!" "I am altering the deal. Pray I
		   | don't alter it any further."

%% https://mobile.twitter.com/gwern/status/919926184200364032

Reply to: