Moving a selection from one track to another [SOLVED]

I would like to know how to move a selected region of a track to the same region of another track. I have for instance a percussion mono track where I can hear clearly the hits of some specific instrument, alternated with the hits of another distinct one. Now I want to isolate all the hits of the second one on another track so that I can apply various effects on it I wouldn’t apply on the first one.

So I need to move those second instrument hits from the first track to a second track and then silence the original concerned region on the first instrument track.

I thought this kind of process would be easy with the Chains macro capability, but I just could not find out how to do it. And if it is not possible by a Chain macro, is it possible with Nyquist code ?

Can duplicate a selected portion onto a new track by pressing “Ctrl”+“D” keys at the same time.
If you want to silence the selected part on the original after duplicating it, instead press “Ctrl”+"Alt+“I” ,
( the latter is called Split New)

Thanks, I did not know about “Ctrl-Alt-I” (Split New). Now I have 3 problems with this method when editing :

  1. I need to do this split from track#1 to track#2 many times along the audio of track#1. Every “Ctrl-D” would have to shoot its result in track#2, not in yet another new track created each time.
  2. Once “Ctrl-D” would have yield its selection to track#2, the “Ctrl-Alt-I” (Silence) kind of action would have to be applied to the same selection in track#1.
  3. This whole process applied on a selected part of track#1 toward track#2 would have to be done again and again to many parts of track#1.

To state it simply, it is about moving a selection in track#1 to the same positions in track#2 and being able to do it again to any other selection I choose from track#1. It’s just a moving function from track#1 to track#2, which could be applied as many times as needed.

I don’t know if my description is clear enough, but this splitting need is very different. It’s extracting pieces of track#1 to only one track#2, repeated at will.

As a matter of fact, overall, it could be easily solved if I could record in Audacity a macro which would record my mouse clicks and menu option selections. Then I could easily apply my macro to each track selected part I want to split. Is it something feasible in Audacity ?

In that case, use “Split New” for the first clip, then:

  1. Select the next part that you want to move
  2. “Split Cut” (“Edit menu > Remove Special > Split Cut” Alt+Ctrl+x)
  3. “Enter” (deselect the current track)
  4. Down arrow (move focus to the track below)
  5. “Enter” (toggle selection on)
  6. “Paste” (Ctrl + V)

In one line:

Alt+Ctrl+x, Enter, Down, Enter, Ctrl+V

(If you use this a lot, you could make a Macro to do this sequence, though the method described above is more flexible, because you can move from any track to any track).

Hi Steve. Thanks for that cue. I did not know about the Enter and Down Arrow effects. Your solution works all right. Now I have to make it a macro. I went to the mentioned web page, but it does not explain how you make the macro with all of its parameters. I’ll try to figure it out and will tell you later how it goes. Thanks again.

Hopefully you will succeed, but feel free to ask if you get stuck. (As Macros are new, we’re all working them out as we go along :wink:)

I have started the experiment… I have a question about how you get the macro to execute the “Enter” which deselect the track and how you get it to execute a Down Arrow move ?

Hi again, Steve. I guess I made it now. I firstly import or open my original audio to be splitted; then I create a second new track; then I loop in the cycle of selecting a piece of first track to split and applying my macro to it, again and again along the original track. Here is attached a picture of my macro steps.

I could improve it a bit if I could create the second track automatically at the beginning, but this would require to be able to place a conditional step at the beginning. It is something you know of ?

Is it possible in a Nyquist plugin to call a Chain Macro ? If so I could probably test the conditions in the plugin for calling either a certain macro or another one, depending on the condition. This would help me improve my Split function.

Macros are stored as plain text files. There is one file per Macro

On Windows, they are usually in:
(“AppData” is a hidden folder, but you can easily open that folder from file explorer by entering %appdata% as the file path address).

Rather than posting screenshots, post the text copied from the Macro text file.

You can also edit these Macro files directly, which is useful when you need to add specific steps multiple times.

Rather than doing:

SelectTracks:Mode="Set" Track="0"
SelectTracks:Mode="Set" Track="1"

could you just do:


Do you actually need to join the clips at all?

Yes you can, provided that the Macro that you are calling does not include any Nyquist effects. (Nyquist cannot call itself).
You do it like this:

(aud-do "Macro_<macroname>:")

where “” is the name of the macro that you wish to call.
Why do you need to do that?

Thanks a lot, Steve. You’re really helping in my progress in the realm of Audacity macros and plugins… :wink: :wink:

The Join is needed because I need both tracks to be saved with their audio gaps replaced by silences, as they will be treated as separate tracks in my mix later on.

Thanks for the clarification on where macros are as text files, I’ll display my examples as text next time.

I need the Nyquist capability because I would like to be able to condition sometimes certain steps to testing of project or environment variable status. For instance, I could have as a first step of my Split macro the testing of the existence of only one track in the project, and if so my action would be to create a new additional track with same length than first track and fill it with silence; the same test, if more than one track (i.e. after having created the second new track), would be the real macro body, with all the actions of split cut, silence selection on first track and join gaps on both tracks.

I hope my explanation will be clear enough…

You can do that with something like:

(if (= (get '*project* 'tracks) 1)
    ( something ...)
    (...else somethig ...))

Thanks for the cue. Here is what I came with :

;nyquist plug-in
;version 4
;type process
;name “NewTrack”

(cond ((= (get 'project 'tracks) 1)
(aud-do “SelectTracks: Mode="Set", Track=0”)
(aud-do “SelectTrackStartToEnd”)
(aud-do “Duplicate”)
(aud-do “SelectTracks: Mode="Set", Track=1”)
(aud-do “Silence: Use_Preset=""”)))

Now it does not seem to work completely as when I test it in Nyquist Prompt, it works all right, but when as save it as a plugin and then call it from the Tools menu, it seems to work up to “Duplicate”, but the two last instructions do not seem to work.

Would you have an idea why it’s so ?

The AUD-DO commands don’t take commas between arguments.
Also, I’d suggest making this a “tool” type effect (in the Tools menu) as Nyquist is not processing the selected audio.

Try this:

;nyquist plug-in
;version 4
;type tool
;name "NewTrack"

  ((= (get '*project* 'tracks) 1)
      (aud-do "SelectTracks: Mode=\"Set\" Track=0")
      (aud-do "SelectTrackStartToEnd")
      (aud-do "Duplicate")
      (aud-do "SelectTracks: Mode=\"Set\" Track=1")
      (aud-do "Silence:")))

Thanks a lot, Steve. So I finally come with the following plug-in which would either create a second track with silence, and the same length than the first one, if there is only one track (at the beginning of my split process), or process the selection split cut if there are more than one track. That seems to fulfill my requirement exactly.

;nyquist plug-in
;version 4
;type tool
;name "SplitTrackSelection"

  ((= (get '*project* 'tracks) 1)
      (aud-do "SelectAll")
      (aud-do "SelectTracks: Mode=\"Set\" Track=0")
      (aud-do "SelectTrackStartToEnd")
      (aud-do "Duplicate")
      (aud-do "SelectTracks: Mode=\"Set\" Track=1")
      (aud-do "Silence:")))
  ((> (get '*project* 'tracks) 1)
      (aud-do "SelectTracks: Mode=\"Set\" Track=0")
      (aud-do "SplitCut")
      (aud-do "SelectTracks: Mode=\"Set\" Track=1")
      (aud-do "Paste")
      (aud-do "SelectAll")
      (aud-do "Join")
      (aud-do "CursorToSelectionEnd")))

Again, I appreciate very much your help in developing this plug-in code ! :wink:

Congratulations :slight_smile: