Home |
Search |
Today's Posts |
#1
Posted to rec.audio.pro
|
|||
|
|||
Sox 14.3.1: How to trim specified amount of time off the end of a wav file?
Hi,
Sorry for this basic question, but is there a simple way to use the trim function in Sox to remove a specified amount of time off the *end* of a WAV file? Let's say 2 seconds, for example. Is it necessary to know exactly how far into the file you want to start trimming, or is there a way to just plug in 2 seconds as a parameter? I have read the documentation, but I found it a bit confusing. Thanks! Jonathan |
#2
Posted to rec.audio.pro
|
|||
|
|||
Sox 14.3.1: How to trim specified amount of time off the end of a wav file?
In article ,
Jonathan wrote: Hi, Sorry for this basic question, but is there a simple way to use the trim function in Sox to remove a specified amount of time off the *end* of a WAV file? Let's say 2 seconds, for example. Is it necessary to know exactly how far into the file you want to start trimming, or is there a way to just plug in 2 seconds as a parameter? I have read the documentation, but I found it a bit confusing. sox infile outfile trim 0 0:0:2 --scott -- "C'est un Nagra. C'est suisse, et tres, tres precis." |
#3
Posted to rec.audio.pro
|
|||
|
|||
Sox 14.3.1: How to trim specified amount of time off the end of awav file?
On Jun 16, 11:45*am, Jonathan wrote:
Hi, Sorry for this basic question, but is there a simple way to use the trim function in Sox to remove a specified amount of time off the *end* of a WAV file? Let's say 2 seconds, for example. Is it necessary to know exactly how far into the file you want to start trimming, or is there a way to just plug in 2 seconds as a parameter? I have read the documentation, but I found it a bit confusing. Thanks! Jonathan To clarify... I realize you can accomplish this if you use zero as the first parameter, and then specify a start time to start trimming... Just wondering if there's a way to supply only the amount of trim time, which would be a little easier for me. |
#4
Posted to rec.audio.pro
|
|||
|
|||
Sox 14.3.1: How to trim specified amount of time off the end of awav file?
On Jun 16, 11:57*am, (Scott Dorsey) wrote:
In article , Jonathan wrote: Hi, Sorry for this basic question, but is there a simple way to use the trim function in Sox to remove a specified amount of time off the *end* of a WAV file? Let's say 2 seconds, for example. Is it necessary to know exactly how far into the file you want to start trimming, or is there a way to just plug in 2 seconds as a parameter? I have read the documentation, but I found it a bit confusing. sox infile outfile trim 0 0:0:2 --scott -- "C'est un Nagra. C'est suisse, et tres, tres precis." Thanks! |
#5
Posted to rec.audio.pro
|
|||
|
|||
Sox 14.3.1: How to trim specified amount of time off the end of a wav file?
|
#6
Posted to rec.audio.pro
|
|||
|
|||
Sox 14.3.1: How to trim specified amount of time off the end of awav file?
On Tue, 21 Jun 2011 18:36:25 -0400, Nil wrote:
On 16 Jun 2011, (Scott Dorsey) wrote in rec.audio.pro: sox infile outfile trim 0 0:0:2 This doesn't appear to do what the OP wanted. Your command will trim from the start of the file to 2 seconds in. I think what the OP wants is to trim, say, 2 seconds off the tail. man soxeffect "trim start [length] Trim can trim off unwanted audio from the beginning and end of the audio. Audio is not sent to the output stream until the start location is reached. The optional length parameter tells the number of samples to output after the start sample and is used to trim off the back side of the audio. ***Using a value of 0 for the start parameter will allow trimming off the back side only.***" I have to RTFM *every* time I use sox. It's very powerful, but impossible to remember all the commands and variations thereof, and there's nearly always some trial and error before I get it to do what I want. -- Anahata --/-- http://www.treewind.co.uk +44 (0)1638 720444 |
#7
Posted to rec.audio.pro
|
|||
|
|||
Sox 14.3.1: How to trim specified amount of time off the endof a wav file?
Il 16/06/2011 17.58, Jonathan ha scritto:
To clarify... I realize you can accomplish this if you use zero as the first parameter, and then specify a start time to start trimming... Just wondering if there's a way to supply only the amount of trim time, which would be a little easier for me. maybe you can use the "reverse" command twice... |
#8
Posted to rec.audio.pro
|
|||
|
|||
Sox 14.3.1: How to trim specified amount of time off the endof a wav file?
Il 22/06/2011 12.40, alex ha scritto:
Il 16/06/2011 17.58, Jonathan ha scritto: To clarify... I realize you can accomplish this if you use zero as the first parameter, and then specify a start time to start trimming... Just wondering if there's a way to supply only the amount of trim time, which would be a little easier for me. maybe you can use the "reverse" command twice... like this: sox infile.wav outfile.wav reverse trim 30 reverse this will trim out the last 30 seconds of audio. A bit slow since the program need to reverse the file twice but works lossly. |
#9
Posted to rec.audio.pro
|
|||
|
|||
Sox 14.3.1: How to trim specified amount of time off the end of awav file?
On Thu, 16 Jun 2011 08:58:59 -0700, Jonathan wrote:
To clarify... I realize you can accomplish this if you use zero as the first parameter, and then specify a start time to start trimming... Just wondering if there's a way to supply only the amount of trim time, which would be a little easier for me. My understanding is that Scott's answer does this. Looking back though, I have to agree the manual isn't too clear... -- Anahata --/-- http://www.treewind.co.uk +44 (0)1638 720444 |
#10
Posted to rec.audio.pro
|
|||
|
|||
Sox 14.3.1: How to trim specified amount of time off the endof a wav file?
Il 22/06/2011 14.46, alex ha scritto:
like this: sox infile.wav outfile.wav reverse trim 30 reverse this will trim out the last 30 seconds of audio. A bit slow since the program need to reverse the file twice but works lossly. hehe, sorry... LOSSLESSLY... |
#11
Posted to rec.audio.pro
|
|||
|
|||
Sox 14.3.1: How to trim specified amount of time off the end of a wav file?
On 22 Jun 2011, anahata wrote in
rec.audio.pro: man soxeffect "trim start [length] Trim can trim off unwanted audio from the beginning and end of the audio. Audio is not sent to the output stream until the start location is reached. The optional length parameter tells the number of samples to output after the start sample and is used to trim off the back side of the audio. ***Using a value of 0 for the start parameter will allow trimming off the back side only.***" I have to RTFM *every* time I use sox. It's very powerful, but impossible to remember all the commands and variations thereof, and there's nearly always some trial and error before I get it to do what I want. Yes, that's what the manual says, but it's language is a little misleading. What it does is remove everything BUT the tail. At least that's what's happening for me, with version 14.3.0 for Windows. The command sox test.wav test1.wav trim 0 5 ....leaves me with only the last 5 seconds of the file, rather than removing the last 5 seconds. |
#12
Posted to rec.audio.pro
|
|||
|
|||
Sox 14.3.1: How to trim specified amount of time off the end of a wav file?
On 22 Jun 2011, alex wrote in rec.audio.pro:
like this: sox infile.wav outfile.wav reverse trim 30 reverse this will trim out the last 30 seconds of audio. A bit slow since the program need to reverse the file twice but works lossly. You're right - I find that very recommendation in the manual: "Unfortunately, you must know the length of the silence at the end of your audio file to trim off silence reliably. A work around is to use the silence effect in combination with the reverse effect. By first reversing the audio, you can use the above-periods to reliably trim all audio from what looks like the front of the file. Then reverse the file again to get back to normal." I just tried it and it seems to work perfectly. |
#13
Posted to rec.audio.pro
|
|||
|
|||
Sox 14.3.1: How to trim specified amount of time off the end of awav file?
On Jun 22, 12:31*pm, Nil wrote:
On 22 Jun 2011, anahata wrote in rec.audio.pro: man soxeffect "trim start [length] *Trim *can *trim off unwanted audio from the beginning and end of *the audio. *Audio is not sent to the *output *stream *until *the *start location is reached. *The *optional *length *parameter *tells the number of samples to *output after the start sample and is used to trim off *the *back *side *of *the audio. ****Using a value of 0 for the start *parameter will allow trimming off the back side only.***" I have to RTFM *every* time I use sox. It's very powerful, but impossible to remember all the commands and variations thereof, and there's nearly always some trial and error before I get it to do what I want. Yes, that's what the manual says, but it's language is a little misleading. What it does is remove everything BUT the tail. At least that's what's happening for me, with version 14.3.0 for Windows. The command sox test.wav test1.wav trim 0 5 ...leaves me with only the last 5 seconds of the file, rather than removing the last 5 seconds. Yeah...I discovered that |
#14
Posted to rec.audio.pro
|
|||
|
|||
Sox 14.3.1: How to trim specified amount of time off the endof a wav file?
Il 22/06/2011 18.39, Nil ha scritto:
On 22 Jun 2011, wrote in rec.audio.pro: like this: sox infile.wav outfile.wav reverse trim 30 reverse this will trim out the last 30 seconds of audio. A bit slow since the program need to reverse the file twice but works lossly. You're right - I find that very recommendation in the manual: "Unfortunately, you must know the length of the silence at the end of your audio file to trim off silence reliably. A work around is to use the silence effect in combination with the reverse effect. By first reversing the audio, you can use the above-periods to reliably trim all audio from what looks like the front of the file. Then reverse the file again to get back to normal." I just tried it and it seems to work perfectly. really? i don't readed the manual, i just searched for a "reverse" command... i don't expected this situation to be explained in the man. In scripting terms the most reliable workaround will be allowing some "algebra" in the parameters like this: "trim (end-30)"... regards alex |
#15
Posted to rec.audio.pro
|
|||
|
|||
Sox 14.3.1: How to trim specified amount of time off the end of a wav file?
On 22 Jun 2011, alex wrote in rec.audio.pro:
"Unfortunately, you must know the length of the silence at the end of your audio file to trim off silence reliably. A work around is to use the silence effect in combination with the reverse effect. By first reversing the audio, you can use the above-periods to reliably trim all audio from what looks like the front of the file. Then reverse the file again to get back to normal." I just tried it and it seems to work perfectly. really? i don't readed the manual, i just searched for a "reverse" command... i don't expected this situation to be explained in the man. In scripting terms the most reliable workaround will be allowing some "algebra" in the parameters like this: "trim (end-30)"... Yes, it's in there, although the description is for a slightly different scenario. It describes using the "silence" command, which supposedly will delete all silence at the end of the track (which may be what the OP wants, anyway.) "Reverse" works with the "trim" command, too - I tried it. The command line: sox test.wav test1.wav reverse trim 10 reverse ....removes exactly the last 10 seconds of the file. I was worried that the "reverse" command might do something negative to the file, but I tested it by comparing a double-reversed version with the original, and they are byte-for-byte identical. |
#16
Posted to rec.audio.pro
|
|||
|
|||
Sox 14.3.1: How to trim specified amount of time off the endof a wav file?
Il 23/06/2011 0.57, Nil ha scritto:
...removes exactly the last 10 seconds of the file. I was worried that the "reverse" command might do something negative to the file, but I tested it by comparing a double-reversed version with the original, and they are byte-for-byte identical. yes because sox, after the initial decoding (if the file is encoded), will save temp pcm files and does not re-encode it on every passage. This make the "double reverse" method completely lossless against the single processing step of the trim command. Sadly, expecially on large files, this will lead to a slower processing task because the temp files will be written 3 times instead of 1. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Eliminating a specified amount of time from the beginning of a WAV orMP3 file | Pro Audio | |||
creating a time limited mp3 file | Pro Audio | |||
SoX trim option for trim fix length on first of batch files | Pro Audio | |||
i was regaining to amount you some of my coastal voices | Car Audio | |||
If you had an endless amount of money... | Car Audio |