How to check in how many blocks an instrument is used?

Post Reply
akimaze
Posts: 4
Joined: 15 Oct 2021 08:43
Location: Poland
Contact:

How to check in how many blocks an instrument is used?

Post by akimaze » 23 Oct 2021 20:01

Hello everyone, I'm a new user and haven't found an answer.

When I duplicate a block, in the new one the same instruments are used. It's good default behavior but when I want experiment with new Instrument settings (in the second block) it's hard to say whether I am modifying only this one block or modifying others as well? Especially after adding/removing some tracks/instruments. So is somewhere in GUI an information that I can check to find out in how many blocks instrument is used?



kjetil
Site Admin
Posts: 504
Joined: 20 Jul 2017 20:45

Re: How to check in how many blocks an instrument is used?

Post by kjetil » 24 Oct 2021 11:48

Hi,

There isn't a GUI for this. I guess that would be convenient though.

But here's small script you can use:
  • 1. Select Help -> Edit Keybindings
  • 2. Paste the following line into the keybindings:

    Code: Select all

    SHIFT_L F1: ra.evalScheme "(for-each (lambda (num instrument-id) (define used-blocks (list))  (for-each (lambda (blocknum) (for-each (lambda (tracknum) (if (and (equal? instrument-id (<ra> :get-instrument-for-track tracknum blocknum))(not (member blocknum used-blocks)))(push-back! used-blocks blocknum)))(iota (<ra> :get-num-tracks blocknum))))(iota (<ra> :get-num-blocks)))(ra:add-message (<-> num  (<ra> :get-instrument-name instrument-id) used-blocks)))(iota (length (<ra> :get-instruments)))(<ra> :get-instruments))"
    
  • 3. Press F5 to save and reload keybindings
  • 4. Close the keybindings windo
  • 5. Now you can press left shift + F1 to print the blocks each instrument is used in.

akimaze
Posts: 4
Joined: 15 Oct 2021 08:43
Location: Poland
Contact:

Re: How to check in how many blocks an instrument is used?

Post by akimaze » 24 Oct 2021 19:12

Hi,

I changed your script to make it work only with current selected instrument:

Code: Select all

SHIFT_L F3: ra.evalScheme "((lambda (instrument-id) (define used-blocks (list))  (for-each (lambda (blocknum) (for-each (lambda (tracknum) (if (and (equal? instrument-id (<ra> :get-instrument-for-track tracknum blocknum))(not (member blocknum used-blocks)))(push-back! used-blocks blocknum)))(iota (<ra> :get-num-tracks blocknum))))(iota (<ra> :get-num-blocks)))(ra:add-message (<-> instrument-id (<ra> :get-instrument-name instrument-id) used-blocks)))(<ra> :get-current-instrument))"
I'm not scheme programmer (I only read one tutorial today :) ) so I don't know how to show instrument-id before instrument name, instrument-id shows just "#" but it's work great :)

Thank you very much :)

Post Reply