Loop Play from within selection. (SHIFT+B)

Audio software developers forum.

If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like

Loop Play from within selection. (SHIFT+B)

Permanent link to this post Posted by steve » Wed Sep 29, 2010 8:34 pm

When repeating a section (Edit > Repeat) the exact positions of the start and end points are often critical.
For very short selections it is easy to test the "loop position" with "Loop Play" (SHIFT + Play).
However, for a longer selection (for example repeating a 1 minute chorus) this is unduly time consuming (and if you've ever needed to do this you will know just how irritating it is).

The "B" key allows playback within a selection, but it stops at the end of the selection. What would be really useful would be to be able to play from an arbitrary point within a selection, and for playback to loop back to the beginning.

I realise that there are workarounds, but it would be so much more friendly and convenient to have this as a feature.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45379
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Loop Play from within selection. (SHIFT+B)

Permanent link to this post Posted by Gale Andrews » Thu Sep 30, 2010 12:24 pm

And I was about to suggest SHIFT + B for something there seems to be no easy workaround for :) - if the mouse cursor was before the midpoint in the selection, SHIFT + B would play from there to the end of selection; if the mouse cursor was after the midpoint, SHIFT + B plays from start of selection to mouse cursor. Very useful for short selections. Aren't the workarounds for your problem fairly easy - use B from hovering close to the end of the selection, then Space?

With your idea, does playback stop after traversing the entire selection from the beginning, or loop play from the beginning to where your mouse cursor was, or something else?



Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual
Gale Andrews
Quality Assurance
 
Posts: 26089
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Loop Play from within selection. (SHIFT+B)

Permanent link to this post Posted by steve » Thu Sep 30, 2010 4:58 pm

When looping, the most critical point is when the end of one time through becomes the beginning of the next time through.

"Counting the beats" and lining up the selection so that start and beginning are immediately before the onset of a beat are useful techniques to improve accuracy, but for music that either has complex rhythms or does not have a strong beat, there is no substitute for listening. The section that needs close attention is the transition as the repeat goes back to the beginning. The aim in selecting the best loop point is to create a seamless transition as the selection repeats. "B" then SPACE will not do because it does not play through the transition.

The only methods currently available are:
1) Loop play the entire selection.
2) Use the "Repeat" effect, then move the cursor to play through the transition, then if it is not exactly correct, Undo, then adjust the selection and try again. (this is the workaround).

The reason that the workaround is so awkward is that you can't see exactly where the transition is, so making the necessary adjustments to the selection become very much more tricky.

This feature request is for a means (and I'm not really fussy about what the means is - SHIFT+B just seems like an obvious method) to play the last part of a selection and for it to immediately (without stopping or pausing) continue playback from the beginning of the section. The feature is identical to Loop Play but with playback beginning at a point other than the start of the selection.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45379
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Loop Play from within selection. (SHIFT+B)

Permanent link to this post Posted by Edgar » Thu Sep 30, 2010 7:25 pm

stevethefiddle wrote:This feature request is for a means […] to play the last part of a selection and for it to immediately (without stopping or pausing) continue playback from the beginning of the section. The feature is identical to Loop Play but with playback beginning at a point other than the start of the selection.


Let me see if I understand you, let us imagine we have 60 seconds of audio, we (somehow--use a region label?) mark a region – let us say from 00:10 to 00:30; we set the cursor at 00:20 and issue our command. What we want to see happen is that the audio starts playing at 00:20 and plays through until 00:30 and then (with no perceptible pause) jumps back to 00:10 and continues playing (and I am assuming it's going to stop at 00:20). Is this right?
-Edgar
compiling Audacity daily
64-bit Windows 7
Edgar
Forum Crew
 
Posts: 1490
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 7

Re: Loop Play from within selection. (SHIFT+B)

Permanent link to this post Posted by steve » Thu Sep 30, 2010 7:49 pm

Edgar wrote:let us imagine we have 60 seconds of audio, we (somehow--use a region label?) mark a region – let us say from 00:10 to 00:30; we set the cursor at 00:20 and issue our command. What we want to see happen is that the audio starts playing at 00:20 and plays through until 00:30 and then (with no perceptible pause) jumps back to 00:10 and continues playing

Yes.

Edgar wrote:(and I am assuming it's going to stop at 00:20)

I don't mind if it then stops at 00:20 or continues to loop.
Putting together the ideas of "Play to/from the current pointer position to/from the start/end of the selection" ("B" key) and "Loop Play" (SHIFT+Space) it would be logical to continue looping until manually stopped, but for the purpose that I describe it does not matter if it continues to loop or stops when it gets back to 00:20.

A more realistic example might be that I have a 6 minute piece of music that I want to extend to around 8 minutes (for example to fit an 8 minute slide show or video).
So I decide to loop the section from about 1:23 to 3:30 (I've recognised that this is starts at the beginning of a musical "phrase" and ends at the end of a musical phrase). However, I need to get the loop positions exact so that it will play smoothly without jumping after I have "looped" it (Repeat effect). I don't want to have to wait for 2 minutes and 7 seconds to find out that the loop length is a little bit too long/short.

I could upload an actual example if it would help - I do a lot of this kind of thing.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45379
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Loop Play from within selection. (SHIFT+B)

Permanent link to this post Posted by Edgar » Thu Sep 30, 2010 10:55 pm

Let me look at the code and see how "play" works. I do not imagine that it would be too hard to create a proof-of-concept as long as we did not want to add a lot of interface (like adding to the prefs etc.). I will work against SVN HEAD so that you may apply a patch to try it out (assuming I can pull it off). You do realize that there is slim-to-no chance of this getting committed pre-2.0, right? Anyway, here is the design specification I will use:

add menu item "Continuous Loop Play" to Transport menu, keyboard shortcut SHIFT+B
(it could go anywhere and be called anything but the only way I know how do "drive" the event is via a menu item)
pseudo-code:
OnContinuousLoopPlay {
is current cursor location (CCL) in a labeled region (LR)
if no -- bail out with minimal wxMessageBox warning
if yes --
play from CCL to end of LR
skip back to beginning of LR and continue playing until "Stop" (via tool, menu keypress)
}
For production we could add a stored pref item for "one time" (the way I would most likely use it--I have that feature on a production deck in the studio) or "continuous loop" (the way you seem to want to use it).

I will try to look at this tonight.
-Edgar
compiling Audacity daily
64-bit Windows 7
Edgar
Forum Crew
 
Posts: 1490
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 7

Re: Loop Play from within selection. (SHIFT+B)

Permanent link to this post Posted by steve » Fri Oct 01, 2010 12:43 am

I guess it'll depend a lot on what you find when you look at the code, but personally I'd be OK with "loop play" added to the "B" key behaviour.
What I mean by that is that the "B" key plays form the current pointer position and "Loop Play" loops back to the start of the selection on reaching the end of the selection.
Put those together and you have "Loop Play from current pointer position".
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45379
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Loop Play from within selection. (SHIFT+B)

Permanent link to this post Posted by Edgar » Fri Oct 01, 2010 5:00 am

Merry Oktoberfest!

Patch against this afternoon's SVN HEAD (30Oct2010) which seems to perform as specified. I did NOT do exhaustive testing for conditions like:
no (wave|label)track
multiple (wave|label)tracks
non-44100 project rates
mono tracks
long tracks
overlapping label regions (now that I think about it this might cause problems)

Have fun! If you have questions, problems or comments let me know.
Attachments
LoopFromCursor.patch
(9.79 KiB) Downloaded 196 times
-Edgar
compiling Audacity daily
64-bit Windows 7
Edgar
Forum Crew
 
Posts: 1490
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 7

Re: Loop Play from within selection. (SHIFT+B)

Permanent link to this post Posted by steve » Fri Oct 01, 2010 12:50 pm

Merry Oktoberfest to you too Edgar.

Unfortunately I'm getting some really strange results, but before that I'm just wondering why you decided to use labels as the loop region rather than the current selection. Is there a technical reason for that? If not, then I think it would be easier from a user perspective to loop the selection rather than using a label region.

Also I notice that key presses when a label track is selected create a new label (I don't often use labels so I'd not noticed this behaviour). This makes it a bit awkward to use labels to define the loop region as any adjustments that are made to the label will leave focus on the label track.

So for the strange results:
1) Place the playback cursor on an audio track within a region defined by a region label. (Example: Label region from 10.0 to 30.0 and cursor at 25.0)
2) Press SHIFT + B

Playback commences from the playback position (25.0)
On reaching the end of the label region, the cursor jumps to the start of the label region (jumps from 30.0 to 10.0 as expected)
The audio that is played is a repeat of what has just been played - it is not playing the correct audio. Rather than playing from 10.0 it repeats the audio 25.0 to 30.0.

If the cursor is placed outside of the label region (assuming only one label region in a one audio track project), the on SHIFT + B Audacity freezes.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 45379
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Loop Play from within selection. (SHIFT+B)

Permanent link to this post Posted by Edgar » Fri Oct 01, 2010 3:04 pm

I did warn you that this code was not thoroughly tested! During the production process I used 30 seconds of generated noise and relied on visual inspection to determine appropriate action. I only tested it with one actual MP3 file and that was modern jazz with no vocals and almost no structure (I have no idea why I use that file – it was a mistake, a song I had never heard before).

As for why I chose to use Labeled Regions, as far as I can tell it is impossible to make a selection and then click somewhere within it to set the cursor – the selection goes away. I am a neophyte when it comes to using Audacity there may well be a method for setting off a region of audio other than Labeled Regions but since I have just spent many days working with the Label code it was simply familiar territory.

If you take a quick look at the patch, you will see the area in AudioIO.cpp where the loop back code is. You will see that the variable names are meaningless: mTime, mT0 etc. I suspect that I need to reset another variable to the beginning of the Labeled Region so that it starts playing the music there. I will try to give that a look see!
-Edgar
compiling Audacity daily
64-bit Windows 7
Edgar
Forum Crew
 
Posts: 1490
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 7

Next

Return to General Audio Programming



Who is online

Users browsing this forum: No registered users and 5 guests