trim 15 sec of at the end of multiple files

Hi all.

I am using a program the allows me to get songs from web radio and the program splits the songs into files. That’s good I think, but the problem is that I almost all the time get 15 sec of talk or a new song starting at the end of each file. At this point I have around 400 files that I need to cut 15 sec of the end from, and create a fade out on.

I read that the program Audiacity could provide me with that possibility by using “Batch”.
As for now, I can’t find any information how to do that and I’m desperately turning to you on this forum for help. Please point me in the right direction.

Audacity calls that “Chains.”


Noticed that link, but it does not help me much. The chain effect does not include the command trim. Or at least I could not get any sense out of it in how to do.

This might do the job:
Give a shout if you need help using it.
Instructions for installing Nyquist plug-ins are here:

Okey I got the file “TrimExtend.ny” and extracted it into the Program/Audaicity folder. But, what to do after that? Could you help me out with a smal tutorial how to open and use this in Audiacity?

It needs to go into the Plug-Ins folder inside the Audacity installation folder.
Then when you restart Audacity it should appear in the Effect menu (below the divider).

When you’ve got it installed properly, try it out on a single file (as you would with other effects) before trying to use it in a Chain.

I got Nyquist did not return audio as a result.


I moved the file to the the plugin folder and found it under "Effect/Trim extend. When I use that i got a few options: samples /millisecond/Seconds/minutes, default looks to be seconds from a drop list I also have two windows that says Adjust start by, and adjust end by: and you can set numbers there for time adjustment. I try to set 15 sec in adjust end as it looks logical for me.

When I press okay the windows closes and a new windows opens up, telling me that “Nykquist did not return audio.” I click okay o that message and nothing more is going on. I don’t see any changes in the file I started to edit.
I tried some other ways around here to but I always get’s back to Mr. Nyquist telling me “No-no you thought this should be simple” Grinning me in the face as a popup. Have I missed some other plugin?

Please try it again, but instead of pressing the “OK” button, press the “Debug” button.
After running (or attempting to run) the plug-in, there will be a “debug” window that opens which may contain information to indicate where the problem lies. Copy and paste the contents of the debug window (if any) into your reply.

Which version of Audacity are you using? (Look in “Help > About Audacity”).
Which version of Windows are you using?

I am using Audacity 2.0.2 and Im on windows 7 64 bit.

Here is the debug:

error: bad argument type - #(#<Sound: #7240328> #<Sound: #7240568>)
Function: #<Subr-SND-LENGTH: #8eeba88>
#(#<Sound: #7240328> #<Sound: #7240568>)
Function: #<FSubr-LET: #8eef1a8>
Function: #<FSubr-IF: #8eef128>
(OR (> INITIAL 0) (> FINAL 0))
Function: #<Closure-ADJUST: #8f7f950>
Function: #<FSubr-IF: #8eef128>
(IF (= E-CNTRL 0) ERR (S-REST 0))

Thanks, you’ve found a bug.
Unfortunately I can’t fix it straight away because it is not a simple bug.
Fortunately it does not affect what you want to do.

The bug only affects “extending” stereo tracks.
To trim audio from the end of the track you need to set “Adjust End” to a negative value. So to trim 15 seconds from the end of the track, set “Adjust End” to -15 (minus fifteen).

(I’ll post an updated version of the plug-in when I’ve figured out a fix.)

This version should fix the problem:
direct link:

First, I must say that i am deeply impressed of the fast respond and the willingness to help out! I often take help from forums when I need help with a program, but this is truly one of the fastest responds I ever got.

I replaced the old TrimExtend.ny with your edited version, and now I don’t get the error message. But, when I try to edit the last 15 seconds, nothings cooking. I can’t se any changes in the file, and still that last 15 second of the file is there.

I tried to use the debug button, but nothing shows up as wrong.

My bad, I forgot to negative those last 15 sec. It works!!!

Now, I need to fade it out and how to create something that works for the future? What I try to understand is how to make those 15 sec go away for all my 400 songs, and to create a fadeout?

Can I create some kind of template that works for me in the future?

I’d not try to process all 400 songs in one go. I’d start with a batch of 2 or three, then gradually increase it up to 100 or so. While it is batch processing your computer will be pretty well tied up until it has finished, which could take a long time.

To “batch process” you will need to use “Chains” (see here: )

What exactly do you want to do (in detail)?
Delete 15 seconds (“exactly” 15 seconds?) from each file, and then apply a fade-out to the end of the file?
How long does the fade out need to be.
Note that with batch processing, once the batch has started it will use exactly the same settings for every file.

Let me know the details, then start practicing with Chains and see if you can figure out how they work - don’t worry about getting the right effects for now, I’ll help you with that when I know the details, but it will save a lot of time if you can figure out the basics of using Chains.

What would happen if I processes all songs at once? How many at the time is recommended? Edít* Notice you edited your post and answered my question. I was thinking of using this during the night when I am asleap :slight_smile:

I started to edit a chain and got the trim extended working with 15 sec as a parameter. When I try to ad fadeout, I have no options for parameters. Fadeout should be around 4 sec

Please be patience with me because I’m not at all into scripting and have no clue how this script works.

Cool, that’s a great start.

No, the standard Audacity fade out effect works on the entire selection, or in the case of a Chain it is applied to the entire file. You will need a special fade-out effect that will work only on the last “x” seconds.

I’m sure that you have learned a lot while doing this. While you are willing to try things and willing to learn, we are more than happy to try and help. You have already helped me by finding that bug. There are loads of cool plug-ins being written for Audacity, but hardly anyone ever posts any feedback about them, which makes it very slow work to progress them from “experimental” to “release ready”.

I think there may already be a plug-in for making fade-outs to the last few seconds - I’ll have a look - back in a bit.

There are loads of cool plug-ins being written for Audacity

Hmm… I might be blind but I can’t find the plugins listed on the mainpage? might be a reason for the lack of feedback? :wink:

Most of the “released” plug-ins are on the Audacity wiki:
but now that you mention it, there is just the one brief mention under “Resources: Effects Plug-ins” on the front page of the wiki:

Newly developed (pre-release) plug-ins are here on the forum:
The forum home page has a section called “Nyquist” in the “Programming and Development” section. It might be better if it was called “Nyquist Plug-ins”, or if was expanded into a general “plug-ins” section. I’m not sure where it would would be listed on the main page of the forum if not in the “Programming and Development” section - any ideas?

Anyway, back to the job in hand.
There was a “Fade In and Out” plug-in on the wiki, but it would be easier and quicker for you to use a plug-in that did both the trim and the fade at the same time, so try this one:

The effect is called “Trim and Fade…”
How to use it should be pretty obvious, but shout if you have any problem.