Is there a way to search within the song for notes of a given instrument number?

I found a very old thread asking for something similar but maybe some new feature has been added in the meantime that I can’t find.

I have this need: I have several of my old musics in mod and xrns format written long ago and I would like to re-arrange them, and I have a need to search instrument by instrument for the points where they are used within the song (sometimes there are instruments that are only used at one point).

I haven’t found a quick way to do this kind of search; I have to scroll through pattern by pattaern and track by track of the whole song to find a particular instrument.

I had assumed that in Renoise there was some sort of search within the song but it seems not.

Do you have any suggestions?

1 Like

As far as I know there is no such an instrument search like that. But in terms of your xrns just check the pattern matrix in case you’re only using one single instrument in each single track. Of course this won’t work if you’re using different instruments within one track. So it most likely won’t work with your MODs, too. I assume you’re using a lot of different instruments in each track of a MOD, just like anyone who created MODs.

You can maybe try this: PatternEditor Find And Replace | Renoise

4 Likes

Using Lua you can create a data analysis function (iteration) on the entire song. The steps to follow would be:

  1. Select the instrument in the instrument box.
  2. Select a position in the song from which you want to start analyzing. The function will sweep from that position down and to the right.
  3. The function will simply search for the first note whose instrument index matches the selected instrument in the instrument box.
local function find_instrument_in_song()
  local song=renoise.song()
  local sii=song.selected_instrument_index-1
  local type_seq=renoise.Track.TRACK_TYPE_SEQUENCER
  for s=1,#song.sequencer.pattern_sequence do
    for t=1,#song.tracks do
      local trk=song:track(t)
      if (trk.type==type_seq) then
        local pat=song:pattern(song.sequencer:pattern(s))
        local pat_trk=pat:track(t)
        if (not pat_trk.is_empty) then
          local vnc=song:track(t).visible_note_columns
          for l=1,pat.number_of_lines do
            local lne=pat_trk:line(l)
            if (not lne.is_empty) then
              for c=1,vnc do
                local clm=lne:note_column(c)
                if (not clm.is_empty) then
                  if (clm.instrument_value==sii) then
                    song.selected_sequence_index=s
                    song.selected_track_index=t
                    song.selected_line_index=l
                    song.selected_note_column_index=c
                    return print("sii",sii)
                  end
                end
              end
            end
          end
        end
      end
    end
  end
  print("none!")
end

This is a sketch that I have written on purpose to show. It would need to be adapted to be able to do continuous searches. But to start, this function locates the first note of the song for the selected instrument. In general it will be fast enough. It will be a little slower if the song has a lot of data and many patterns and tracks, of course.

Many of the things people ask for can be solved by Lua tools, that is, by functions that “return something.”

1 Like

Thank you for your response Drop_Shadow.
You are great; I tried this tool and it is perfect!!!
Importing the tool, Renoise warns me that it is not for the latest version but it seems to work fine.

1 Like

Thank you for your response Raul.
Very interesting about the use of Lua.
I am a developer so it could be useful for me for several things in Renoise.

Thank you for your response TNT.
Yes, you are absolutely right, I used different instruments for each track in my old MODs.
Anyway, I solved it by using the PatternEditor Find And Replace tool (suggested by Drop_Shadow) and it works great.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.