Page 1 of 2
Auto-Zero
Posted: Thu Feb 12, 2015 6:39 pm
by Steve Bender
I would like to see an automatic way to add zero crossings to a clip.
Specifically, such a feature would allow a user to add a zero crossing to a selected piece of audio (whether that be a track, or a selected portion of a track), and be able to select if they want one at the beginning, end, or both. And also be able to set the fade to zero length on both sides independently, in either ms or number of samples. I would think it would make sense to default to both front and back, and a good default for length might be, idk, 5 samples. Not too sure on that.
As it is now, you can obviously just choose to cut a portion of existing audio at zeros. That’s fairly simple. But everyone once in a while you’ll be forced to choose between a final clip length of, say, either .356 or .355. For most users this is probably not a big deal at all – what’s a single millisecond, right? But if you’re using the resulting clip to form longer clips by repeating/cloning it, a difference of a single ms can actually constitute a non-trivial amount of time, and the more you clone it, the more the single ms adds up. Or you can cut it to length first (which ensures accuracy of the resulting clip) and then perform a fade in/out while zoomed in really tight. This also works. But it’s an extra 3-4 steps.
This feature would also work really well with existing functions like silence finder and Detach at Silences. You could create the zero crossings at various points in a track really quickly with this feature, and then use those tools to auto-segment the track.
If anyone has a suggestion for doing all this in a faster way with exiting features, I’m all ears.
Thanks.
Re: Auto-Zero
Posted: Thu Feb 12, 2015 6:51 pm
by steve
I'm a little confused by your description. "Zero crossing point" is "the place at which the waveform crosses zero" - it's not an editing action per se.
Do you mean that you want a "one click" method to apply a short fade-in / fade-out to the selected audio clip?
If so, would you want the fade-in/out to be applied to the ends of the selection, or to the ends of the audio clip (they will only be the same place when the selection is exactly from start to end of an audio clip).
Re: Auto-Zero
Posted: Thu Feb 12, 2015 7:21 pm
by Steve Bender
steve wrote:Do you mean that you want a "one click" method to apply a short fade-in / fade-out to the selected audio clip?
Yes, exactly.
steve wrote: If so, would you want the fade-in/out to be applied to the ends of the selection, or to the ends of the audio clip?
I think applying it to the ends of the selection might be more adaptable overall. That way users could apply it to a short section of a track, or to the entire track by just selecting the whole track.
Thanks.
Re: Auto-Zero
Posted: Thu Feb 12, 2015 7:39 pm
by Steve Bender
Oh, and just to add a little context to why this would be a nice feature, in case it isn't apparent already -
It would allow a person to very easily create multiple little "snippets" or "loops" to create longer loops and riffs without getting that terrible-sounding "crackle" that you get if you cut something not at a zero crossing. I'm sure that is probbaly obvious to you, but I thought I'd just put it out there in case it isn't obvious.
Re: Auto-Zero
Posted: Thu Feb 12, 2015 8:12 pm
by steve
Steve Bender wrote:It would allow a person to very easily create multiple little "snippets" or "loops" to create longer loops and riffs without getting that terrible-sounding "crackle" that you get if you cut something not at a zero crossing.
For short sections, it would be very easy to create a
Nyquist plugin to do that. Current versions of Audacity allow you to set keyboard shortcuts to Nyquist plugins (in
Keyboard Preferences) so that it becomes a one click operation. (It becomes somewhat more tricky for handling long selections because the plugin would need to load the entire selection into ram - though that may change in the future).
If you would be happy with that as a solution, then we can move this conversation over to the "plugins" section of the forum, work out the details of exactly how it should work, and put together a new plugin.
Re: Auto-Zero
Posted: Thu Feb 12, 2015 8:30 pm
by Steve Bender
steve wrote:If you would be happy with that as a solution, then we can move this conversation over to the "plugins" section of the forum, work out the details of exactly how it should work, and put together a new plugin.
I would be THRILLED with that solution. I’ve never used a Nyquist plugin (except the ones that are now integrated into Audacity), but there’s no time like the present to learn!
I’m not sure what your cutoff is between considering a section “long” or “short.” My intended use for this is primarily for clips that are under 20 seconds long. Most of them probably under 5 seconds. Would that be RAM intensive?
Yes, please move this thread to the appropriate spot and leave me a link so I can follow along.
Thanks!
Re: Auto-Zero
Posted: Thu Feb 12, 2015 10:35 pm
by Steve Bender
One thing that I was wondering – is it possible to have the remaining audio also be zero crossed?
What I mean is this – if you have a 5 second clip, and you apply the AutoZero plugin effect to the middle 3 seconds, it will give the desired effect on those middle three seconds (i.e. it will leave a piece of audio with the beginning and end terminating in a zero crossing), but what about the remaining audio? The pieces of audio on either side of the middle three seconds – couldn’t those very well end/start with a non-zero crossing? That would not be ideal at all.
If so, would it be possible to have the plugin affect both sides of a line? What I mean is, say the right border of the selected area is at 3.556 seconds. Could you apply the fade to zero to the left of that line (toward 3.555) as well as to the right of that line (toward 3.557)? That way, the middle portion (the three seconds that are highlighted/selected) and both of the ends (both the one second portions that are not highlighted) would all be left with zero crossings. Having it function this way would be very desirable. It's not a "deal breaker" or anything, because I can work with it either way, but it would be nice.
And if you could get it to work in such a way, might it also be possible to do the exact same thing at a cursor point? So, instead of being required to select a piece of audio, you would just set the cursor line at a given ms spot and apply the effect.
Again, it would be nice to be able to configure the number of ms/samples over which the fade to zero would happen – but I’m sure we could come up with an acceptable number if it has to be a fixed number.
Thanks.
Re: Auto-Zero
Posted: Fri Feb 13, 2015 1:05 am
by steve
OK, so this is getting to the nitty-gritty.
Plugins can only act on audio within the "selection". They have absolutely no concept of audio existing before or after the selection.
A new feature that becomes available in the next release version of Audacity is that Nyquist plugins will become aware of clip boundaries (the start and end of an audio clip.
We can use this new feature (should be available within the next few weeks).
I presume that you may want to cut a piece out from a longer piece of audio, and have "fade to zero" at each side of the cut?
What we could do is to make the behaviour of the plugin conditional on where the clip boundaries are (if any).
To explain - what I have in mind is:
- Select the bit that you want to cut out, and apply the effect. The effect applies a fade-in to the start of the selection, and a fade-out to the end of the selection.
- Cut (or "split cut") the section, ready for pasting somewhere else. The selection is copied to the clipboard - this is just a normal Audacity edit.
- Extend the selection so that it includes the end of the audio that was before the bit that we cut out, and the start of the audio that was after the bit that we cut out. The plugin can "see" the clip boundaries that are now within the selection, so it applies a fade-out to end of the first audio clip, and a fade-in to the start of the later audio clip. This "extended selection" does not need to be precise - it just needs to be long enough that we can fit the fades within the selection.
Does that make sense?
What do you think?
By the way, how long are you thinking for the fades? About 5 milliseconds (0.005 seconds) for each fade?
Re: Auto-Zero
Posted: Fri Feb 13, 2015 2:13 am
by steve
Let's try this as a starting point.
Select an audio clip, then open the "Nyquist Prompt" effect (Effect menu).
Copy and paste this code into the Nyquist Prompt text window and apply:
Code: Select all
(setq fade-length 0.005)
(setq dur (get-duration 1))
(abs-env
(let* ((fl fade-length)
(env (pwlv 0 fl 1 (- dur fl) 1 dur 0)))
(mult s env)))
Re: Auto-Zero
Posted: Fri Feb 13, 2015 2:21 am
by Steve Bender
steve wrote: in the next release version of Audacity
When is that happening? I know that my preferences (like keyboard shortcuts) carry over from one version to the next, but do my plugins? How about user settings, like if I were to create some custom reverb settings?
steve wrote: We can use this new feature (should be available within the next few weeks).
If it’s just a few weeks, then that sounds like a plan. But it was more like a few months, I think I would be more likely to want to “settle” for the reduced version, the one that would not be capable of doing the fades on the “leftover” pieces.
steve wrote: I presume that you may want to cut a piece out from a longer piece of audio, and have "fade to zero" at each side of the cut?
Correct. That would be ideal.
steve wrote: Cut (or "split cut") the section, ready for pasting somewhere else
I would definitely prefer split cut, so that audio to the right does not shift post-cut.
steve wrote: By the way, how long are you thinking for the fades? About 5 milliseconds (0.005 seconds) for each fade?
I just did some testing now, to see the ms length of a typical cut that I normally make. Looks like 4 ms is about right, since that often corresponds to about half of a wave in things that I typically cut. So if we have to settle on just one fade length, 4 or 5 ms sounds about right, yup.
steve wrote: What do you think?
I think this all sounds great. Thanks!
Did you see my feature request for mix and render with auto crossfades? Is that a pretty pie in the sky request? I assume that’s a harder nut to crack.