Author Topic: Stop, Undo, Rec...  (Read 16042 times)

Offline azslow3

  • Administrator
  • Hero Member
  • *****
  • Posts: 1679
Stop, Undo, Rec...
« on: January 27, 2016, 05:57:20 PM »
Note: AZController v0.4r2b300 or later is required

From http://forum.cakewalk.com/FindPost/3359293.

Functionality:
  • if you "Play" or in "Stop", it starts recording
  • if you "Rec", is stop recording, undo (recorded material) and start recording again

Installation:
  • Follow Quick start tutorial
  • Using Cakewalk Plug-in Manager from Sonar Utilities menu import attached preset (inside the manager, "Control Surfaces"/"AZ Controller"/"Import..."/Select the file/"Ok")
  • Assign some button to "TheButton" control in the "Hardware" Tab (check Quick start how to do this, you just need select the control, press your button and "Assign MIDI"). Do NOT assign anything to "_Delete" control! It is already assigned and it must be assigned that way.

Explanation:
Do not do anything if we are already in progress of deletion ("Busy"). Check the state of Transport and in case of "Play" or "Stop" we ask Sonar to start recording ("Final" Action). The only other Transport state is Rec, so other Actions are executed only if you are already recording:
  • Indicate that we are "Busy". So in case we press the button second time "too fast", we do not interfere with current sequence.
  • Ask sonar to "Stop" (recording)
  • Arm timer to be execute "in 5 cycles" (5/13 of a second). Sonar needs some time to "finish" recording and form new clip. If we "Undo" too fast, Sonar can undo something else...

In the timer we trigger "loop"ed MIDI event (arbitrary not used by out real hardware). Why we do so can take many pages to explain. In short, we want "Undo"/"Start recording" be executed the same way as with "special virtual button" assign to it. That is a kind of "crash protection" which is extremely easy to trigger during AZController configuration in case we allow such operations inside timers...

In "_Delete" control (I use underscores to indicate for myself they are not "real") we check that we are "Busy" (see "Possible improvement"), do "Undo" and immediately start recording again.

Possible improvement
At some point you may be satisfied with recorded result, but the button continue delete/recording. It is possible to modify the preset to finally stop recording. We duplicated the first action (with "Busy:Yes" - Undefined, final). The first we change to "Busy:Yes - Command Stop" (uncheck final!), the second to "Busy:Yes -> Set state, Busy -> No, final". Also we need to set "Reset timer" to something like 1 or 2 seconds.

The result: if we press the button again within specified in timer period (1-2 sec), "Busy" is still yes. So, we trigger "Stop" and "Busy -> No". And so we will not undelete/record again. At that time the timer is already armed, so we need "Busy" check at the beginning of "_Delete" control.

We can also change the preset for reverse operation, if we "double press" we undo/record and if we just press once ww stop. If our button produce "release" MIDI event, we can use "long press"/"short press" for the same result.

Let me know if you want modified preset with one of this (or another) proposal implementation.

EDIT: 1.02.16, moved one action in preset to make following instructions in this thread working.
« Last Edit: February 01, 2016, 10:08:46 AM by azslow3 »

Offline Hatstand

  • Newbie
  • *
  • Posts: 15
Re: Stop, Undo, Rec...
« Reply #1 on: January 28, 2016, 08:07:50 PM »
Hi Alexey, I wanted to incorporate this logic into my existing preset but I am confused about the controls
such as 'Transport:Stop'-Command Record
I can see Command Record but not the Transport part
Also in your preset the _DeleteTimer control has an assigned note value but TheButton does Not
could you perhaps post the steps to add this to an existing preset?

Regards
Hatstand

Offline azslow3

  • Administrator
  • Hero Member
  • *****
  • Posts: 1679
Re: Stop, Undo, Rec...
« Reply #2 on: January 28, 2016, 09:44:57 PM »
Merging presets is in long term plans... so you should do the manually.

Open AZCtrl window and select preset you are going to modify. Close UI of the first instance (important!).
Insert second instance of AZCtrl.  Open window for the second instance and select my example preset. Close this window(important!).
Open first window (with your preset). Notice the preset name IS CHANGED. Type new preset name and press save.
Open second window (with example preset). FROM THAT MOMENT AND TILL YOU CLOSE SECOND WINDOW do NOT save preset!
There is nasty bug in Sonar which mess presets when you have more than one instance of the same plug-in...

So, now you can see example preset and modify your own.

Start with state "Busy" definition (Options tab), after defining manually set it to "No" (Overview tab)
Add hardware controls "_DeleteTimer" and "TheButton" (Option tab), notice the type for both ("System" and "Pad").
"Attach" Logical controls to both Hardware controls (Hardware tab). You can "Assign MIDI" to "TheButton" to the button on your controller you are going to use. Do not yet assign MIDI to "_DeleteTimer", it is special.

Switch to the Logic tab.
Start coping "_DeleteTimer". In example preset select each Action and reproduce is in your preset. Notice "Final" flag, other settings (like "Timer" "Once", and "Action condition" ("Busy:No") for the first action. Not all settings are shown in the Actions list, like "Once" for timer, but they should be set correctly.

Switch to the Feedback tab.
Select "_DeleteTimer : : Timer". Reproduce the same parameters for "MIDI" Action. Notice "loop" flag.
After setting all parameters, press "Play". You should see the message in the "Last MIDI event".
Now switch to Hardware tab and "Assign MIDI" to "_DeleteTimer" control.

Switch to the Logic tab again.
Copy "TheButton" actions. Notice "Final" flag and Action Conditions (for "Busy:Yes", "Transport:Stop" and "Transport:Play". The "Transport" is a system state, tracked by plug-in itself. You can not "Set" it as you do with "Set State" Action, but you can use it in conditions.

CLOSE SECOND WINDOW. Then (and only then!) press "Save preset" in the first one.


All that sounds a bit complicated, but each sentence is just 2-5 mouse clicks. Typing all this text took more time than creating the example... In fact typing both messages took ~20 minutes while configuring from scratch with testing was 2-3  :)

So in case you do not get desired result or do not want do all that yourself,  attach your original preset and I will make required modifications.
« Last Edit: January 28, 2016, 09:47:25 PM by azslow3 »

Offline Hatstand

  • Newbie
  • *
  • Posts: 15
Re: Stop, Undo, Rec...
« Reply #3 on: January 31, 2016, 09:20:47 PM »
Hi there, I have set mine up but have a couple of issues.
Firstly using "Play" to pick up the midi note on the feedback tab doesn't do anything for me, so I cannot assign the delete timer note.
also the logic I have applied to the button (I have called it StopUndoRec) does not pick up Transport Stop or Transport Play.
I have attached my preset for you to look at.
Regards

Offline azslow3

  • Administrator
  • Hero Member
  • *****
  • Posts: 1679
Re: Stop, Undo, Rec...
« Reply #4 on: January 31, 2016, 11:09:21 PM »
Strange... Please check that you are using the latest version of the plug-in.
I have fixed the definition, see the attachment.

EDIT: 1.02.16 Correct file uploaded
« Last Edit: February 01, 2016, 10:09:24 AM by azslow3 »

Offline Hatstand

  • Newbie
  • *
  • Posts: 15
Re: Stop, Undo, Rec...
« Reply #5 on: January 31, 2016, 11:42:17 PM »
Hi there, the preset you attached in the last post only has the new controls not the ones I had originally in the one I uploaded.
I will check to see if I have the latest release. The one I have is 0.4 r2 b300
Thanks

Offline azslow3

  • Administrator
  • Hero Member
  • *****
  • Posts: 1679
Re: Stop, Undo, Rec...
« Reply #6 on: February 01, 2016, 10:13:31 AM »
Sorry, I have make exactly the mistake from which I tried to warn you in my description post  ;)

(Hopefully) I have uploaded correct file now.

I have also understood why you could not see "Last MIDI" on play. My fault. For that my example plug-in had to be modified (which I have done now) or "Busy" had to be set manually into "Yes". I will think more either that is a bug of feature, at the moment I think that is feature.

Please excuse me for that mess...

Offline Hatstand

  • Newbie
  • *
  • Posts: 15
Re: Stop, Undo, Rec...
« Reply #7 on: February 01, 2016, 10:49:57 AM »
 :D
Thanks
I am not at my workstation at the moment but will download tonight and try again. If it works OK I will update my preset with the new functionality in the presets board

Offline Hatstand

  • Newbie
  • *
  • Posts: 15
Re: Stop, Undo, Rec...
« Reply #8 on: February 01, 2016, 07:59:43 PM »
Hi there, so I have it configured and the loop recording works but edit undo doesn't
I tried holding down the pad and touching it quickly but that didn't seem to do anything.
Also now when I record arm the track before hitting the record loop button the synth/midi controller hits a note and it holds the note continuously.
I have attached the latest config

scratch that (well almost all of it) I forgot I used stop a few times between trying things
also the note holding stopped once I had reloaded the project.
It seems to work fine. I have added text to say "Recording Take" on both the button and the timer as I wasn't sure which one would work or whether I needed it on both.
still not 100% sure what the timer does though :)
« Last Edit: February 01, 2016, 08:37:05 PM by Hatstand »

Offline azslow3

  • Administrator
  • Hero Member
  • *****
  • Posts: 1679
Re: Stop, Undo, Rec...
« Reply #9 on: February 01, 2016, 11:40:25 PM »
Hi there, so I have it configured and the loop recording works but edit undo doesn't
It can be that timeout is too small. Depending on you computer, the number of tracks, etc. Try to change "Reset monitor.... in 5 cycles" to "in 4 seconds" to check that.

Quote
I tried holding down the pad and touching it quickly but that didn't seem to do anything.
That should not do anything in this configuration

Quote
Also now when I record arm the track before hitting the record loop button the synth/midi controller hits a note and it holds the note continuously.
I have attached the latest config
It works as expected in my setup, I have configured my MPK mini to send exactly that message. No MIDI recorded from that button. Really strange...

Quote
scratch that (well almost all of it) I forgot I used stop a few times between trying things
That should not affect anything...

Quote
also the note holding stopped once I had reloaded the project.
Which pitch that note had? You buttons is 113, so if the comes from it it had to be really hi.

Quote
It seems to work fine. I have added text to say "Recording Take" on both the button and the timer as I wasn't sure which one would work or whether I needed it on both.
still not 100% sure what the timer does though :)
That does not sound for me that it "works fine" for you. I do not see the Text in the timer, only on the button (and it works).

The timer is required for Sonar to finalize recording session before we "Undo" it. When you do this manually, it takes "ages" for computer. Current setting is 5 cycles, which is >1/3 of a second. And it looks like that is still insufficient.

But do you get Record again? I mean it should Stop, Undelete and Record. If my assumption right, it Undelete something else (previous operation before recording...) and start recording again.
If it is not recording, event with 4 second timeout set, we should check what is going on. I will give you instructions.

If 4 seconds helps, you can try to reduce that. And if that helps, it could happen that undelete hit something when Sonar was progressing in saving, triggering random effects like permanent note... The only other reason can be either AZ Ctrl or Sonar hit a bug and MIDI message from one of controls is blocked only for "Note Off", triggering "Note On" till project reloaded (or MIDI/Audio reset). Than it is interesting to know the pitch (better in note number) and either you can reproduce that.

Offline Hatstand

  • Newbie
  • *
  • Posts: 15
Re: Stop, Undo, Rec...
« Reply #10 on: February 02, 2016, 11:57:07 AM »
Sorry should have split that previous post into 2 and then it would have made more sense.
It now seems to work fine although I may increase the cycle as per your suggestion to see if it makes any difference.
I have also programmed another button purely for edit undo in case I play back and find the take is still not right.

Once I have checked again tonight I will upload the new full preset to the presets folder.

Thanks again

Offline azslow3

  • Administrator
  • Hero Member
  • *****
  • Posts: 1679
Re: Stop, Undo, Rec...
« Reply #11 on: February 03, 2016, 12:17:04 AM »
Ah... ok  ;)

I have more or less finalized my plan for future development. I hope at some point it will be possible to just "Add" any preset to existing one. And there are some other plans for this year...