Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 09-03-2015, 11:34 AM   #1
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,964
Default ReaScript: Automatic instrument track insertion & routing, for multi-out stereo VSTi

Hi, this is my first ReaScript. It automates the most repetitive task I do with REAPER that is creating a pair of tracks for MIDI instruments and setting up the appropriate routing for them:



Code:
|- Sampler Track #1 (hosts up to 16 instruments by default)
|
|- Instrument 1 (Receives audio 1/2 from the sampler)
|--- Instrument 1 (Sends midi to the sampler's cannel 1)
|
|- Instrument 2 (Receives audio 3/4 from the sampler)
|--- Instrument 2 (Sends midi 2 to the sampler's channel 2)

...and so on
Support for multiple MIDI busses is implemented and can be enabled by editing the 'MAX_CHANNEL_COUNT' setting at the top of the script. Due to a REAPER limitation on the audio channel count in a track (64), a single "Sampler" track cannot host more than 32 stereo instruments (two midi busses).

This is not an issue for large projects since the script will automatically create more numbered "Sampler" tracks when the existing ones are full:




Download link: https://stash.reaper.fm/25200/instrument_track.lua (git repo)
The SWS/S&M extension is required.

Last edited by cfillion; 09-24-2015 at 08:48 AM. Reason: released v0.2
cfillion is offline   Reply With Quote
Old 09-03-2015, 01:33 PM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

Welcome aboard :P
X-Raym is offline   Reply With Quote
Old 09-24-2015, 08:51 AM   #3
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,964
Default

v0.2 changelog:

Quote:
set the recording mode of sampler tracks to multichannel output
set the recording mode of audio tracks to stereo output
ensure sends are created correctly no matter what defaults are set in REAPER's preferences

Last edited by cfillion; 09-24-2015 at 08:56 AM.
cfillion is offline   Reply With Quote
Old 04-20-2016, 05:35 PM   #4
aspiringSynthesisingAlch
Human being with feelings
 
Join Date: Feb 2014
Posts: 309
Default inspired :)

nice work! thanks for sharing, reminds me of something I considered when I first started my bus-schooling (as a general DAW/REAPER noob), how there's that option, that dictates whether the master/parent send is enabled? (also another seldom-toggle option stashed in prefs, re post vs pre, which tbh in itself is ALMOST beyond where I'm at... oh! and for mastering/ live-control stuff... even the option for whether it starts from 'negative infinity' or something... I bookmarked the vid, hopefully all y'all experts know what I reffin/// ANYWAY!

These, to me, are all candidates for my first foray intp the crazy world of reascripting. pleased to further park AHK, hope I find .reascript more readable...

stickied#

edit: there's also track templates for a lot of this, which I have STILL yet to sort out! Might make a 1st nice stash easteregg for noobs like me after track.templates and projects for their first 1000hours
aspiringSynthesisingAlch is offline   Reply With Quote
Old 06-24-2016, 03:51 PM   #5
Paul99
Human being with feelings
 
Join Date: Aug 2014
Location: Netherlands
Posts: 882
Default

Wow, accidentally stumbled on this script which is very nice.
Thank you!
Paul99 is offline   Reply With Quote
Old 01-06-2017, 03:26 PM   #6
aspiringSynthesisingAlch
Human being with feelings
 
Join Date: Feb 2014
Posts: 309
Default wow... how?!

Quote:
Originally Posted by Paul99 View Post
Wow, accidentally stumbled on this script which is very nice.
Thank you!
Hi, sorry I keep trying to fly before I can crawl, but I've just stumbled on this again and am wondering aloud ...


I was gonna ask re modding, but first can someone tell me what's going on @ 0:00?

That's before the script? TrackTemplates being loaded via some custom action or something?

After that, is it looking at track name ('Sampler')?

Re install, is it just - download, assign shortcut, execute shortcut action?

apologies for my ignorance!
aspiringSynthesisingAlch is offline   Reply With Quote
Old 01-06-2017, 08:11 PM   #7
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,964
Default

Quote:
Originally Posted by aspiringSynthesisingAlch View Post
That's before the script? TrackTemplates being loaded via some custom action or something?

After that, is it looking at track name ('Sampler')?
Every tracks in the gifs are created by the script. There is no track template involved.

The Sampler track(s) is automatically routed to receive MIDI from the child tracks and to send audio to the parent tracks on incrementing channels.

I have it assigned to a shortcut for quick access but like all scripts it can be ran without one just as well from the Action List.
cfillion is offline   Reply With Quote
Old 04-30-2019, 10:50 AM   #8
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 813
Default

Quote:
Originally Posted by cfillion View Post
Every tracks in the gifs are created by the script. There is no track template involved.

The Sampler track(s) is automatically routed to receive MIDI from the child tracks and to send audio to the parent tracks on incrementing channels.

I have it assigned to a shortcut for quick access but like all scripts it can be ran without one just as well from the Action List.
This is great! What a timesaver!

Is it possible to make each midi track have "Automatic record-arm when track selected" checked?
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify
tompad is offline   Reply With Quote
Old 05-02-2019, 11:33 AM   #9
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,964
Default

Quote:
Originally Posted by tompad View Post
Is it possible to make each midi track have "Automatic record-arm when track selected" checked?
Mmh I don't see a way to do that using the API. Try creating a custom action that runs this script followed by "Track: Set automatic record-arm when track selected".
cfillion is offline   Reply With Quote
Old 05-03-2019, 10:05 AM   #10
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 813
Default

Quote:
Originally Posted by cfillion View Post
Mmh I don't see a way to do that using the API. Try creating a custom action that runs this script followed by "Track: Set automatic record-arm when track selected".
I tried to do a custom script like this:

Script: instrument_track.lua
Track: Select last touched track
SWS: Select children of selected folder track
Track: Set automatic record-arm when track selected
Track: Unselect all tracks

...and all tracks gets automatic record-arm, but I want only MIDI tracks to get it.

Have I missed some action?

Or

Could I insert "Track: Set automatic record-arm when track selected" with a
reaper.Main_OnCommandEx( command, flag, proj ) somewhere in the lua code??
If so - where?
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify
tompad is offline   Reply With Quote
Old 04-14-2021, 11:11 AM   #11
adaline
Human being with feelings
 
adaline's Avatar
 
Join Date: Apr 2021
Location: she/they/it
Posts: 7
Default Fork

I'm so glad I ran into this script, it literally changed my life! My workflow is so much faster now.

I wanted just a subset of what this script does - just the part that creates routed tracks without managing or creating sampler tracks - and I also wanted to have both midi sends and audio receives on the same track, which is how I make my projects.

To that end, I made a fork of this script that does just that. I threw it up on GitHub if you're interested. Hope it's useful for somebody!

https://gist.github.com/adalinesimon...288f2a3723ffa4

__________________
Addie
she/they/it

Last edited by adaline; 04-18-2021 at 12:28 PM. Reason: Added screen capture of script in action
adaline 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:56 AM.


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