Jump to content


Photo
- - - - -

Make Navigation keys (left, down, right, up) MIDI mappable


  • Please log in to reply
13 replies to this topic

#1 golfervrsboxer

golfervrsboxer

    New Member

  • Normal Members
  • Pip
  • 6 posts

Posted 07 July 2016 - 02:45

I have my MIDI controller set up in such a way that I use the actual computer keyboard as little as possible. One of the things that I seem to constantly come back to using the keyboard for is for the functionality of the arrow keys (left, down, right, up) to navigate in the pattern editor.

 

Since there is a lot of similar functionality already available in the MIDI mapping (such as next/previous column), would it also be possible to make it so that you can map keys on your midi controller to do these basic navigation functions?



#2 danoise

danoise

    Probably More God or Borg Than Human Member

  • Renoise Team
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6465 posts
  • Gender:Male
  • Location:Berlin
  • Interests:wildlife + urban trekking

Posted 07 July 2016 - 10:44

Control of the cursor would be possible to support via the GlobalMidiActions (scripting). 

Basically you would take a copy of the file - located in the preferences folder > Scripts (see Help > Show the Preferences folder), paste it into the Renoise application data folder ("%appdata%/Renoise/V3.1.0/Scripts" on my windows system) and then modify it to taste. 

I could create these mappings for you, or you could give it a shot yourself? 

If I were to create them, I would want it to be 1:1 with the _actual_ keyboard navigation, meaning that going down one line will eventually make the cursor appear at the top of the pattern - unless the continuous movement option was enabled, in which case it would head into the first line of the next pattern.
 

One of the things that I seem to constantly come back to using the keyboard for is for the functionality of the arrow keys (left, down, right, up) to navigate in the pattern editor.

Since you want this "hands-off" type navigation, perhaps there are other things that you miss in particular?


Edited by danoise, 07 July 2016 - 12:38.

Tracking with Stuff. API wishlist | Soundcloud


#3 golfervrsboxer

golfervrsboxer

    New Member

  • Normal Members
  • Pip
  • 6 posts

Posted 09 July 2016 - 03:54

Let me chew on this and get back to you. FWIW I have no real experience hacking on Renoise, so bear with me.


  • danoise likes this

#4 golfervrsboxer

golfervrsboxer

    New Member

  • Normal Members
  • Pip
  • 6 posts

Posted 13 July 2016 - 03:29

Hey danoise,

 

I'd actually really like to learn a little bit of this... it's a teach a man to fish versus a catch him a fish sort of thing. Is there anything you can help me to get started? Like documentation about the file formats or any kind of scripting stuff I should learn. I see Lua mentioned a lot in conjunction with Renoise. Always wanted to learn that...

 

Thanks.



#5 danoise

danoise

    Probably More God or Borg Than Human Member

  • Renoise Team
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6465 posts
  • Gender:Male
  • Location:Berlin
  • Interests:wildlife + urban trekking

Posted 13 July 2016 - 12:20

Navigation in the pattern editor is a perfectly reasonable thing to have built-in as MIDI mappings.

Renoise could (should) arrive with such mappings, ready-to-use. So, instead of learning to "angle with lua", let me just do it for you! 

 

But there are plenty of starting points for learning lua scripting in Renoise. 

 

Most importantly, how to configure Renoise for scripting is mentioned on our github page: 

https://github.com/renoise/xrnx

 

Once you have enabled the scripting console you can evaluate code directly from there - makes it really easy to paste a few lines in and see if it works or breaks, and to consult the documentation for the whole Renoise API. 

 

Also, this one about how to program with lua (difference from other languages):

http://forum.renoise...to-programming/

 

In this particular case, I am going to work on a special lua file which defines the Renoise MIDI mappings

https://github.com/r...MidiActions.lua

 

Editing this file is a bit special: if you change it you will have to hit the 'reload' button in the MIDI mapping dialog to apply the changes. 


  • golfervrsboxer likes this

Tracking with Stuff. API wishlist | Soundcloud


#6 golfervrsboxer

golfervrsboxer

    New Member

  • Normal Members
  • Pip
  • 6 posts

Posted 14 July 2016 - 18:39

Thanks a lot for your help. Is there some configuration file you created that I need to replace?

 

I'd like to look more into Lua scripting so I appreciate your guidance on that as well.



#7 danoise

danoise

    Probably More God or Borg Than Human Member

  • Renoise Team
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6465 posts
  • Gender:Male
  • Location:Berlin
  • Interests:wildlife + urban trekking

Posted 14 July 2016 - 20:25

OK, here are mappings for next/previous pattern-row that works exactly like the Renoise counterpart (including wrapped edit mode)

I also took time to add the "jump to quarter of pattern" which are so useful on the QWERTY (F9-F12) 

 

As for next/previous column - those mappings already exist, search for "column" in the MIDI-mappings dialog 

(they are as fine-grained as the Renoise API currently allows - no character-by-character navigation is possible yet)

 

Thanks a lot for your help. Is there some configuration file you created that I need to replace?

 

Yep, the file called GlobalMidiActions.lua. See my previous post where to find it. 

 

First, find this file and open it in a text editor (the Renoise scripting console can be used for this purpose). 

Then, to insert it a the right spot, search for a part with the text "-- Navigation" (without quotes), and paste the code below *before* that text 

Finally, save the document and hit the reload button in the MIDI mapping dialog  :)

-- Navigation:Pattern Rows

add_action("Navigation:Columns:Jump To First Quarter Row [Trigger]",
function(message)
  if message:is_trigger() then
    song().selected_line_index = 1
  end
end)

add_action("Navigation:Columns:Jump To Second Quarter Row [Trigger]",
function(message)
  if message:is_trigger() then
    song().selected_line_index = 1 + song().selected_pattern.number_of_lines/4*1
  end
end)

add_action("Navigation:Columns:Jump To Third Quarter Row [Trigger]",
function(message)
  if message:is_trigger() then
    song().selected_line_index = 1 + song().selected_pattern.number_of_lines/4*2
  end
end)

add_action("Navigation:Columns:Jump To Fourth Quarter Row [Trigger]",
function(message)
  if message:is_trigger() then
    song().selected_line_index = 1 + song().selected_pattern.number_of_lines/4*3
  end
end)

add_action("Navigation:Columns:Move To Next Pattern Row [Trigger]",
function(message)
  if message:is_trigger() then    
    local pattern = song().selected_pattern
    local line_idx = song().selected_line_index
    line_idx = math.min(pattern.number_of_lines,line_idx+1)
    local wrapped_edit = song().transport.wrapped_pattern_edit
    if (line_idx == song().selected_line_index) then
      local seq_length = #song().sequencer.pattern_sequence
      local new_seq_idx = song().selected_sequence_index  
      local new_line_idx = song().selected_line_index
      local last_pattern_in_song = (song().selected_sequence_index == seq_length)
      if last_pattern_in_song then
        if not wrapped_edit then
          new_line_idx = 1
        end
      else
        new_seq_idx = wrapped_edit and new_seq_idx + 1 or new_seq_idx
        song().selected_line_index = 1
      end
      song().selected_sequence_index = new_seq_idx
      song().selected_line_index = new_line_idx
    else
      song().selected_line_index = line_idx
    end
  end
end)

add_action("Navigation:Columns:Move To Previous Pattern Row [Trigger]",
function(message)
  if message:is_trigger() then
    local line_idx = song().selected_line_index
    line_idx = math.max(1,line_idx-1)
    local wrapped_edit = song().transport.wrapped_pattern_edit
    if (line_idx == song().selected_line_index) then
      local first_pattern_in_song = (song().selected_sequence_index == 1)
      local new_seq_idx = song().selected_sequence_index  
      local new_line_idx = song().selected_line_index
      if first_pattern_in_song then
        if not wrapped_edit then
          local pattern_idx = song().sequencer.pattern_sequence[song().selected_sequence_index]
          new_line_idx = song().patterns[pattern_idx].number_of_lines
        end
      else
        new_seq_idx = wrapped_edit and new_seq_idx - 1 or new_seq_idx
        local pattern_idx = song().sequencer.pattern_sequence[new_seq_idx]
        new_line_idx = song().patterns[pattern_idx].number_of_lines
      end
      song().selected_sequence_index = new_seq_idx
      song().selected_line_index = line_idx
    else
      song().selected_line_index = line_idx
    end
  end
end)


  • S(S) likes this

Tracking with Stuff. API wishlist | Soundcloud


#8 golfervrsboxer

golfervrsboxer

    New Member

  • Normal Members
  • Pip
  • 6 posts

Posted 20 July 2016 - 00:44

Hey,

 

Sorry I haven't been good at keeping up with this thread. I'm going to try this out now and I'll let you know how it goes. Also thanks for doing this and giving me the code. This is a cool example to see how Renoise can be extended. Thanks for all your help.

 

EDIT

Maybe I misunderstood you. I see on Github where you have GlobalMidiActions.lua, however in my Preferences folder under scripts I don't see an existing GlobalMidiActions.lua. I see what looks like things for Renoise plugins/extensions that I already installed. Am I supposed to just drop the modified file from Github in that Scripts directory, or is there somewhere else I should be looking for an existing file to modify?

 

 

 

EDIT 2

Sorry to spam the same post... tried it out and it worked like a charm!!! Thank you so much!!!!


Edited by golfervrsboxer, 20 July 2016 - 01:03.


#9 danoise

danoise

    Probably More God or Borg Than Human Member

  • Renoise Team
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6465 posts
  • Gender:Male
  • Location:Berlin
  • Interests:wildlife + urban trekking

Posted 20 July 2016 - 11:47

tried it out and it worked like a charm!!! Thank you so much!!!!

 

Great, that's good to hear.  


Tracking with Stuff. API wishlist | Soundcloud


#10 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1035 posts
  • Gender:Male
  • Location:Spain

Posted 27 November 2016 - 19:58

I include related code for jump into patterns (works fine in R3.1):

function tool_02_CH01_5B()--JUMP NEXT PATTERN
  local song = renoise.song()
  local pos = song.transport.playback_pos
  --print("pos.sequence:", pos.sequence)
  pos.sequence = pos.sequence + 1
  local seq_length = #song.sequencer.pattern_sequence
  --print("number of patterns:", seq_length)
  if (pos.sequence <= seq_length) then
    song.transport.playback_pos = pos
  end
end

function tool_02_CH01_6B()--JUMP PREVIOUS PATTERN
  local song = renoise.song()
  local pos = song.transport.playback_pos
  --print("pos.sequence:", pos.sequence)
  pos.sequence = pos.sequence - 1
  if (pos.sequence >= 1) then
    song.transport.playback_pos = pos
  end
end

function tool_02_CH01_7B()--JUMP NEXT 4 PATTERNS
  local song = renoise.song()
  local pos = song.transport.playback_pos
  --print("pos.sequence:", pos.sequence)
  pos.sequence = pos.sequence + 4
  local seq_length = #song.sequencer.pattern_sequence
  --print("number of patterns:", seq_length)
  if (pos.sequence <= seq_length) then
    song.transport.playback_pos = pos
  end
end

function tool_02_CH01_8B()--JUMP PREVIOUS 4 PATTERNS
  local song = renoise.song()
  local pos = song.transport.playback_pos
  --print("pos.sequence:", pos.sequence)
  pos.sequence = pos.sequence - 4
  if (pos.sequence >= 1) then
    song.transport.playback_pos = pos
  end
end

Also includes condition "If" with numbers to avoid mistakes...

 

Thanks for the code published in this post. It has served me for my tool.


:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#11 S(S)

S(S)

    Member

  • Normal Members
  • PipPip
  • 19 posts
  • Gender:Male
  • Location:London

Posted 11 July 2017 - 00:05

Hello everybody,

just like our fellow golfervrsboxer I was looking for a method to MIDI map a few functions and avoid moving my hands from my controller to my keyboard, back and forth.
Thanks to danoise I fixed half of my problem, but actually I need something more: I'd like to map the "INS" and "BACK" keys in order to insert and delete rows via MIDI.

Do you guys think it should be possible to implement?

Thanks, byebye  :walkman:



#12 danoise

danoise

    Probably More God or Borg Than Human Member

  • Renoise Team
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6465 posts
  • Gender:Male
  • Location:Berlin
  • Interests:wildlife + urban trekking

Posted 12 July 2017 - 15:34

Insert/delete row in column/track/pattern? 

 

Should be absolutely doable, but perhaps better as a standalone tool. We don't wanna bloat GlobalMidiActions too much  :)


Tracking with Stuff. API wishlist | Soundcloud


#13 S(S)

S(S)

    Member

  • Normal Members
  • PipPip
  • 19 posts
  • Gender:Male
  • Location:London

Posted 12 July 2017 - 19:17

Yes, actually I was thinking about inserting/deleting rows in a track!
Hopefully this is going to be the kickstart for someone to program the tool I need :)



#14 tornpaper

tornpaper

    Member

  • Normal Members
  • PipPip
  • 31 posts

Posted 20 July 2017 - 05:18

I wish a lot more things were midi mappable. The disk browser, effects browser ... a la Maschine, everything in the advanced pattern editor, etc. It would be cool to have an entire workflow through controllers. 


  • S(S) likes this