|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
Faster silence trimmingHello I am using sox to trim silence from the start
and end of an hour long wav file using the following command: sox -t wav input.wav output.wav silence 1 1 0.01%
reverse silence 1 1 0.01% reverse (for some reason digital silence doesn’t trim
properly hence the 0.01%) However this takes several minutes on a long wav as
it reverses the files and I want to make this faster. I thought instead to cut
the first and last minutes of the wav, process them and then splice everything back
together. What is the best way to cut a minute of sound from the front and back
of the wav for processing, leaving the remainder to be spliced back together
when the silence has been trimmed? Obviously making sure the wav headers are correct
is important. Thanks Hash ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Sox-users mailing list Sox-users@... https://lists.sourceforge.net/lists/listinfo/sox-users |
|
|
Re: Faster silence trimmingOn Thu, Nov 20, 2008 at 11:39:39PM +0900, HASH wrote:
> Hello I am using sox to trim silence from the start and end of an hour long > wav file using the following command: > > > > sox -t wav input.wav output.wav silence 1 1 0.01% reverse silence 1 1 0.01% > reverse > > (for some reason digital silence doesn't trim properly hence the 0.01%) > > > > However this takes several minutes on a long wav as it reverses the files > and I want to make this faster. I thought instead to cut the first and last > minutes of the wav, process them and then splice everything back together. > What is the best way to cut a minute of sound from the front and back of the > wav for processing, leaving the remainder to be spliced back together when > the silence has been trimmed? Obviously making sure the wav headers are > correct is important. I think this approach as stated would be just as long because when they were spliced back together, its the same copy operation that reverse is doing. Well, maybe faster because I think reverse save to 32-bit audio samples always and your most likely working with 16-bit. But the basic idea may be possible in a very fast way with new feature of SoX 14.2.0. Something like this (untested): sox -t wav input.wav output.wav silence 1 1 0.01% trim 0 xx:xx:xx ; reverse silence 1 1 0.01% reverse Replace "xx:xx:xx" with a time value of file minus something that your sure will not include silence to be trimmed. The ";" seperates it in to 2 effects chain. The second one is only ran after the trim operation completes. So you'll only reverse the file from point xx:xx:xx to EOF and trim silence off that apart; and then un-reverse which I guessing should be pretty small and thus much faster. The downside here is you have know ahead of time your maximum length of silence for the trim parameter. Chris ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Sox-users mailing list Sox-users@... https://lists.sourceforge.net/lists/listinfo/sox-users |
|
|
Re: Faster silence trimmingOk taking it further I tried this but it requires that you know the duration
of the source (in this example 60min) and assumes that there is no silence longer than a minute. sox input.wav output%1n.wav silence 1 1 0.01% trim 0 00:01:00 : newfile : trim 0 00:58:00 : newfile : reverse silence 1 1 0.01% reverse : newfile ; sox output01.wav output02.wav output03.wav output-quicktrim.wav This seems to work in just seconds! Have to clean up after but that's no problem. However I'm a little concerned because the file size is a several KB short of the same thing done using the long process. I had a listen for glitches or data loss but didn't notice anything.. Need a wav-diff of some sort to check really... -----Original Message----- From: Chris Bagwell [mailto:chris@...] Sent: Friday, November 21, 2008 2:02 AM To: sox-users@... Subject: Re: [SoX-users] Faster silence trimming On Thu, Nov 20, 2008 at 11:39:39PM +0900, HASH wrote: > Hello I am using sox to trim silence from the start and end of an hour long > wav file using the following command: > > > > sox -t wav input.wav output.wav silence 1 1 0.01% reverse silence 1 1 0.01% > reverse > > (for some reason digital silence doesn't trim properly hence the 0.01%) > > > > However this takes several minutes on a long wav as it reverses the files > and I want to make this faster. I thought instead to cut the first and last > minutes of the wav, process them and then splice everything back together. > What is the best way to cut a minute of sound from the front and back of the > wav for processing, leaving the remainder to be spliced back together when > the silence has been trimmed? Obviously making sure the wav headers are > correct is important. I think this approach as stated would be just as long because when they were spliced back together, its the same copy operation that reverse is doing. Well, maybe faster because I think reverse save to 32-bit audio samples always and your most likely working with 16-bit. But the basic idea may be possible in a very fast way with new feature of SoX 14.2.0. Something like this (untested): sox -t wav input.wav output.wav silence 1 1 0.01% trim 0 xx:xx:xx ; reverse silence 1 1 0.01% reverse Replace "xx:xx:xx" with a time value of file minus something that your sure will not include silence to be trimmed. The ";" seperates it in to 2 effects chain. The second one is only ran after the trim operation completes. So you'll only reverse the file from point xx:xx:xx to EOF and trim silence off that apart; and then un-reverse which I guessing should be pretty small and thus much faster. The downside here is you have know ahead of time your maximum length of silence for the trim parameter. Chris ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Sox-users mailing list Sox-users@... https://lists.sourceforge.net/lists/listinfo/sox-users ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Sox-users mailing list Sox-users@... https://lists.sourceforge.net/lists/listinfo/sox-users |
|
|
Re: Faster silence trimmingUm actually I just realised that your method does just as good a job and
returns exactly the same file size. Please ignore that last mail. thanks -----Original Message----- From: HASH [mailto:stash@...] Sent: Friday, November 21, 2008 3:37 AM To: sox-users@... Subject: Re: [SoX-users] Faster silence trimming Ok taking it further I tried this but it requires that you know the duration of the source (in this example 60min) and assumes that there is no silence longer than a minute. sox input.wav output%1n.wav silence 1 1 0.01% trim 0 00:01:00 : newfile : trim 0 00:58:00 : newfile : reverse silence 1 1 0.01% reverse : newfile ; sox output01.wav output02.wav output03.wav output-quicktrim.wav This seems to work in just seconds! Have to clean up after but that's no problem. However I'm a little concerned because the file size is a several KB short of the same thing done using the long process. I had a listen for glitches or data loss but didn't notice anything.. Need a wav-diff of some sort to check really... -----Original Message----- From: Chris Bagwell [mailto:chris@...] Sent: Friday, November 21, 2008 2:02 AM To: sox-users@... Subject: Re: [SoX-users] Faster silence trimming On Thu, Nov 20, 2008 at 11:39:39PM +0900, HASH wrote: > Hello I am using sox to trim silence from the start and end of an hour long > wav file using the following command: > > > > sox -t wav input.wav output.wav silence 1 1 0.01% reverse silence 1 1 0.01% > reverse > > (for some reason digital silence doesn't trim properly hence the 0.01%) > > > > However this takes several minutes on a long wav as it reverses the files > and I want to make this faster. I thought instead to cut the first and last > minutes of the wav, process them and then splice everything back together. > What is the best way to cut a minute of sound from the front and back of the > wav for processing, leaving the remainder to be spliced back together when > the silence has been trimmed? Obviously making sure the wav headers are > correct is important. I think this approach as stated would be just as long because when they were spliced back together, its the same copy operation that reverse is doing. Well, maybe faster because I think reverse save to 32-bit audio samples always and your most likely working with 16-bit. But the basic idea may be possible in a very fast way with new feature of SoX 14.2.0. Something like this (untested): sox -t wav input.wav output.wav silence 1 1 0.01% trim 0 xx:xx:xx ; reverse silence 1 1 0.01% reverse Replace "xx:xx:xx" with a time value of file minus something that your sure will not include silence to be trimmed. The ";" seperates it in to 2 effects chain. The second one is only ran after the trim operation completes. So you'll only reverse the file from point xx:xx:xx to EOF and trim silence off that apart; and then un-reverse which I guessing should be pretty small and thus much faster. The downside here is you have know ahead of time your maximum length of silence for the trim parameter. Chris ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Sox-users mailing list Sox-users@... https://lists.sourceforge.net/lists/listinfo/sox-users ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Sox-users mailing list Sox-users@... https://lists.sourceforge.net/lists/listinfo/sox-users ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Sox-users mailing list Sox-users@... https://lists.sourceforge.net/lists/listinfo/sox-users |
|
|
Re: Faster silence trimmingOn Fri, Nov 21, 2008 at 03:39:57AM +0900, HASH wrote:
> Um actually I just realised that your method does just as good a job and > returns exactly the same file size. Please ignore that last mail. > > thanks > > -----Original Message----- > From: HASH [mailto:stash@...] > > sox input.wav output%1n.wav silence 1 1 0.01% trim 0 00:01:00 : newfile : > trim 0 00:58:00 : newfile : reverse silence 1 1 0.01% reverse : newfile ; > sox output01.wav output02.wav output03.wav output-quicktrim.wav > > This seems to work in just seconds! Have to clean up after but that's no > problem. However I'm a little concerned because the file size is a several > KB short of the same thing done using the long process. I had a listen for > glitches or data loss but didn't notice anything.. > > -----Original Message----- > From: Chris Bagwell [mailto:chris@...] > > sox -t wav input.wav output.wav silence 1 1 0.01% trim 0 xx:xx:xx ; reverse > silence 1 1 0.01% reverse > At least you provide the original premise of splitting original input multiple files was faster as well. Also, glad you noticed I mistaken put ";" instead of ":" in my example command. Wouldn't run without that in case others want to try it. Chris ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Sox-users mailing list Sox-users@... https://lists.sourceforge.net/lists/listinfo/sox-users |
| Free embeddable forum powered by Nabble | Forum Help |