Old 04-08-2013, 04:11 PM   #81
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,037
Default

Quote:
Originally Posted by Astonisher View Post
Not sure if you've tried playing around with the "Sensitivity" setting, but I seem to recall setting it to 100% made it detect the first dB threshold correctly.
In my experience, it will detect that and 10 more "transients" that are nothing more than oscillations, in other words it makes a lot of bad slices.
__________________
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 04-10-2013, 08:46 PM   #82
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,037
Default

Alright, I'm running into a new dilemma. The only way to ensure that the phase alignment is proper is to put each item in its own track, stacked on top of one another. I use Xenakios "reposition item's start to 0s" to make them be in the same exact place in the project and then "explode items to tracks".

Awesome Ok! Oh wait... problem: there's no way to gaurantee that the media items stay in order, therefore exporting/naming samples will be impossible. The solution is:

#1: Cut/Name/Export samples BEFORE I start phase aligning (I really wish I wouldn't have to do this)

#2: A script or SOME TOOL that will allow me to rename items based on a txt list or somehow copy-paste in a list of names that correspond to the order that they appear in the project.

#3: OH! Here's a really simple idea! I already know how to take a list and rename regions. What about something that will make the media item take on the name of the region it's in?

I'm sure it'd be more difficult to program something that takes into account multiple tracks, so I could be sure to only have one track, one media item consecutively after the next, keep the project as simple as possible.

If I could rename media items based on a list, REAPER would become twice as amazing as it already is.
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template

Last edited by Argitoth; 04-12-2013 at 02:03 PM.
Argitoth is offline   Reply With Quote
Old 04-11-2013, 10:18 AM   #83
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,037
Default

Came up with some new ideas on how to accomplish this.

#4: "Auto-rename selected takes" allows you to put in a numbering tag, so it applies 01 02 03 to the media items in order. That at least allows me to know where the media item originally sat. I could rename the items AFTER export, I guess that's ok, but not ideal! Does this give you ideas on how renaming media items could work?

#5: "Rename takes" has a popup window where you type something in and press OK. I actually have a program that allows me to hit "ctrl + v" and it pastes in the next thing in a list. I'd only need to do that 3000 times. Now, I'm pretty sure there's a program that could "ctrl + v" and "[enter]" for me over and over. So this would be a solution that is outside REAPER. Doesn't work due to REAPER grabbing ALL hotkey association, not even a macro program will work.
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template

Last edited by Argitoth; 04-11-2013 at 01:15 PM.
Argitoth is offline   Reply With Quote
Old 04-12-2013, 12:59 PM   #84
Astonisher
Human being with feelings
 
Join Date: Mar 2013
Posts: 28
Default

Quote:
Originally Posted by Argitoth View Post
Came up with some new ideas on how to accomplish this.

#4: "Auto-rename selected takes" allows you to put in a numbering tag, so it applies 01 02 03 to the media items in order. That at least allows me to know where the media item originally sat. I could rename the items AFTER export, I guess that's ok, but not ideal! Does this give you ideas on how renaming media items could work?

So renaming media item takes is pretty trivial via ReaScript, and reading text files is also trivial via Python.

BUT, the source file name would not be renamed. So it could rename the media item take in the project to whatever based on a text file. But the source filename (in your project directory) will remain the same.

I think you should be able to use the Batch file processor to export the items based on item names though (File --> Batch file/item converter) if I'm understanding what you want to do correctly.
Astonisher is offline   Reply With Quote
Old 04-12-2013, 01:48 PM   #85
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,037
Default

I want to rename the items in the project. Yes! Not the actual media file. So for example:

I take a long recording and split it up in reaper 2000 times. So I have 2000 cuts, but they are all SHARING the same wav file.

If I wanted to rename the ACTUAL files, I know a few ways of doing that outside reaper, that's not a problem. I just want to rename the media items inside the project even though they all share the same file.

This would be so awesome! It would make my workflow amazing.
__________________
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 04-13-2013, 03:54 PM   #86
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,037
Default

Alright, so there's something else I need help with. Right now I am just using "auto-rename takes" and naming the media items 01 02 03 etc. I can keep them in order even after exploding them to tracks.

All I need now is a way to un-explode tracks, or get all items on the same track. At this point it doesn't need to be in order anymore, but it would be better to have it in order.
__________________
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 04-14-2013, 12:22 PM   #87
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,037
Default

I need an "explode to tracks (do not create new tracks unless needed)" the Xenakios version creates new tracks every time.

I also need "quantize item start to nearest gridline (ignore snap offset)"

Another nice one would be "quantize item start to nearest marker"

yet another would be "quantize item start to next grid line or marker"

hmm, I need to learn some scripting. there's a whole lot of alternate versions of the above I could use.

QUESTION: In your "peak detection" script, is it possible only allow detection of positive peaks OR negative peaks, but not both?
__________________
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 04-14-2013, 12:40 PM   #88
James HE
Human being with feelings
 
James HE's Avatar
 
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,252
Default

Quote:
Originally Posted by Argitoth View Post
I need an "explode to tracks (do not create new tracks unless needed)" the Xenakios version creates new tracks every time.

I also need "quantize item start to nearest gridline (ignore snap offset)"

Another nice one would be "quantize item start to nearest marker"

yet another would be "quantize item start to next grid line or marker"

hmm, I need to learn some scripting. there's a whole lot of alternate versions of the above I could use.

QUESTION: In your "peak detection" script, is it possible only allow detection of positive peaks OR negative peaks, but not both?
Does explode items in place work for what you want?

The rest I think you can do with macros with existing actions. Basically, select an item, then the macro will move the edit cursor to grid line or marker, then move the selected item (or it's edge) to the edit cursor. those actions are all in the action list. I'm not sure if the snap offset is ignored or not in that type of action, however.

how you set up the macros depends on your mouse behavior. Does left click move the edit cursor when you select an item? If yes, this is a bit easier. I can walk you through it, let me know.
James HE is online now   Reply With Quote
Old 04-14-2013, 12:44 PM   #89
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,037
Default

Quote:
Originally Posted by James HE View Post
Does explode items in place work for what you want?
It probably would work if it existed, lol! What you are actually referring to is "explode *takes* of items in place" and it does nothing to the actual items provided they don't have takes.
__________________
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 04-14-2013, 01:01 PM   #90
James HE
Human being with feelings
 
James HE's Avatar
 
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,252
Default

Quote:
Originally Posted by Argitoth View Post
It probably would work if it existed, lol! What you are actually referring to is "explode *takes* of items in place" and it does nothing to the actual items provided they don't have takes.
OK so you have a bunch of overlapping items on one track, correct? I misunderstood.

hmmm....

SO i guess you are making, like, velocity spilts or something, then moving all those to the same start on the track? then rendering to stem tracks?

I guess the track is in free item positioning mode?

If you have items stacked up like that, why not just render the items and be done with it?

there is apply FX, and apply track FX, to items. This also will number the renders in order if they have the same take name. Just use something to take "render" out of the file name.

the first file will have no number, so you might need to deal with that.

Did I help? lol. hopefully not making wrong assumptions about what you are trying to do.
James HE is online now   Reply With Quote
Old 04-14-2013, 01:07 PM   #91
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,037
Default

[~~~~] = media item

I just need this:
[~~~~][~~~~][~~~~][~~~~][~~~~]

to this:
[~~~~]
_______[~~~~]
______________[~~~~]
_____________________[~~~~]
____________________________[~~~~]

but do not create new tracks like Xenakios "explode items"

Edit: Xenakios "spread items over tracks tracks..." works except that you have to type in a number... I'll use that for now, but would much rather have a hotkey without a menu popping up.
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template

Last edited by Argitoth; 04-14-2013 at 01:48 PM.
Argitoth is offline   Reply With Quote
Old 04-15-2013, 04:08 PM   #92
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,037
Default

Sorry if I'm abusing the script request. I'm done exploding all items. Now I need to implode them. None of the actions for this seem to work.

I've tried imploding items then xenakios "reposition items" but that places the items out of order.

I've tried imploding items into takes and exploding takes in order, but that removes length and snap offset settings per items.

If only "reposition items" worked across tracks, I could offset each item so when I went to implode and explode items, it would explode them in order.

this:
[]
[]
[]
[]

to this:
[]
_[]
__[]
___[]

to this:
[][][][]

edit: wait a minute, a macro is brewing in my head.

GOT IT!

Track: Go to next track
Item: Select all items in track
Move edit cursor forward one beat
Item edit: Move position of item to edit cursor
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template

Last edited by Argitoth; 04-15-2013 at 04:20 PM.
Argitoth is offline   Reply With Quote
Old 04-16-2013, 11:09 AM   #93
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,286
Default

Quote:
Originally Posted by Argitoth View Post
[~~~~] = media item

I just need this:
[~~~~][~~~~][~~~~][~~~~][~~~~]

to this:
[~~~~]
_______[~~~~]
______________[~~~~]
_____________________[~~~~]
____________________________[~~~~]

but do not create new tracks like Xenakios "explode items"

Edit: Xenakios "spread items over tracks tracks..." works except that you have to type in a number... I'll use that for now, but would much rather have a hotkey without a menu popping up.
Maybe this works. It doesn't create new tracks:

Code:
from reaper_python import *
from contextlib import contextmanager

@contextmanager
def undoable(message):
    RPR_Undo_BeginBlock2(0)
    try:
        yield
    finally:
        RPR_Undo_EndBlock2(0, message, -1)

with undoable("Spread selected items over tracks"):

    def msg(m):
        RPR_ShowConsoleMsg(m)

    selItemIdL = []

    # get first selected item and track index
    firstSelItem =  RPR_GetSelectedMediaItem(0, 0)
    track = RPR_GetMediaItem_Track(firstSelItem)
    trackIndex = int(RPR_GetMediaTrackInfo_Value(track, "IP_TRACKNUMBER"))
    trackItemCount = RPR_CountTrackMediaItems(track)

    # make list from selected items in track
    for i in range(trackItemCount):
        itemId = RPR_GetTrackMediaItem(track, i)
        if int(RPR_GetMediaItemInfo_Value(itemId, "B_UISEL")):
            selItemIdL.append(itemId)

    # check if there are enough tracks for items
    needed = int(RPR_CountTracks(0) - trackIndex + 1 - len(selItemIdL))
    if needed < 0:
        msg("Not enough tracks for items. Add " + str(abs(needed)) + " track(s)")
    else:
        # move each item to its own track
        for j, id in enumerate(selItemIdL):
            destTrack = RPR_CSurf_TrackFromID(trackIndex + j, 0)
            RPR_MoveMediaItemToTrack(id, destTrack)
        RPR_UpdateArrange()
spk77 is offline   Reply With Quote
Old 04-16-2013, 11:54 AM   #94
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,037
Default

spk77 almost perfect!

Could you make the script add the needed tracks? Yes, I originally said to make a script that doesn't add tracks, but only because I didn't want it to add tracks every freaking time I run the action. But definitely creating the needed tracks would be one less step I have to worry about.
__________________
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 04-17-2013, 09:51 AM   #95
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,286
Default

Ok, now it creates new tracks if needed.



Code:
from reaper_python import *
from contextlib import contextmanager

@contextmanager
def undoable(message):
    RPR_Undo_BeginBlock2(0)
    try:
        yield
    finally:
        RPR_Undo_EndBlock2(0, message, -1)

with undoable("Spread selected items over tracks - add tracks if needed"):

    def msg(m):
        RPR_ShowConsoleMsg(m)

    selItemIdL = []

    # get first selected item and track index
    firstSelItem =  RPR_GetSelectedMediaItem(0, 0)
    track = RPR_GetMediaItem_Track(firstSelItem)
    trackIndex = int(RPR_GetMediaTrackInfo_Value(track, "IP_TRACKNUMBER"))
    trackItemCount = RPR_CountTrackMediaItems(track)

    # make list from selected items in track
    for i in range(trackItemCount):
        itemId = RPR_GetTrackMediaItem(track, i)
        if int(RPR_GetMediaItemInfo_Value(itemId, "B_UISEL")):
            selItemIdL.append(itemId)

    # check if there are enough tracks for items, create more tracks if needed
    needed = int(RPR_CountTracks(0) - trackIndex + 1 - len(selItemIdL))
    if needed < 0:
        for tr in range(abs(needed)):
            RPR_InsertTrackAtIndex(trackIndex, 1)

    # check if next tracks are empty
    for t in range(len(selItemIdL) - 1):
        # create new track if there are already items in "destination" track
        if RPR_CountTrackMediaItems(RPR_GetTrack(0, trackIndex + t)) > 0:
            RPR_InsertTrackAtIndex(trackIndex, 1)

    # move each item to its own track
    for j, id in enumerate(selItemIdL):
        destTrack = RPR_CSurf_TrackFromID(trackIndex + j, 0)
        RPR_MoveMediaItemToTrack(id, destTrack)

    # update view
    RPR_TrackList_AdjustWindows(False)
    RPR_UpdateArrange()
spk77 is offline   Reply With Quote
Old 04-17-2013, 10:22 AM   #96
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,037
Default

nooooonoonnoononoo, this script will create tracks every time it is run. I need the tracks to be added only if the track is not already there. In other words, don't create new tracks just because there's media items already in the track. This script acts exactly like the Xenakios one at the moment. I'm trying to edit the script myself so it works this way, but any copy and pasting of code just isn't working, still trying to figure it out.

edit: ok got it. I simply removed the block of code that says "check if next tracks are empty". Thank you spk77!

Code:
from reaper_python import *
from contextlib import contextmanager

@contextmanager
def undoable(message):
    RPR_Undo_BeginBlock2(0)
    try:
        yield
    finally:
        RPR_Undo_EndBlock2(0, message, -1)

with undoable("Spread selected items over tracks - add tracks if needed"):

    def msg(m):
        RPR_ShowConsoleMsg(m)

    selItemIdL = []

    # get first selected item and track index
    firstSelItem =  RPR_GetSelectedMediaItem(0, 0)
    track = RPR_GetMediaItem_Track(firstSelItem)
    trackIndex = int(RPR_GetMediaTrackInfo_Value(track, "IP_TRACKNUMBER"))
    trackItemCount = RPR_CountTrackMediaItems(track)

    # make list from selected items in track
    for i in range(trackItemCount):
        itemId = RPR_GetTrackMediaItem(track, i)
        if int(RPR_GetMediaItemInfo_Value(itemId, "B_UISEL")):
            selItemIdL.append(itemId)

    # check if there are enough tracks for items, create more tracks if needed
    needed = int(RPR_CountTracks(0) - trackIndex + 1 - len(selItemIdL))
    if needed < 0:
        for tr in range(abs(needed)):
            # insert new track(s) at the end
            RPR_InsertTrackAtIndex(RPR_CountTracks(0), 1)

    # move each item to its own track
    for j, id in enumerate(selItemIdL):
        destTrack = RPR_CSurf_TrackFromID(trackIndex + j, 0)
        RPR_MoveMediaItemToTrack(id, destTrack)

    # update view
    RPR_TrackList_AdjustWindows(False)
    RPR_UpdateArrange()
edit: added the below change (blue text) to the above script
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template

Last edited by Argitoth; 04-18-2013 at 12:01 PM.
Argitoth is offline   Reply With Quote
Old 04-17-2013, 10:37 AM   #97
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,286
Default

Oh, I misunderstood. Well, I'm glad that you got it working.

edit: This may work better (new tracks are inserted at the end):

Code:
    # check if there are enough tracks for items, create more tracks if needed
    needed = int(RPR_CountTracks(0) - trackIndex + 1 - len(selItemIdL))
    if needed < 0:
        for tr in range(abs(needed)):
            # insert new track(s) at the end
            RPR_InsertTrackAtIndex(RPR_CountTracks(0), 1)

Last edited by spk77; 04-17-2013 at 11:10 AM.
spk77 is offline   Reply With Quote
Old 04-17-2013, 12:22 PM   #98
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,037
Default

Ok! So now that I have this
[][][][]

to this
[]
[]
[]
[]

using a macro:
-spk77's explode media items script
-Item navigation: Move cursor to start of items
-SWS: Move selected item(s) left edge to edit cursor

Now I need the opposite script.

this:
[]
[]
[]
[]

to this:
[][][][]

I was able to do it with this:
-Track: Go to next track
-Item: Select all items in track
-Move edit cursor forward one beat
-Item edit: Move position of item to edit cursor

THEN
-Items: Implode items across tracks into items on one track

THEN
-Xenakios/SWS: Reposition selected items...

But it only works on one track at a time and I'd RATHER it work on SELECTED items. Actually, I'd like a version that works per track and another that works per selected item. Here's what it looks like now:
__________________
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 04-17-2013, 07:31 PM   #99
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,037
Default

I could use a script for this simple action:

"Move edit cursor to nearest marker"
__________________
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 04-18-2013, 11:05 AM   #100
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,286
Default

Here are two more scripts:



Implode items (simple version):
- should work if one item per track is selected
Code:
from reaper_python import *
from contextlib import contextmanager

@contextmanager
def undoable(message):
    RPR_Undo_BeginBlock2(0)
    try:
        yield
    finally:
        RPR_Undo_EndBlock2(0, message, -1)

with undoable("Implode selected items"):

    selItemCount = RPR_CountSelectedMediaItems(0)

    for i in range(1, selItemCount + 1):
        if i == 1:
            # get first selected item id/start pos/length and track index
            firstSelItem =  RPR_GetSelectedMediaItem(0, 0)
            firstSelItemPos = RPR_GetMediaItemInfo_Value(firstSelItem, "D_POSITION")
            firstSelItemLength = RPR_GetMediaItemInfo_Value(firstSelItem, "D_LENGTH")
            nextItemStart = firstSelItemPos + firstSelItemLength
            track = RPR_GetMediaItem_Track(firstSelItem)
            trackIndex = int(RPR_GetMediaTrackInfo_Value(track, "IP_TRACKNUMBER"))
        else:
            # move items
            itemId = RPR_GetSelectedMediaItem(0, i - 1)
            destTrack = RPR_CSurf_TrackFromID(trackIndex, 0)
            RPR_MoveMediaItemToTrack(itemId, destTrack)
            RPR_SetMediaItemPosition(itemId, nextItemStart, 0)
            nextItemStart = nextItemStart + RPR_GetMediaItemInfo_Value(itemId, "D_LENGTH")

    # update view
    RPR_TrackList_AdjustWindows(False)
    RPR_UpdateArrange()
Explode items:
Code:
from reaper_python import *
from contextlib import contextmanager

@contextmanager
def undoable(message):
    RPR_Undo_BeginBlock2(0)
    try:
        yield
    finally:
        RPR_Undo_EndBlock2(0, message, -1)

with undoable("Spread selected items over tracks - add tracks if needed"):

    selItemIdL = []

    # get first selected item id/start pos and track index
    firstSelItem =  RPR_GetSelectedMediaItem(0, 0)
    firstSelItemPos = RPR_GetMediaItemInfo_Value(firstSelItem, "D_POSITION")

    track = RPR_GetMediaItem_Track(firstSelItem)
    trackIndex = int(RPR_GetMediaTrackInfo_Value(track, "IP_TRACKNUMBER"))
    trackItemCount = RPR_CountTrackMediaItems(track)

    # make list from selected items in track
    for i in range(trackItemCount):
        itemId = RPR_GetTrackMediaItem(track, i)
        if int(RPR_GetMediaItemInfo_Value(itemId, "B_UISEL")):
            selItemIdL.append(itemId)

    # check if there are enough tracks for items, create more tracks if needed
    needed = int(RPR_CountTracks(0) - trackIndex + 1 - len(selItemIdL))
    if needed < 0:
        for tr in range(abs(needed)):
            # insert new track(s) at the end
            RPR_InsertTrackAtIndex(RPR_CountTracks(0), 1)

    # move each item to its own track
    for j, id in enumerate(selItemIdL):
        destTrack = RPR_CSurf_TrackFromID(trackIndex + j, 0)
        RPR_MoveMediaItemToTrack(id, destTrack)
        # set start pos to first sel item start
        RPR_SetMediaItemPosition(id, firstSelItemPos, 0)

    # update view
    RPR_TrackList_AdjustWindows(False)
    RPR_UpdateArrange()
spk77 is offline   Reply With Quote
Old 04-18-2013, 01:56 PM   #101
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,037
Default

alright, very nice work spk77! more script requests coming soon, heh. If you could come up with a way to take a txt list of items and apply it to the name of media items in a project, that would be really great.
__________________
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 04-18-2013, 05:33 PM   #102
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,037
Default

Hmm, another simple action is missing. There's an action "Xenakois/SWS: Select items under edit cursor on selected tracks" but I don't want the "on selected tracks" part of it.

I need this:

"Select items under edit cursor"
__________________
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 04-19-2013, 12:20 PM   #103
Tony Ostinato
Human being with feelings
 
Join Date: Apr 2012
Posts: 63
Default

i'm doing this unusual live setup with reaper:

http://youtu.be/l5ar_3nGx2w

i mention i like to be able to use actions to quickly select tracks but i can't go beyond track 99 without climbing up track by track after selecting 99.

would it be possible to do a reacript that mutes all tracks then selects the track number and unmutes it, even if you want to select tracks above 99?

thanks!!!!
Tony Ostinato is offline   Reply With Quote
Old 04-19-2013, 12:28 PM   #104
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,037
Default

Someone should write you a template script where you can replace the track number at your leisure. So you need:

-Select track 100 (do not keep previous track selection)
-Mute all tracks
-Unmute track 100

The above could be accomplished with a macro, but I understand you don' want to create a million macros just for every track you need above 99. A script would be much better for this.

Your explanation is confusing because it sounds like you want ONE script to select tracks above 99. I guess what you mean is: you need a script per track number above 99.
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template

Last edited by Argitoth; 04-19-2013 at 05:03 PM.
Argitoth is offline   Reply With Quote
Old 04-19-2013, 01:03 PM   #105
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,286
Default

Edit.
added: remove trailing \r\n
fixed: newname ->newName (thanks, Argitoth)

Load/apply item names from file (Actually take names because item names don't exist in reaper).

Code:
# Load/apply item names from file

from reaper_python import *
from contextlib import contextmanager

@contextmanager
def undoable(message):
    RPR_Undo_BeginBlock2(0)
    try:
        yield
    finally:
        RPR_Undo_EndBlock2(0, message, -1)

with undoable("Load/apply item names from file"):

    def msg(m):
        RPR_ShowConsoleMsg(m)

    actTakeIdL = []

    selItemCount = RPR_CountSelectedMediaItems(0)

    for i in range(selItemCount):
        selItemId = RPR_GetSelectedMediaItem(0, i)
        takeId = RPR_GetActiveTake(selItemId)
        actTakeIdL.append(takeId)

    a = RPR_GetUserFileNameForRead("Select item name list", "Load item names from file", ".txt")
    path = a[1]
    if a[0] == 1:
        try:
            f = open(path, "r")
            for i, newName in enumerate(f):
                newName = newName.rstrip("\r\n")  # remove trailing cr(carriage return) and n(new line)
                RPR_GetSetMediaItemTakeInfo_String(actTakeIdL[i], "P_NAME", str(newName), 1)
                if i + 1 == selItemCount:
                    break
            f.close()
        except IOError as e:
            msg(e)

Last edited by spk77; 06-02-2013 at 01:12 AM. Reason: added: remove trailing \r\n and fixed newname ->newName
spk77 is offline   Reply With Quote
Old 04-19-2013, 03:00 PM   #106
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,037
Default

ALRIGHT YES IT WORKS! Thank you, spk77!! This is a game changer for developing sample libraries.
__________________
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 04-19-2013, 11:09 PM   #107
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,286
Default

Quote:
Originally Posted by Tony Ostinato View Post
i'm doing this unusual live setup with reaper:


http://youtu.be/l5ar_3nGx2w

i mention i like to be able to use actions to quickly select tracks but i can't go beyond track 99 without climbing up track by track after selecting 99.

would it be possible to do a reacript that mutes all tracks then selects the track number and unmutes it, even if you want to select tracks above 99?

thanks!!!!
Select/unmute track 100 and mute other tracks:

Code:
from reaper_python import *
from contextlib import contextmanager

@contextmanager
def undoable(message):
    RPR_Undo_BeginBlock2(0)
    try:
        yield
    finally:
        RPR_Undo_EndBlock2(0, message, -1)

with undoable("Select track / mute others"):

    muteAllTracks = 40341
    unSelectAllTracks = 40297
    selectTrack = 100
    unMuteTracks = 40731
    verticalScrollToSelTrack = 40913

    if selectTrack <= RPR_CountTracks(0):
        RPR_Main_OnCommandEx(muteAllTracks, 0, 0)
        RPR_Main_OnCommandEx(unSelectAllTracks, 0, 0)
        RPR_SetTrackSelected(RPR_GetTrack(0, selectTrack - 1), 1)
        RPR_SetMixerScroll(RPR_GetTrack(0, selectTrack - 1))
        RPR_Main_OnCommandEx(unMuteTracks, 0, 0)
        RPR_Main_OnCommandEx(verticalScrollToSelTrack, 0, 0)

Last edited by spk77; 04-20-2013 at 04:22 AM. Reason: added "vertical scroll to selected tracks"
spk77 is offline   Reply With Quote
Old 04-19-2013, 11:09 PM   #108
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,286
Default

Quote:
Originally Posted by Argitoth View Post
ALRIGHT YES IT WORKS! Thank you, spk77!! This is a game changer for developing sample libraries.
Very nice!
spk77 is offline   Reply With Quote
Old 04-20-2013, 12:53 AM   #109
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,286
Default

Edit: Zip file updated (Undo wasn't working correctly and action "Track: Vertical scroll selected track(s) into view" added)

200 actions for "Select/unmute track and mute other tracks" (tracks 100-300):

https://stash.reaper.fm/16204/Select%...te%20track.zip

Last edited by spk77; 04-20-2013 at 10:24 PM.
spk77 is offline   Reply With Quote
Old 04-20-2013, 02:30 AM   #110
Tony Ostinato
Human being with feelings
 
Join Date: Apr 2012
Posts: 63
Default

wow, thats really something. huge thanks!!

i'll dedicate this coming week to installing pyhton and getting this working.

thanks!!!
Tony Ostinato is offline   Reply With Quote
Old 04-20-2013, 02:57 AM   #111
Tony Ostinato
Human being with feelings
 
Join Date: Apr 2012
Posts: 63
Default

"Your explanation is confusing because it sounds like you want ONE script to select tracks above 99. I guess what you mean is: you need a script per track number above 99."

bingo. thanks for the deconvolution!

and its not like every single track but certain ones for sure.

not every band and not every lead singer but some like to not tell you what song is next before they count it off and if youre supposed to be in on beat 1 and arent there they get all huffy and sometimes even say things over the mic!

and thats just kinda one example. ive been pretty lucky setting things up so i can accommodate that behavior but its gonna get harder as i keep adding tunes and arrangements so the actions will likely keep me going happy for awhile.

thanks yet again.
Tony Ostinato is offline   Reply With Quote
Old 04-20-2013, 04:26 AM   #112
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,286
Default

Quote:
Originally Posted by Tony Ostinato View Post
wow, thats really something. huge thanks!!

i'll dedicate this coming week to installing pyhton and getting this working.

thanks!!!
I updated the zip file (post #109) because undo wasn't working correctly and I also added action "Track: Vertical scroll selected track(s) into view".
spk77 is offline   Reply With Quote
Old 04-20-2013, 06:59 AM   #113
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,286
Default

Quote:
Originally Posted by Argitoth View Post
Hmm, another simple action is missing. There's an action "Xenakois/SWS: Select items under edit cursor on selected tracks" but I don't want the "on selected tracks" part of it.

I need this:

"Select items under edit cursor"
Select items under edit cursor (unselect other items):

Code:
#Select items under edit cursor (unselect other items)

from reaper_python import *
from contextlib import contextmanager

@contextmanager
def undoable(message):
    RPR_Undo_BeginBlock2(0)
    try:
        yield
    finally:
        RPR_Undo_EndBlock2(0, message, -1)

with undoable("Select items under edit cursor"):

    def msg(m):
        RPR_ShowConsoleMsg(m)

    unSelAllItems = 40289

    RPR_Main_OnCommandEx(unSelAllItems, 0, 0)
    for i in range(RPR_CountMediaItems(0)):
        itemId = RPR_GetMediaItem(0, i)
        itemStartPos = float(RPR_GetMediaItemInfo_Value(itemId, "D_POSITION"))
        itemEndPos = itemStartPos + float(RPR_GetMediaItemInfo_Value(itemId, "D_LENGTH"))
        if itemStartPos <= RPR_GetCursorPositionEx(0) <= itemEndPos:
            RPR_SetMediaItemInfo_Value(itemId, "B_UISEL", 1)

    # update view
    RPR_UpdateArrange()

Last edited by spk77; 04-20-2013 at 11:26 AM.
spk77 is offline   Reply With Quote
Old 04-20-2013, 11:09 AM   #114
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,037
Default

hey spk77 that script is weird in that you must activate it twice for it to select something, or you must have something already selected.

Edit: Hey actually, could you tell me the command for getting the mouse cursor position so I have a choice of edit cursor or mouse cursor? I can't find anything about mouse cursor in the API.

Edit2: What program do you use for scripting this stuff?
__________________
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 04-20-2013, 12:00 PM   #115
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,286
Default

Quote:
Originally Posted by Argitoth View Post
hey spk77 that script is weird in that you must activate it twice for it to select something, or you must have something already selected.

Edit: Hey actually, could you tell me the command for getting the mouse cursor position so I have a choice of edit cursor or mouse cursor? I can't find anything about mouse cursor in the API.

Edit2: What program do you use for scripting this stuff?
Ok, it should work now (added "RPR_UpdateArrange()" at the end)

Yes, there isn't any function to get mouse cursor position. This is how the script works:
- unselect all items first
- get item count with "RPR_CountMediaItems(0)" (0 for active project)
- loop in range(item count)
- get every item's ID, start position and length
  • ID = RPR_GetMediaItem(0, index)
  • StartPos = float(RPR_GetMediaItemInfo_Value(ID, "D_POSITION"))
  • Length = float(RPR_GetMediaItemInfo_Value(ID, "D_LENGTH"))
  • EndPos = StartPos + Length
- "RPR_GetCursorPositionEx(0)" gets edit cursor position in seconds
- if edit cursor position is between item's StartPos and EndPos, set that item selected. "RPR_SetMediaItemInfo_Value(ID, "B_UISEL", 1)"


Sorry, I cannot explain it better.

I'm using PyScripter:
https://code.google.com/p/pyscripter/

Last edited by spk77; 04-20-2013 at 12:09 PM.
spk77 is offline   Reply With Quote
Old 04-20-2013, 06:10 PM   #116
Tony Ostinato
Human being with feelings
 
Join Date: Apr 2012
Posts: 63
Default

i intalled python, 3.2 cause it wouldnt recognize 3.3 or something, and i got your script mapped to the shift f and it takes me to track 100 and beyond perfectly.

bravo! yeay, useful for me very.

theres one behavior tho id like to change about it if possible, after using that script to select that track when you hit the arrow key to take you to the next track it takes you back to the track you were at before you used the script, plus one.

so if im at track 5 and use the script to select track 100 and then hit the arrow key to try to go to track 101 itll instead go to track 6.

which might be useful in some situations but in most i think id need to be able to go to the next track 101 at that point.

thanks thanks thanks thanks!!!!

oh, and also i dont need undo, on my live laptop i disable undo to make scrolling faster, i never used undo live so it seemed ok to do.

another thing i forgot , when i use the arrow keys theyre mapped to macros to do the mute/slect/unmute thing.

Last edited by Tony Ostinato; 04-20-2013 at 06:29 PM.
Tony Ostinato is offline   Reply With Quote
Old 04-20-2013, 10:23 PM   #117
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,286
Default

Looks like RPR_SetTrackSelected() doesn't work correctly. I replaced it with another function and now the script seems to be working (zip updated in post #109). I checked your video and noticed that you are using:

(up arrow)
- Mute tracks (this mutes only the selected tracks)
- Go to previous track
- Unmute tracks

I guess it should be:
(up arrow)
- Mute all tracks
- Go to previous track
- Unmute tracks

and

(down arrow)
- Mute all tracks
- Go to next track
- Unmute tracks

Last edited by spk77; 04-20-2013 at 11:35 PM.
spk77 is offline   Reply With Quote
Old 04-21-2013, 10:39 AM   #118
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,286
Default

Quote:
Originally Posted by Argitoth View Post
I could use a script for this simple action:

"Move edit cursor to nearest marker"
Move edit cursor to nearest marker:

Code:
# Move edit cursor to nearest marker

from reaper_python import *
from contextlib import contextmanager

@contextmanager
def undoable(message):
    RPR_Undo_BeginBlock2(0)
    try:
        yield
    finally:
        RPR_Undo_EndBlock2(0, message, -1)

with undoable("Move edit cursor to nearest marker"):

    cursorPos = RPR_GetCursorPositionEx(0)

    i = 0
    while RPR_EnumProjectMarkers3(0, i, 0, 0, 0, "", 0, 0)[0] > 0:
        markerPos = RPR_EnumProjectMarkers3(0, i, 0, 0, 0, "", 0, 0)[4]

        if markerPos == cursorPos:
            break

        # seek next marker after edit cursor
        if markerPos > cursorPos:

            # if cursor is between project start and 1. marker -> move to 1. marker
            if i == 0:
                RPR_SetEditCurPos2(0, markerPos, 1, 0)

            # check which one is closer to edit cursor (marker before cursor or marker after cursor)
            elif abs(cursorPos - prevMarkerPos) < abs(cursorPos - markerPos):

                # if marker before cursor is nearest -> move cursor there
                RPR_SetEditCurPos2(0, prevMarkerPos, 1, 0)
            else:
                # if marker after cursor is nearest -> move cursor there
                RPR_SetEditCurPos2(0, markerPos, 1, 0)

            break

        # if cursor is after the last marker -> move cursor to last marker
        elif markerPos < cursorPos and RPR_EnumProjectMarkers3(0, i + 1, 0, 0, 0, "", 0, 0)[0] == 0:
            RPR_SetEditCurPos2(0, markerPos, 1, 0)

        i += 1
        prevMarkerPos = RPR_EnumProjectMarkers3(0, i - 1, 0, 0, 0, "", 0, 0)[4]

Last edited by spk77; 04-21-2013 at 10:53 AM.
spk77 is offline   Reply With Quote
Old 04-21-2013, 11:16 AM   #119
Tony Ostinato
Human being with feelings
 
Join Date: Apr 2012
Posts: 63
Default

works!! absolutely perfect!

i really appreciate this!!!!!!!!!

i can better keep up with these cats who only play one instrument and one sound all night.

tho even in the old days when i was just playin real trumpet id hate that crap because if they dont tell you what song is next and just start playing the intro and you try quick to play the first notes you end up slamming the mouthpiece right into your teeth or something painful.

anyways i feel like i should pay you. this was a big deal for me.
Tony Ostinato is offline   Reply With Quote
Old 04-21-2013, 11:27 AM   #120
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,037
Default

Quote:
Originally Posted by Tony Ostinato View Post
this was a big deal for me.
oh yeah. Reaper scripts are just out-of-this-world amazing to support the best and fastest workflow imaginable inside an extremely powerful sequencer.

Hey spk77, does that script ignore time selection? Is it impossible to ignore time selection when moving to the nearest marker/region? Edit: Ok, answered that question. Sweet! It ignores time seleciton. Could you also do a "goto next / goto previous marker" scripts? SWS: Goto next/previous marker has to remove time selection to do it. OH, also include "projest start/end" for the previous/next scripts.
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template

Last edited by Argitoth; 04-21-2013 at 11:32 AM.
Argitoth 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 01:46 PM.


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