Shawn Dowler | 1 Mar 2006 08:01
Picon
Gravatar

Truncating silence in the middle of a file

I've been playing around with the silence effect.  I would like to
find a way to have an input file with sporatic periods of silence
between 2 and 5 minutes long and output to a file that truncates each
of these pauses to ~2 seconds in length.

Again: I want to replace all pauses longer than 2 seconds with pauses
that are only 2 seconds long.

Any help with this would be greatly appreciated.  I have searched and
searched and could not find any examples that got me anywhere close to
what I'm describing here.

Thanks for any help you might be able to lend,
Shawn Dowler

--
http://walkingtowel.org

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
Shawn Dowler | 1 Mar 2006 09:55
Picon
Gravatar

Re: Truncating silence in the middle of a file

I know it's bad form to reply to one's own question, but I may have
solved it myself.  Firstly, it appears that the functionality that I
was looking for either did not exist by design, or was somehow
implemented wrong in version 12.17.8.  When I compiled version 12.17.9
and tested some of what I thought should have worked based on the man
page it did AMAZING things!  Here is the command I used:

sox ./test_hard.wav ./test_silence2.wav silence 1 -0.9 2% -2 -0.9 2%

As far as I can tell, this does exactly what I want.  I generated
silence at the beginning and end of the test file I had, and I put
some silence in the middle, too.  Then I ran this command, and no long
pauses.  It's GREAT!  As far as I can tell I can have this parse any
file with any arbitrary number of pauses and the results are that all
pauses are eliminated.

I have to do some more tests with this, but I am very impressed.

Shawn Dowler

On 2/28/06, Shawn Dowler <shawn.dowler <at> gmail.com> wrote:
> I've been playing around with the silence effect.  I would like to
> find a way to have an input file with sporatic periods of silence
> between 2 and 5 minutes long and output to a file that truncates each
> of these pauses to ~2 seconds in length.
>
> Again: I want to replace all pauses longer than 2 seconds with pauses
> that are only 2 seconds long.
>
> Any help with this would be greatly appreciated.  I have searched and
(Continue reading)

Chris Bagwell | 3 Mar 2006 03:47

Re: Re: Truncating silence in the middle of a file

Nice to hear a positve comment on the silence effect for change!  It 
gets a bad wrap on the mailing list usually.

Thanks,
Chris

Shawn Dowler wrote:

>sox ./test_hard.wav ./test_silence2.wav silence 1 -0.9 2% -2 -0.9 2%
>
>As far as I can tell, this does exactly what I want.  I generated
>silence at the beginning and end of the test file I had, and I put
>some silence in the middle, too.  Then I ran this command, and no long
>pauses.  It's GREAT!  As far as I can tell I can have this parse any
>file with any arbitrary number of pauses and the results are that all
>pauses are eliminated.
>
>  
>
>  
>

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
Chris Bagwell | 3 Mar 2006 04:18

Re: Re: limiter feature?

confucion wrote:

>confucion <confucion <at> gmail.com> writes:
>
>  
>
>>How hard is it to implement a hard limiter? Will this feature be considered?
>>
>>ex: soxmix file1.wav file2.wav -l 0.2 mixdown.wav
>>
>>The sum of the individual files' volume will be brickwalled to -0.2dB so then
>>clipping will never occur.
>>
>>    
>>
>
>Sorry, I think I misused the term clipping. What I mean is digital distortion
>when the sum of volumes is over 0.0dB
>
>I think this feature would be very useful when using soxmix, too many times
>digital distortion occurs during my mixdowns. With this feature, you solve
>having to lower the volume with the -v switch and maintain the original volume
>of both input files. 
>
>Hope to see this feature implemented!
>  
>
I'm not really sure how best to do full volume mixing.  It would be easy 
enough to implement a limiter on the mixing (there is already limiter 
logic in the "vol" effect) but I'm not sure it would be much different 
(Continue reading)

confucion | 3 Mar 2006 11:48
Picon

Re: limiter feature?

Chris Bagwell <chris <at> cnpbagwell.com> writes:

> I'm not really sure how best to do full volume mixing.  It would be easy 
> enough to implement a limiter on the mixing (there is already limiter 
> logic in the "vol" effect) but I'm not sure it would be much different 
> then what we have today.

I overlooked the vol gain effect. I tried it and the limiter works since now I
don't get digital distortion in some parts of the mixed audio. But it's limiting
effect is not the best method. In fact, the current limiter works more like a
normalizing-limiter if there is such a thing. The way I think it works now is
that soxmix scans the peak volume of both files and then adjust other volume
relative to that summed peak.

##############
ILLUSTRATIVE EXAMPLE:

(-0.2) = a waveform exists and its peak is limited at -0.2dB
______ = silence

(BEFORE SOXMIX PROCESSING)
________________A________B________C________D________E__
File1.wav: ___(-0.2)___(-0.2)___(-0.2)___(-0.2)___(-0.2)
File2.wav: ____________(-0.2)___(-0.2)____________(-0.2)

RUN soxmix file1.wav file2.wav mixdown.wav vol 1 type-dB: 0.02

it looks like:
(AFTER SOXMIX PROCESSING)
__________________A________B________C________D________E__
(Continue reading)

Shawn Dowler | 6 Mar 2006 01:23
Picon
Gravatar

Re: Truncating silence in the middle of a file

All right!  I have done extensive tests on my source material
(recorded talk-radio from internet streams) and I have found settings
that make it so one cannot even tell there were any gaps, plus it
removed "dead air" when the speaker pauses excessively or is waitng
for a caller to respond, thus allowing one to fit more "content" on
one audio CD (or in a shorter period of time)

Anyway, here are those settings if anyone wants them for anything like this:

sox input.wav output.wav silence 1 0.2 0.5% -1 0.2 0.5%

Everything seems to be working as expected.  Thanks for all the direct
interaction and work on this issue.  SoX RoX!

Shawn Dolwer

On 3/5/06, Shawn Dowler <shawn.dowler <at> gmail.com> wrote:
> Thanks for responding so quickly.  I will recompile with the updated
> file.  I'm using Slackware 10.2 and the package they have is one
> release behind anyway, so I had to compile it myself... not a problem.
>  I will report my findings with other files.
>
> Shawn Dowler
>
> On 3/5/06, Chris Bagwell <chris <at> cnpbagwell.com> wrote:
> > OK, I fixed several bugs in the silence effect and I was able to remove
> > all silence from the sound file you sent.  I was able to do it with the
> > following command line:
> >
> > sox gaps.ogg test.wav silence 1 0.5 1% -1 0.5 1%
(Continue reading)

Shawn Dowler | 5 Mar 2006 06:35
Picon
Gravatar

"silence" and strange behavior in gaps

Well, the honeymoon couldn't last forever, now... could it?

I have run into a relatively serious problem.  Well, it's not a
showstopper, but it's not very good.  Using the -1 switch for the
below_period makes the silent parts disappear, but in that moment
where it hits the sound again, there is a strange skipping behavior
that I can't find a way to get rid of.  Here is a visual
representation.

First, the original would look like this, with a big silent gap:

|||||--------------------------------------------------------|||||

What I would expect is something like the following to be the result
of using silence to remove silence from the middle of files:

|||||-|||||

But what I always get is:

|||||-|-|||||

The samples in the center of the silence are repeats of the end of the
preceding sample.

Another way to represent it visually - each letter represents a unique
chunk of sound, dashes represent silence:

abcde-e-fghij

(Continue reading)

Chris Bagwell | 6 Mar 2006 03:11

Re: Re: Truncating silence in the middle of a file

Hi all,

There were some pretty big bugs in the "restart" feature of the silence 
effect (when you use a negative value for the periods).  I've just now 
commited those fixes to CVS and so all can grab it that needs it.

Also, the effect uses some RMS values on audio data to try and debounce 
single sample periods of silence.  Previously, it was using a window 
size of 1/10 a second which was quite noticable on playback; especially 
when using the "restart" feature.  Thats because you'll generally have 
an RMS window size amount of silence left at the end of your file if it 
doesn't fade out and let the RMS decay on its own.  I changed the RMS 
window to 1/50 which is pretty hard to hear that amount of silence.

Chris

Shawn Dowler wrote:

>All right!  I have done extensive tests on my source material
>(recorded talk-radio from internet streams) and I have found settings
>that make it so one cannot even tell there were any gaps, plus it
>removed "dead air" when the speaker pauses excessively or is waitng
>for a caller to respond, thus allowing one to fit more "content" on
>one audio CD (or in a shorter period of time)
>
>Anyway, here are those settings if anyone wants them for anything like this:
>
>sox input.wav output.wav silence 1 0.2 0.5% -1 0.2 0.5%
>
>Everything seems to be working as expected.  Thanks for all the direct
(Continue reading)

Mal | 6 Mar 2006 03:48

Windows build of latest .EXE

Hi all,

Would any of you have a Windows build of the latest .EXE ( which 
includes the fix for the SOX noisered limiting assert bug ).

Also, the list of supported OS's doesn't seem to include OS/X, which I 
though was a bit odd as most sound studios I know seem to still be Mac 
based.  Is there an OS/X build available?

Many thanks in advance!
Mal

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
Luis Cordova | 13 Mar 2006 16:30
Picon
Gravatar

change bitrate with SOX, how to do it?

Hi,
 
how can you change the bitrate of an mp3/other compressed format using SOX?
 
I think it all depends on the collateral library used for mp3 or other format but I just wanted to make sure if there WAS a way to indicate this through SOX.
 
If SOX cannot do this unless it works together with other library through command line pipes, then I guess SOX could be taken out of the equation?
 
Many thanks,
 
Luis
--
-------------------------------------------------------

Gmane