Skip to content

Commit

Permalink
new reascripts
Browse files Browse the repository at this point in the history
  • Loading branch information
junh1024 committed Dec 4, 2024
1 parent 43b17dc commit ae3757f
Show file tree
Hide file tree
Showing 3 changed files with 169 additions and 3 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,22 @@ AAX Compatibility for Pro Tools Windows is limited due to the FILM order for cha
10. If a 5.1 surround FX was selected previously, load another ReaJS, select "Multi Mix Convert (L).txt", and select 5.1 SMPTE input, 5.1 FILM output.

## mcfx_convolver presets
After installing mcfx_convolver16 from the [mcfx](https://www.matthiaskronlachner.com/?p=1910) suite, and **[the zip of my repo](https://github.com/junh1024/Reaper-Surround/archive/master.zip)** , my convolver_presets folder goes in "C:\Users\USERNAME\AppData\Roaming\mcfx\", or "~/Library/mcfx/" on Mac OS X. You may need to [unhide]( https://osxdaily.com/2011/07/22/access-user-library-folder-in-os-x-lion/
) your library folder on Mac. The presets can now be opened by mcfx_convolver16 in your DAW. It's recommended to uncheck "save preset within project" in mcfx_convolver, and then "save preset as default" in RPR so projects don't grow unnecessarily large.
1. Download & install the [mcfx suite](https://github.com/kronihias/mcfx/releases)
2. Download & extract [the zip of my repo](https://github.com/junh1024/Reaper-Surround/archive/master.zip)
3. Move the convolver_presets folder to "C:\Users\USERNAME\AppData\Roaming\mcfx\", or "~/Library/mcfx/" on Mac OS X. You may need to [unhide]( https://osxdaily.com/2011/07/22/access-user-library-folder-in-os-x-lion/
) your library folder on Mac.
4. Insert mcfx_convolver16 in your DAW
5. In mcfx_convolver16, click open > convolver_presets , and select a preset.

It's recommended to uncheck "save preset within project" in mcfx_convolver so your project doesn't grow unnecessarily large. You can "save preset as default" (if applicable).

Included presets:

- HSV_A_Testbench.conf is a template for loading IRs in the Hesuvi 7ch order. Please modify it according to the filename of your IR. The input is 7.1 SMPTE-Microsoft order.
- HSV_B_Testbench.conf same, except 14ch
- SADIE2 samples use the KEMAR dummy are courtesy of the [SADIE 2 database](https://www.york.ac.uk/sadie-project/database.html) . These IRs [are](https://www.mdpi.com/2076-3417/8/11/2029) , [DFC equalized](https://github.com/kcat/openal-soft/issues/806#issuecomment-1377034577) , and use Phantom Center, but [aren't tightly synced](https://cdn.discordapp.com/attachments/547440061478862850/1107489215811432578/image.png) . This shouldn't pose a problem unless you're using DS/DPL1-like upmixing.
- SADIE2-KEMAR-DFC-714SD-48K.conf is in the SMPTE-Dolby order, according to the Dolby document [Additional Audio Channels and Soundfields for Immersive Audio](https://developer.dolby.com/globalassets/technology/atmos/additional-channels-for-immersive-audio.pdf) p4
- SADIE2-KEMAR-DFC-714SM-PC-48K.conf is in the SMPTE-Microsoft order, according to Microsoft [WAVEFORMATEXTENSIBLE](https://learn.microsoft.com/en-us/windows/win32/api/mmreg/ns-mmreg-waveformatextensible)
- SADIE2-KEMAR samples are courtesy of the [SADIE 2 database](https://www.york.ac.uk/sadie-project/database.html) . These IRs [are](https://www.mdpi.com/2076-3417/8/11/2029) , [DFC equalized](https://github.com/kcat/openal-soft/issues/806#issuecomment-1377034577) , and use Phantom Center, but [aren't tightly synced](https://cdn.discordapp.com/attachments/547440061478862850/1107489215811432578/image.png) . This shouldn't pose a problem unless you're using DS/DPL1-like upmixing.
- BBCRD is courtesy of [BBC RD](https://github.com/bbc/bbcrd-brirs/blob/master/README.md)

### Note 1
Expand Down
77 changes: 77 additions & 0 deletions Scripts/Get ideal BPM.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
desc="Get selected items weighted BPM"
by="junh1024"

from reaper_python import *
from contextlib import contextmanager

global total_lengths, BPM_file
total_lengths=0
global total_rates
total_rate=0

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

debug = True

def msg(m):
if 'debug' in globals():
RPR_ShowConsoleMsg(m)

# msg(RPR_CountSelectedMediaItems(0))

with undoable(desc):
#get project BPM

# https://forum.cockos.com/showthread.php?t=46432
# https://github.com/metalmike/ReaScoreMusicXML/blob/master/reascoremusicxml/reascoremusicxml.py
BPM_proj=RPR_GetProjectTimeSignature2(-1,0,0)[1]
# RPR_ShowConsoleMsg(BPM_proj)

#get file BPM
# BPM_file = RPR_GetUserInputs("BPM",1,"What is the BPM of this item?","",64)[4]
# BPM_file = float(BPM_file.strip())
# RPR_ShowConsoleMsg(BPM_file)

#get items
for i in range (RPR_CountSelectedMediaItems( 0)):
MI=RPR_GetSelectedMediaItem(0,i)


# get length
item_len = RPR_GetMediaItemInfo_Value(MI, "D_LENGTH")
length_file=item_len
# compute length
# adjusted_length=item_len*1/

# set length
# RPR_SetMediaItemInfo_Value(MI, "D_LENGTH", item_len*BPM_file/BPM_proj)
# set playrate
# MediaItem_Take* RPR_GetMediaItemTakeInfo_Value( take, parmname )(MediaItem* item, int tk )
take=RPR_GetActiveTake(MI)
# RPR_ShowConsoleMsg(RPR_GetMediaItemTakeInfo_Value( MI, "B_MUTE"))
if (RPR_GetMediaItemInfo_Value( MI, "B_MUTE"))== False :
#calculate weighted BPM


rate_file=RPR_GetMediaItemTakeInfo_Value( take, "D_RATE" )
if rate_file == 0:
continue
# length_file=RPR_GetMediaItemTakeInfo_Value( take, "D_LENGTH" )
pitch_file=RPR_GetMediaItemTakeInfo_Value( take, "D_PITCH" )

BPM_file=BPM_proj/rate_file

total_pitches+=pitch_file*length_file
total_lengths+=length_file
avg_pitch=total_pitches/total_lengths
ideal_rate=1+(1.06^avg_pitch) # 12th root of 2
ideal_bpm=BPM_file*ideal_rate
RPR_ShowConsoleMsg(str(ideal_bpm) + "\n")


81 changes: 81 additions & 0 deletions Scripts/vprj-to-csv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# junh1024 and AI to make codes
# external python script to turn a VideoReDo project file to a markers file for REAPER DAW
# of selected video scenes

import sys



import xml.etree.ElementTree as ET
from datetime import datetime

divisor=10000000

def parse_xml(file_path):
tree = ET.parse(file_path)
root = tree.getroot()

times = []

First=True

for cut in root.findall('.//cut'):

# VRD vprj format stores the timecodes of the cuts we don't want, so we ignore the 1st timecode
if First == False:
CutTimeStart = float(cut.find('CutTimeStart').text)/divisor
times.append(CutTimeStart)
# print('start\n')

# Thereafter, we put the timecodes in a list
CutTimeEnd = float(cut.find('CutTimeEnd').text)/divisor
times.append(CutTimeEnd)
# print('end\n')
First = False

return times

def calculate_time_differences(times):
differences = []


the_range= int ( ( len(times)-1 ) /2 )
# print(type(the_range))

i=0
for i in range(0, the_range ):

# pairs of times form scenes, of which we are interested in the length
time_difference = times[i*2+1]-times[i*2]

if i>0:
cumulative_time_difference=time_difference+differences[i-1]
else:
cumulative_time_difference=time_difference

differences.append(cumulative_time_difference)

i+=1

return differences

if __name__ == "__main__":
file = sys.argv[1]
times = parse_xml(file)
differences = calculate_time_differences(times)

# Finally, write the times to a file
csv_file = open(file[0:-5]+'_cuts.csv', 'w')
csv_file.write('#,Name,Start,End,Length\r\n')


i=2
for diff in differences:

print(diff)
csv_file.write('M'+str(i) +',,'+str(diff)+'\n')
i+=1

csv_file.close()


0 comments on commit ae3757f

Please sign in to comment.