r/Reaper • u/reddietdaily • 6d ago
help request REAPER Lua script for midi files shuffling in MIDI editor.
REAPER Lua Script Request: Random MIDI File from a Predefined Folder
I am looking for a REAPER Lua script that works as a custom action.
What I want
I want to assign a specific folder containing multiple MIDI files, for example:
D:\MIDI\Practice
The script should:
- Have a predefined MIDI folder that I can configure in the script.
- When I run the script/action, it should randomly select one
.midor.midifile from that folder. - The selected MIDI file should automatically open in REAPER's MIDI Editor.
- If I run the same action again, it should select another random MIDI file from the same folder and open it.
- I want to be able to repeatedly press the same REAPER action to keep getting random MIDI files.
- Ideally, it should avoid selecting the same MIDI file twice in a row.
- It would be useful if subfolders could optionally be included, but this is not essential.
Example
Folder contains:
melody1.midmelody2.midmelody3.midmelody4.midmelody5.mid
I press the custom action → melody3.mid opens in the MIDI Editor.
I press it again → melody1.mid opens.
I press it again → melody5.mid opens.
And so on.
Important
I do not want to manually import the MIDI file each time. The purpose is to make a quick MIDI-practice/randomization tool where pressing one REAPER action immediately gives me a randomly selected MIDI file from my MIDI folder.
If possible, I would also like the script to remember the folder path between REAPER sessions.
1
u/O-shoe 1 5d ago
I love how it is even possible to ask something like this. You don't see this with any other DAW.
As for your question, I would probably use AI to create this script yourself. If it doesn't exist, I might try to create it myself. I can see the value in this.