On May 30 09:49:43, jeffares.robert@xxxxxxxxx wrote: > Hi Jan, this was working OK until we got to a point where > the internet feed was about 2 minutes behind the source. I don't know what 'feed' and what 'source' you are talking about. > It varies from about 10 seconds to as long as 3 minutes. The Innovonics 601 > does not seem to have a buffer that big. I know nothing about "The Innovonics" and its buffers, and have no idea how this relates to your problem, namely, cutting an audio file at a pip. > ## the audio is recorded as newsaudio.wav If the file is not too big, or sensitive, can you please upload it somewhere? > #record level is at -12 to allow plenty of headroom > # heres a little eq > sox newsaudio.wav eqednews.wav highpass 120 lowpass 5000 equalizer 2000 500 > +1 First do what you need to do, only then "beautify" the sound with equalizers. For instance, you are wasting cycles here to equalize even the portions you want to cut off. > #normalise track so we are working with reference audio > sox -v `sox eqednews.wav -n stat -v 2>&1` newsaudio.wav normalised.wav See the norm effect (which is gain -n) instead of this. The following seems to be a confused usage of the 'silence' effect. If I am reading it right, you trim the file at the first 2 secs of silence, see how long that beginning was, and cut that much from the file (again). Just let sox cut everything up to and including the first silence. Read the description of 'silence' again, paying special attention to the 'above-periods' parameter. > #use sox to find out how long to first 2 second gap first trim the track > #first find out how long from the start of the file to 2 sec silence > #this will fail if there is an earlier 2 second gap. Minute before news is a > trailer so unlikely > # tweaked to 1.0 sec because presentation too slack and it looks like lead > is added > #upped modulation level of silence to allow for announcer breath < one in > particular has a big intake of breath right before bulletin. Mic Open > sox -V3 normalised.wav clipped.wav silence 0.5 0.1% 1.0 0.8% > #increased floor level to 0.8 because of studio noise at -30 < air con and > such not unusual > > #We need to know how long this is in seconds > LENGTH=` sox clipped.wav -n stat 2>&1 | sed -n 's#^Length > (seconds):[^0-9]*\([0-9.]*\)$#\1#p' ` > #Cut that off the front of the audio > sox -V3 normalised.wav head.wav trim $LENGTH > >>/home/rd/$(hostname)-cleanupbbcnews.log > > # the bulletin is 5 minutes long so this will trim the bottom > > # This relies on a 1.8 second gap at the end of the bulletin now reduced to > 1.2 because of switch noise. > ## look for silence from end of file > sox -V3 head.wav clapped.wav reverse silence 0.5 0.1% 1.0 0.8% reverse > TAIL=` sox clapped.wav -n stat 2>&1 | sed -n 's#^Length > (seconds):[^0-9]*\([0-9.]*\)$#\1#p' ` > #increased floor level to 0.8 because of studio noise at -30 > > #Now cut that off the end of the audio The silence effect can also cut from the back. No need for this dance either. > sox -V3 head.wav allthenews.wav reverse trim $TAIL reverse > # gone back to just cut at 5 min and 1.3 sec > # this is a debug line > #cp /head.wav /allthenews.wav # just in the meantime > > #sometimes that gap at the end is too short so this is the double check lops > it at 5:01 the follow on is too tight > sox -V3 allthenews.wav justthenews.wav trim 0 5:01 _______________________________________________ Sox-users mailing list Sox-users@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/sox-users