Old 10-18-2014, 11:52 AM   #1
cheyrn
Human being with feelings
 
Join Date: Oct 2014
Posts: 67
Default Move to (not split at) zero crossing?

I am more interested in moving there, than snapping. I want to hear what I am doing before splitting. Is there a way to do this? I don't see it in the action list.
cheyrn is offline   Reply With Quote
Old 10-18-2014, 12:12 PM   #2
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

Go to next transient / previous transient maybe ?
vanhaze is offline   Reply With Quote
Old 10-18-2014, 12:12 PM   #3
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Mesa, AZ
Posts: 2,057
Default

search "zero crossing" in actions list.
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template
Argitoth is offline   Reply With Quote
Old 10-18-2014, 05:49 PM   #4
cheyrn
Human being with feelings
 
Join Date: Oct 2014
Posts: 67
Default

Uggh. I didn't say what I meant. Can I move the time/loop selection to start or end on a zero crossing (mono)?

Or, how can I move the selection to start and/or end at the edit cursor?

Move to next transient moves to the next peak, I think.
cheyrn is offline   Reply With Quote
Old 10-18-2014, 06:01 PM   #5
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Mesa, AZ
Posts: 2,057
Default

cheryn, are you trying to move the start/end of an item to zero crossing or start/end of time selection? or just the start? or just the end?
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template
Argitoth is offline   Reply With Quote
Old 10-18-2014, 06:57 PM   #6
cheyrn
Human being with feelings
 
Join Date: Oct 2014
Posts: 67
Default

Both also one or the other. Typically, I would listen to a part of audio with one side of the selection at a zero crossing. Then expanding the selection to work on the other side with the selection ending at a zero crossing.

I see that I can type in the selection position, but oddly it is visibly different than where the edit cursor is. For example, the transport says 2.4.09. If I set the selection start to 2.4.09 the selection starts slightly away from the edit cursor.
cheyrn is offline   Reply With Quote
Old 10-18-2014, 07:09 PM   #7
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Mesa, AZ
Posts: 2,057
Default

Quote:
Originally Posted by cheyrn View Post
If I set the selection start to 2.4.09 the selection starts slightly away from the edit cursor.
That's because when you type that in, it's exactly 2.4.09. The cursor is not exactly there.

Do you want a script? It's not as convenient as "dragging" (because with a script you have to press a button).

Also, what exactly are you trying to do? Unless you're working with mono material, there's not really a point to edit based on zero crossings.
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template
Argitoth is offline   Reply With Quote
Old 10-19-2014, 12:30 AM   #8
planetnine
Human being with feelings
 
planetnine's Avatar
 
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,924
Default

I think there are actions to move the time selection start and end to the edit cursor. So all you need is to move the edit cursor there first.

Not sure about moving item start or end to the edit cursor without getting in front of REAPER first.



>
__________________
Nathan, Lincoln, UK. | Item Marker Tool. (happily retired) | Source Time Position Tool. | CD Track Marker Tool. | Timer Recording Tool. | dB marks on MCP faders FR.
planetnine is offline   Reply With Quote
Old 10-19-2014, 02:11 AM   #9
cheyrn
Human being with feelings
 
Join Date: Oct 2014
Posts: 67
Default

I did not see anything in actions that looked to me like it moves selection start or end to the edit cursor. If there is then there is a solution.

Otherwise, there is an action to move the edit cursor to a zero crossing. But, I can't make use of that to form a selection.

I would like to see a script. What kind of script?

I'm trying to select portions of audio (mono) and avoid having clicks. I know I can fade in/out. But there are cases where that won't be acceptable.
cheyrn is offline   Reply With Quote
Old 10-19-2014, 10:45 AM   #10
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by cheyrn View Post
I did not see anything in actions that looked to me like it moves selection start or end to the edit cursor. If there is then there is a solution.

Otherwise, there is an action to move the edit cursor to a zero crossing. But, I can't make use of that to form a selection.

I would like to see a script. What kind of script?

I'm trying to select portions of audio (mono) and avoid having clicks. I know I can fade in/out. But there are cases where that won't be acceptable.
Try these:
Loop points: Set end point
Loop points: Set start point
Loop points: Set loop points to items



Edit. ...and there are many "Go to.." -actions (for moving the edit cursor).

Last edited by spk77; 10-19-2014 at 10:52 AM.
spk77 is offline   Reply With Quote
Old 10-19-2014, 11:37 AM   #11
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Mesa, AZ
Posts: 2,057
Default

gonna write a script before spk77 does!!!! *runs away to write script*
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template
Argitoth is offline   Reply With Quote
Old 10-19-2014, 12:02 PM   #12
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by Argitoth View Post
gonna write a script before spk77 does!!!! *runs away to write script*
spk77 is offline   Reply With Quote
Old 10-19-2014, 12:05 PM   #13
Jacos
Human being with feelings
 
Join Date: Jun 2014
Location: New Zealand
Posts: 227
Default

There are actions for "Go to next zero crossing" "Set start point of time selection" and "set end point of time selection"
Jacos is offline   Reply With Quote
Old 10-19-2014, 12:42 PM   #14
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Mesa, AZ
Posts: 2,057
Default

save as .eel
go to actions --> ReaScript: New.Load
load script
put this action as a button on a toolbar
right-click button
vuala, becomes a mouse modifier.

PHP Code:
// Move edit cursor to nearest zero crossing of mouse cursor

// by Elan Hickler
// www.Soundemote.com
// www.elanhickler.com

function NEXT_ZERO()(Main_OnCommand(40791,0); GetCursorPosition());
function 
PREV_ZERO()(Main_OnCommand(40790,0); GetCursorPosition());
function 
CURSOR_TO_MOUSE()(Main_OnCommand(40513,0);GetCursorPosition());
function 
SetCursor(time)(SetEditCurPos(time,0,0);time);
function 
GetCursor()(GetCursorPosition());
function 
SELECT_ITEM_UNDER_MOUSE()    (Main_OnCommand(40528,0);GetSelectedMediaItem(00));
function 
CONSOLE(string)(ShowConsoleMsg(sprintf(#, string)));
function MoveCursorToNearestZeroCrossing()(
    
item SELECT_ITEM_UNDER_MOUSE();
    
item_pos GetMediaItemInfo_Value(item"D_POSITION");
    
item_end item_pos GetMediaItemInfo_Value(item"D_LENGTH");
    
take GetActiveTake(item);
    
source GetMediaItemTake_Source(take);
    
srate_time 1/GetMediaSourceSampleRate(source);

    
edit_pos CURSOR_TO_MOUSE();
    
prev_zero PREV_ZERO();
    
edit_pos prev_zero <= srate_time prev_zero PREV_ZERO();
    
SetCursor(edit_pos);
    
next_zero NEXT_ZERO();
    
next_zero edit_pos <= srate_time next_zero NEXT_ZERO();
    
closest_zero abs(prev_zero edit_pos) < abs(next_zero edit_pos) ? prev_zero next_zero;
    
closest_zero == item_pos closest_zero next_zero
    
:closest_zero == item_end closest_zero prev_zero;
    
SetCursor(closest_zero);
);

PreventUIRefresh(-1);
MoveCursorToNearestZeroCrossing();
PreventUIRefresh(1);
Undo_OnStateChange("Move edit cursor to nearest zero crossing of mouse cursor"); 
This script can be turned into many "do things at next/previous/nearest zero crossing" so just tell me what you want after you try this out.
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template

Last edited by Argitoth; 10-19-2014 at 01:10 PM.
Argitoth is offline   Reply With Quote
Old 10-19-2014, 12:59 PM   #15
gofer
-blänk-
 
gofer's Avatar
 
Join Date: Jun 2008
Posts: 11,359
Default

Maybe also of interest:
I've got a bunch of loosely relates eel scripts. Nothing with zero crossing, but
- scripts to move the edit cursor to the time selection (loop selection) edges without seeking playback - (the in-built actions will interrupt and play back from the new cursor position).

- And scripts to move the time (loop) selection start/end to the edit cursor - (the in built actions will move the selection edges to the play cursor when playback is running).

Makes eight eels, bundled in a *.rar packet here: https://stash.reaper.fm/v/21389/Move%...ce%20versa.rar
gofer is offline   Reply With Quote
Old 10-19-2014, 02:17 PM   #16
cheyrn
Human being with feelings
 
Join Date: Oct 2014
Posts: 67
Default

The Loop commands that spk77 mentions do what what I was after. Thanks. There is an action to move the edit cursor to prev/next zero crossing. Then loop set start/loop start end extend the loop selection. That's a good reason to have loop not linked to time, I guess. I can see what it sounds like then move time if it is right.

The script appears to move the edit cursor to a zero crossing. Thanks for example eel code and thanks for the links to related scripts.

What do the source measurements have to do with the cursor movement in the script?

Also, off topic eel question, I suppose: If you invoke GetSet_LoopTimeRange2 twice, how can you get the time range instead of setting it? Is there something like "null" in eel? Or, how do you undefine the variable references?
cheyrn is offline   Reply With Quote
Old 10-19-2014, 05:12 PM   #17
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Mesa, AZ
Posts: 2,057
Default

Quote:
Originally Posted by cheyrn View Post
What do the source measurements have to do with the cursor movement in the script?
I just want to make sure the zero crossing that is measured is not one sample away... oh... I guess that will cause problems if the edit cursor just happened to be placed one sample away from a zero crossing in the first place... dangit.

Quote:
Originally Posted by cheyrn View Post
Also, off topic eel question, I suppose: If you invoke GetSet_LoopTimeRange2 twice, how can you get the time range instead of setting it? Is there something like "null" in eel? Or, how do you undefine the variable references?
GET: GetSet_LoopTimeRange(0, 0, time_start, time_end, 0)
now time_start and time_end hold the values.

SET: GetSet_LoopTimeRange(1, 0, time_start, time_end, 0)
now time_start and time_end will set the values
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template

Last edited by Argitoth; 10-19-2014 at 11:30 PM.
Argitoth is offline   Reply With Quote
Old 10-19-2014, 08:34 PM   #18
Jacos
Human being with feelings
 
Join Date: Jun 2014
Location: New Zealand
Posts: 227
Default

Quote:
Originally Posted by gofer View Post
Maybe also of interest:
- scripts to move the edit cursor to the time selection (loop selection) edges without seeking playback - (the in-built actions will interrupt and play back from the new cursor position).

- And scripts to move the time (loop) selection start/end to the edit cursor - (the in built actions will move the selection edges to the play cursor when playback is running).

Makes eight eels, bundled in a *.rar packet here: https://stash.reaper.fm/v/21389/Move%...ce%20versa.rar
Thank you gofer, I like the sound of these, and have downloaded them.
EDIT: ...and they are absolutely fantastic - just what I've been looking for since first opening Reaper. Thank you very much for creating and sharing these actions. and thanks for the thread cheyrn.

Last edited by Jacos; 10-19-2014 at 10:14 PM.
Jacos is offline   Reply With Quote
Old 10-19-2014, 09:33 PM   #19
cheyrn
Human being with feelings
 
Join Date: Oct 2014
Posts: 67
Default

Ah, "isSet" means set, as opposed to get. I thought it meant something else... checking if something is set. Anyway, thanks.
cheyrn 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 04:47 AM.


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