Using chains to insert silence at start and end of file

This section is now closed.
Forum rules
Audacity 1.3.x is now obsolete. Please use the current Audacity 2.x.x package for your distribution or compile Audacity from the source code.
sik0fewl
Posts: 3
Joined: Wed Nov 25, 2009 11:46 pm
Operating System: Please select

Using chains to insert silence at start and end of file

Post by sik0fewl » Thu Nov 26, 2009 12:14 am

Hi,

I'd like to use chains to truncate silence at the end of each track and then generate a specified amount of silence at the start and end of each tracks.

I figured this would be easy to do, since it's easy to do by hand. However, chains only seem to allow "Effects" to be used and not other Audacity commands, so I can run "Truncate silence" but "Generate -> Silence" can't be. If I overlooked something here, please let me know.

So after that I figure my best bet is using Nyquist in the chain. However, when I try to do this, Audacity crashes. I'm not sure if I'm doing something wrong (most likely) or there's just a bug in Audacity.

Here's what I tried to do to generate silence at the start and end of the track. This is on a mono track.

Code: Select all

(seq (const 0 5) (cue s) (const 0 5))
That call crashes Audacity with this debug info:

Code: Select all

[ gc: total 16640, 1656 free; samples 1KB, 0KB free ]
error: bad argument type - NIL
Segmentation fault
My system:

Code: Select all

$ uname -a
Linux makalu 2.6.28-16-generic #55-Ubuntu SMP Tue Oct 20 19:48:24 UTC 2009 i686 GNU/Linux
$ audacity -version
Audacity v1.3.7 (Unicode)
[Edit: I'm running Jaunty]

Any help that can be offered would be greatly appreciated!

--
Thanks,
Ryan

steve
Site Admin
Posts: 81653
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Using chains to insert silence at start and end of file

Post by steve » Thu Nov 26, 2009 12:40 am

sik0fewl wrote:Here's what I tried to do to generate silence at the start and end of the track.
Unfortunately it's not quite that simple - putting silence before "s" in that way won't work because of stuff to do with *warp* that I don't understand :D

It should not crash Audacity though, but I see you have Audacity 1.3.7 which has some bugs in Nyquist (now fixed in Audacity 1.3.9).

I'm not sure that this is the best way to do it, but this will add 5 seconds of silence to the beginning and end of the selection:

Code: Select all

(feedback-delay (seq (cue s)(cue (stretch-abs 1 (s-rest 10)))) 5 0)
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

steve
Site Admin
Posts: 81653
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Using chains to insert silence at start and end of file

Post by steve » Thu Nov 26, 2009 12:53 am

A couple of ways to do it with mono or stereo tracks:

Code: Select all

(stretch-abs 1.0
(if (arrayp s)
   (vector
      (sim (at 0 (cue (s-rest 5)))(at 5 (seq (cue (aref s 0))(cue (s-rest 5)))))
      (sim (at 0 (cue (s-rest 5)))(at 5 (seq (cue (aref s 1))(cue (s-rest 5))))))
   (sim (at 0 (cue (s-rest 5)))(at 5 (seq (cue s)(cue (s-rest 5)))))))

Code: Select all

(defun space (s-in time)
(stretch-abs 1.0
   (sim
      (at 0  (s-rest time))
      (at time (seq (cue s-in)(cue  (s-rest time)))))))

(multichan-expand #'space s 5)
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

sik0fewl
Posts: 3
Joined: Wed Nov 25, 2009 11:46 pm
Operating System: Please select

Re: Using chains to insert silence at start and end of file

Post by sik0fewl » Thu Nov 26, 2009 1:09 am

Thanks a lot, Steve... I'm pretty sure I would've never figured that out :-).

Unfortunately I just noticed that the Nyquist prompt isn't even available in "Edit chains".

What would you recommend doing in order to run these commands (Truncate silence and Nyquist script) in batch? Audacity is starting to seem pretty inflexible for this purpose.

--
Thanks again,
Ryan

steve
Site Admin
Posts: 81653
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Using chains to insert silence at start and end of file

Post by steve » Thu Nov 26, 2009 1:29 am

sik0fewl wrote:Unfortunately I just noticed that the Nyquist prompt isn't even available in "Edit chains".
Yes, shame isn't it :D

Batch processing is still pretty rudimentary in Audacity.

There are a few related "Feature Requests" listed here: http://wiki.audacityteam.org/index.php?title=Automation
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

sik0fewl
Posts: 3
Joined: Wed Nov 25, 2009 11:46 pm
Operating System: Please select

Re: Using chains to insert silence at start and end of file

Post by sik0fewl » Thu Nov 26, 2009 1:43 am

stevethefiddle wrote:Batch processing is still pretty rudimentary in Audacity.
Yes, I'm starting to discover that :-). I'll guess I'll have to play around and see what I can do.

I'm starting to think the easiest way might be to write a new built-in effect :-).

Thanks again for your help.

steve
Site Admin
Posts: 81653
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Using chains to insert silence at start and end of file

Post by steve » Thu Nov 26, 2009 1:58 am

There was a long discussion about this a while ago - unfortunately the main discussion is no longer on the forum, but there's a partial summary here: http://forum.audacityteam.org/viewtopic ... 03&p=52466
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

somenick
Posts: 19
Joined: Thu Feb 17, 2011 8:21 am
Operating System: Please select

Re: Using chains to insert silence at start and end of file

Post by somenick » Thu Feb 17, 2011 10:23 am

Was this ever solved? Did you find another solution not using Audacity?

steve
Site Admin
Posts: 81653
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Using chains to insert silence at start and end of file

Post by steve » Thu Feb 17, 2011 6:10 pm

somenick wrote:Was this ever solved? Did you find another solution not using Audacity?
Adding this feature to Audacity is quite a major project and will not be happening before Audacity 2.0 comes out.

If you are comfortable with command line programs and batch scripting it is possible to accomplish the task using SoX http://sox.sourceforge.net/
There is a bit of an introduction to scripting with SoX in this topic: http://forum.audacityteam.org/viewtopic ... 18&t=50426
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

bgravato
Posts: 2098
Joined: Wed Jan 13, 2010 8:56 pm
Operating System: Linux Debian

Re: Using chains to insert silence at start and end of file

Post by bgravato » Fri Feb 18, 2011 1:20 am

steve wrote:
somenick wrote:Was this ever solved? Did you find another solution not using Audacity?
Adding this feature to Audacity is quite a major project and will not be happening before Audacity 2.0 comes out.

If you are comfortable with command line programs and batch scripting it is possible to accomplish the task using SoX http://sox.sourceforge.net/
There is a bit of an introduction to scripting with SoX in this topic: http://forum.audacityteam.org/viewtopic ... 18&t=50426
Though it is implicit, I'd like to make it explicit that obviously sox can't process audacity project files... So if you have all the shows saved as audacity projects only it won't help much unless you export all of them as WAV, FLAC or similar...
Include as much details as you can in your post (Audacity version, Operating System, Equipment used, etc).
Please post your question in the appropriate forum (regarding audacity version and operating system).

Locked