Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER General Discussion Forum

Reply
 
Thread Tools Display Modes
Old 01-01-2019, 11:56 PM   #1
Dex
Human being with feelings
 
Join Date: Sep 2017
Posts: 518
Default Step sequencing: How do you fix errors quickly?

I'm pretty fast at step sequencing using one hand on my midi keyboard and my other on the computer keyboard...until I make a mistake. Then I have to move to the mouse to delete the mistake (I can't just hit delete because step sequencing keeps *all* notes entered selected - hitting delete would delete everything, not just the last note or chord) and then move the record arrow back a step to set myself up to try again. It would be nice if I could create a custom action to do all of that and bind it to something like the backspace key. Anyone have any tips?
Dex is offline   Reply With Quote
Old 01-02-2019, 03:36 AM   #2
LowlyOP
Human being with feelings
 
LowlyOP's Avatar
 
Join Date: Feb 2018
Posts: 121
Default

I'm not sure and am not at my computer to check first, but have you taken a look thru the reaPack repositories? Type "previous midi note" in the actions list and/or reaPack filter input and I'd imagine there's something already there.
LowlyOP is offline   Reply With Quote
Old 01-02-2019, 07:50 AM   #3
preferred.nomenclature
Human being with feelings
 
Join Date: Dec 2014
Posts: 371
Default

Does undo not work in this scenario?
preferred.nomenclature is offline   Reply With Quote
Old 01-02-2019, 11:57 AM   #4
Dex
Human being with feelings
 
Join Date: Sep 2017
Posts: 518
Default

Quote:
Originally Posted by preferred.nomenclature View Post
Does undo not work in this scenario?
No. You have to hit undo once for each note in the chord, and undo does not move the edit cursor back. You have to do that separately.

Quote:
I'm not sure and am not at my computer to check first, but have you taken a look thru the reaPack repositories? Type "previous midi note" in the actions list and/or reaPack filter input and I'd imagine there's something already there.
I already did this and none of them helped.



The only thing I've managed to do so far is assign the following extremely dangerous workaround to a hotkey:

Custom action
Navigate: Move edit cursor left by grid
Script: spk77_Select all MIDI notes and events right of cursor
Edit: Delete notes
Attached Images
File Type: jpg nope.jpg (35.6 KB, 490 views)
Dex is offline   Reply With Quote
Old 01-11-2019, 01:34 AM   #5
Dex
Human being with feelings
 
Join Date: Sep 2017
Posts: 518
Default

Any other thoughts on this?
Dex is offline   Reply With Quote
Old 01-11-2019, 05:18 AM   #6
preferred.nomenclature
Human being with feelings
 
Join Date: Dec 2014
Posts: 371
Default

What’s dangerous about your custom action, is it that there might be notes to the right which you don’t want to delete?
preferred.nomenclature is offline   Reply With Quote
Old 01-11-2019, 01:46 PM   #7
Dex
Human being with feelings
 
Join Date: Sep 2017
Posts: 518
Default

Quote:
Originally Posted by preferred.nomenclature View Post
What’s dangerous about your custom action, is it that there might be notes to the right which you don’t want to delete?
Yes, exactly.
Dex is offline   Reply With Quote
Old 01-11-2019, 02:00 PM   #8
preferred.nomenclature
Human being with feelings
 
Join Date: Dec 2014
Posts: 371
Default

So replacing "Select all notes right of cursor" with a "Deselect all notes left of cursor" would pretty much do the trick right?
preferred.nomenclature is offline   Reply With Quote
Old 01-11-2019, 09:43 PM   #9
Dex
Human being with feelings
 
Join Date: Sep 2017
Posts: 518
Default

Quote:
Originally Posted by preferred.nomenclature View Post
So replacing "Select all notes right of cursor" with a "Deselect all notes left of cursor" would pretty much do the trick right?
Yes it would.

Unfortunately that's not a built in function and I cannot find anything like that in ReaPack or with a google search. Anyone want to code it up?

I looked at spk77's script "spk77_Select all MIDI notes and events right of cursor" and it looks like the way it works is first it unselects everything and then it selects everything to the right of the cursor, so it is not easily modified to deselect notes.
Dex is offline   Reply With Quote
Old 01-12-2019, 08:33 AM   #10
preferred.nomenclature
Human being with feelings
 
Join Date: Dec 2014
Posts: 371
Default

Not sure how soon I’ll get around to it but I can give it a shot
preferred.nomenclature is offline   Reply With Quote
Old 01-12-2019, 08:44 AM   #11
preferred.nomenclature
Human being with feelings
 
Join Date: Dec 2014
Posts: 371
Default

On my phone but I just took a look at the spk script, if you delete the line deselecting all notes, change every instance of start >= cursor_ppq_pos to end <= cursor_ppq_pos and every instance of (take, i, 1 to (take, i , 0 that oughta do it I think.
preferred.nomenclature is offline   Reply With Quote
Old 01-20-2019, 08:31 PM   #12
Dex
Human being with feelings
 
Join Date: Sep 2017
Posts: 518
Default

Quote:
Originally Posted by preferred.nomenclature View Post
On my phone but I just took a look at the spk script, if you delete the line deselecting all notes, change every instance of start >= cursor_ppq_pos to end <= cursor_ppq_pos and every instance of (take, i, 1 to (take, i , 0 that oughta do it I think.
Finally got around to trying this out.

This works. Thank you!

I can program in python but I have no idea how .eel scripting works and I don't know the Reaper API so you've been a gigantic help.

I ended up creating scripts based on your advice, which I called "Deselect all notes and events left of edit cursor" and "Deselect all notes and events right of edit cursor."

Then I made the following custom action and assigned it to Backspace:

Deselect all notes and events right of edit cursor
Navigate: Move edit cursor left by grid
Deselect all notes and events left of cursor
Edit: Delete notes

This should be pretty solid!
Dex is offline   Reply With Quote
Old 01-26-2019, 01:08 AM   #13
Dex
Human being with feelings
 
Join Date: Sep 2017
Posts: 518
Default

Found an issue, obvious in retrospect: This only allows for one backspace.

Maybe if I stored all the selected notes in an array before the third step and then re-selected them after the fourth step. I guess in order to do that the third and forth step would need to be combined into one script.
Dex is offline   Reply With Quote
Old 01-26-2019, 06:21 AM   #14
preferred.nomenclature
Human being with feelings
 
Join Date: Dec 2014
Posts: 371
Default

I think a combo action of...

Navigate: Move edit cursor left by grid
Script: (Dex) Delete selected notes at edit cursor

... would be the most straightforward way to implement this. I bet you can figure out how to write the script by looking at other MIDI scripts that do things with notes at the edit cursor. I recommend sticking with Lua as it’s “built-in”, but Reaper does have a Python API as well. There are Reaper Syntax higlighting packages for Sublime Text and VSCode that are super helpful too.

https://www.reaper.fm/sdk/reascript/reascripthelp.html
preferred.nomenclature is offline   Reply With Quote
Old 01-27-2019, 11:56 AM   #15
Dex
Human being with feelings
 
Join Date: Sep 2017
Posts: 518
Default

That works. I decided to write it in eel. I wish there were a bit more documentation and I had some trouble figuring out what the basic control structure syntax was but in the end I figured it out. Here it is:

Script: (Dex) Delete selected notes at edit cursor.eel
Code:
function Main()
local(take, cursor_ppq_position, notes, ccs, sysex, i, countleft, coutnupto, sel, muted, start, end, chan, pitch, vel, out)
(
	(take = MIDIEditor_GetTake(MIDIEditor_GetActive())) ? (
	
	MIDI_sort(take);
	cursor_ppq_position = MIDI_GetPPQPosFromProjTime(take, GetCursorPosition());
	notes = MIDI_CountEvts(take,notes,ccs,sysex);
	
	
	i=0;
	countleft=0;
	countupto=0;
	loop(notes,
		MIDI_GetNote(take, i, sel, muted, start, end, chan, pitch, vel);
		start < cursor_ppq_position ? 
		(
		countleft += 1;
		);
		start <= cursor_ppq_position ?
		(
		countupto +=1;
		);
		i+=1;
	);
	
	//ShowConsoleMsg( sprintf(#out,"%d %d %d ;",i,countleft,countupto));

	
	//MIDI_DeleteNote updates remaining note indexes too
	i=0;
	loop(countupto-countleft,
	MIDI_GetNote(take, countleft+i, sel, muted, start, end, chan, pitch, vel);
	//ShowConsoleMsg( sprintf(#out,"%d !",sel));
	sel ? (
	MIDI_DeleteNote(take, countleft+i);
	)
	:
	(
	i+=1;
	);
	);

	MIDI_sort(take);


	);
	Undo_OnStateChange("Delete selected notes at cursor");
);


main();
Dex is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:30 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.