Jump to content


Photo

keyhandler: key.note (pressed) with released???

key.note key released key pressed

  • Please log in to reply
18 replies to this topic

#1 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

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

Posted 13 June 2017 - 22:21

I am experimenting with the keyhandler. From what I have seen:

 

key = {  
  name,        -- name of the key, like 'esc' or 'a' - always valid  
  modifiers,   -- modifier states. 'shift + control' - always valid  
  character,  -- character representation of the key or nil  
  note,           -- virtual keyboard piano key value (starting from 0) or nil  
  repeated,   -- true when the key is soft repeated (hold down)  
}
 
key.note has a range of values from 0 to 119, which equals the number of 10-octave notes. For example: 
 
key.note  == 0 is equivalent to pressing the Z key (usb keyboard) which represents the note C-0, in pressed mode. Is there any way to detect the released key?
 
something like that:
 
key = {  
  note_pressed
  note_released
}
It's strange that this does not work like this. Is there any way? The objective is to be able to execute another function when the key is released, after being pressed.

 


Edited by Raul (ulneiz), 13 July 2017 - 11:34.

: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

#2 danoise

danoise

    Probably More God or Borg Than Human Member

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

Posted 13 June 2017 - 23:04

 

It's strange that this does not work like this. Is there any way? 

 

 

It's true that you don't get a release event for keys, but you can sort-of achieve it by listening for the key-repeat. 

It's a workaround, perhaps even hackaround, but I'm using this approach to enable recording via the PC keyboard in my tool Noodletrap. 

https://github.com/r...TrapUI.lua#L128

 

If you look at that code, the logic is a bit complex, because I'm doing a full blown piano with voicing. 

If you're just looking to implement key sequences, that should be easier. 


Tracking with Stuff. API wishlist | Soundcloud


#3 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

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

Posted 14 June 2017 - 00:49

It's true that you don't get a release event for keys, but you can sort-of achieve it by listening for the key-repeat. 

It's a workaround, perhaps even hackaround, but I'm using this approach to enable recording via the PC keyboard in my tool Noodletrap. 

https://github.com/r...TrapUI.lua#L128

 

If you look at that code, the logic is a bit complex, because I'm doing a full blown piano with voicing. 

If you're just looking to implement key sequences, that should be easier. 

 

Thank Danoise!, but I can not make it work. I always put a simple example, which is to change the color of a button (id = "WMP_KEY_0"):

 

For press and release immediately the key:

 if ( key.note == 0 and not key.repeated ) then
   vb.views["WMP_KEY_0"].color = { 0x70,0x00,0x00 } --red
 end

For released key (change color button to green)???:

??????????????????
  vb.views["WMP_KEY_0"].color = { 0x00,0x70,0x00 } --green
end

I have tried several things with released and return, but I can not get it to work.

 

For example, this function return green color immediately after the red color, but it is not the expected behavior:

if ( key.note == 0 and not key.repeated ) then
  vb.views["WMP_KEY_0"].color = { 0x70,0x00,0x00 } --red
  return
  key   
end


if ( key.note == 0 and not key.repeated ) then
  ---
  local function released()
     if key.note == 0 then
      vb.views["WMP_KEY_0"].color = { 0x00,0x70,0x00 } --green
    end  
  end
  ---
  return
  released()
end

Must turn green when you release the button. How would it be?

 
 
 
 

...

 

Another detail I discovered. With "return key", the note sound; this detail did not know him. Then missing know how to repeat the sound of the note while the key is pressed. But this is a separate issue...


Edited by Raul (ulneiz), 14 June 2017 - 00:50.

: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

#4 danoise

danoise

    Probably More God or Borg Than Human Member

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

Posted 14 June 2017 - 11:41

You need to keep track of the pressed keys. Once a key is released, it will stop sending keyrepeats and you can conclude that it's been released. 

You'll need to poll the active keys as well, using an idle notifier - this is futher down in the script: 

https://github.com/r...rapUI.lua#L1676

 

My example actually contains a decent amount of comments. Not sure I can explain it any better here. 

But the essence is that you'll get something that emulates a keypress. It's not the real deal - the release happens slightly later. 

 

Obviously, it would be way better and simpler to add real key-releases to the Renoise API. This code is just here to fill in that gap. 


Tracking with Stuff. API wishlist | Soundcloud


#5 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

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

Posted 14 June 2017 - 23:45

You need to keep track of the pressed keys. Once a key is released, it will stop sending keyrepeats and you can conclude that it's been released. 

You'll need to poll the active keys as well, using an idle notifier - this is futher down in the script: 

https://github.com/r...rapUI.lua#L1676

 

My example actually contains a decent amount of comments. Not sure I can explain it any better here. 

But the essence is that you'll get something that emulates a keypress. It's not the real deal - the release happens slightly later. 

 

Obviously, it would be way better and simpler to add real key-releases to the Renoise API. This code is just here to fill in that gap. 

 

Thanks Danoise !

 

I do not quite understand how to trace the repetition, to execute a function after the repetition is over.

 

I have created a timer function to restore the color, but it does not obey the key.note released:

  --WMP: usb keyboard, keys, edit, sound and color
  for i = 0, 119 do
    local tb_cl = {}
    tb_cl.yl_1 = { 0,2,4,5,7,9,11, 12,14,16,17,19,21,23 }
    tb_cl.yl_2 = { 1,3,6,8,10, 13,15,18,20,22 }
    
    tb_cl.bl_1 = { 24,26,28,29,31,33,35, 36,38,40,41,43,45,47, 48,50,52,53,55,57,59 }
    tb_cl.bl_2 = { 25,27,30,32,34, 37,39,42,44,46, 49,51,54,56,58 }
    
    tb_cl.rd_1 = { 60,62,64,65,67,69,71, 72,74,76,77,79,81,83, 84,86,88,89,91,93,95 }
    tb_cl.rd_2 = { 61,63,66,68,70, 73,75,78,80,82, 85,87,90,92,94 }
    
    tb_cl.gy_1 = { 96,98,100,101,103,105,107, 108,110,112,113,115,117,119 }
    tb_cl.gy_2 = { 97,99,102,104,106, 109,111,114,116,118 }
  
    local function restore_color_piano()
      for k = 0, 21 do
        if tb_cl.yl_1[k] == i  then return { 0xFF,0xFF,0xBF } end
        if tb_cl.yl_2[k] == i  then return { 0x60,0x60,0x15 } end
        if tb_cl.bl_1[k] == i  then return { 0xCF,0xCF,0xFF } end
        if tb_cl.bl_2[k] == i  then return { 0x26,0x26,0x76 } end
        if tb_cl.rd_1[k] == i  then return { 0xFF,0xCF,0xCF } end
        if tb_cl.rd_2[k] == i  then return { 0x56,0x26,0x26 } end
        if tb_cl.gy_1[k] == i  then return { 0xCF,0xFF,0xCF } end
        if tb_cl.gy_2[k] == i  then return { 0x26,0x46,0x26 } end
      end
    end
  
    --timer for restart color
    local function key_timer()
      if ( renoise.tool():has_timer( key_timer ) ) then
        renoise.tool():remove_timer( key_timer )
        vb.views["WMP_KEY_"..i..""].color = restore_color_piano()
      else
        if not ( renoise.tool():has_timer( key_timer ) ) then
          renoise.tool():add_timer( key_timer, 500 )
        end
      end
    end
    
    --octave
    local function key_oct()
      return song.transport.octave
    end
    song.transport.octave_observable:add_notifier( key_oct )
    renoise.tool().app_new_document_observable:add_notifier( key_oct ) 
    
    if ( key.note == i ) then
      if not key.repeated then
        i = i + 12 * key_oct()
        vb.views["WMP_KEY_"..i..""].color = { 0xFF,0x00,0x00 } --red   
      key_timer()  
      end
     --
     return
     key --> sound piano (usb keyboard)
     --
    end
  end

With this at least the virtual piano work with sound, record the notes and mark the keys using the USB keyboard. I use 4 groups of colors on the piano, which complicates a bit, but the result is not entirely satisfactory.

 

Actually, I'm very surprised that the API does not have a note pressed and note released! Why is not it done like this?  One key is a two position switch. Again, add a strange patch to fix it because something is missing.

 

Is possible to add it to the next Renoise API? To use repeated here is a real mess. How can I make a formal request so that this theme is not forgotten?

 

Soon I would like to build a virtual piano compatible with the usb keyboard, mouse, and MIDI input, and that it was not necessary to add strange code. I get the feeling that some things have been incomplete in the Renoise API.

 

For key, instead of "note" and "repeated", It is not better "note_pressed" and "note_released" or similar?

  • key.note_pressed
  • key.note_released

In the end it is too complicated to build a simple custom virtual piano, for these details... It is a pity!


: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

#6 danoise

danoise

    Probably More God or Borg Than Human Member

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

Posted 15 June 2017 - 17:35

I think we both agree that the release event makes sense - no disagreement there.
And if you worry it will get overlooked, this what the API wishlist thread is for (see my signature).

I do not quite understand how to trace the repetition, to execute a function after the repetition is over.


There is a missing component to your example: you need to register the active keys and implement some kind of polling.
Or in other words: right now, you are responding to keys as they are triggered. For the release, you need to look for a key which is _no longer_ triggered.

This is how the tallying of live keys work in my example:

1. User presses (and holds) the first key. The note is triggered, and also registered as a "live note".
2. Shortly after, the key starts to send "repeated" events. Script says fine, key is still being held, and updates the "live note" with the current time.
3. Eventually, no more repeated events arrive. This is then detected by the idle loop ("live note triggered more than xxxx milliseconds ago") - and we can then release/forget the note.

Now...if this was all there was to it, we'd have a pretty simple, functional key-release detection scheme.
Unfortunately, it's more complex than that: once an additional key is struck (after step 2), the repeating of key #1 will stop and then, shortly after, key #2 will start firing repeated events.
So actually, along with release detection, achieving polyphony is the real challenge here.

I would simply try playing around with Noodletrap. Then you'll know how well it works in practice and you can decide for yourself if it's worth implementing in your own tool.

Tracking with Stuff. API wishlist | Soundcloud


#7 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

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

Posted 15 June 2017 - 19:26

I think we both agree that the release event makes sense - no disagreement there.
And if you worry it will get overlooked, this what the API wishlist thread is for (see my signature).


There is a missing component to your example: you need to register the active keys and implement some kind of polling.
Or in other words: right now, you are responding to keys as they are triggered. For the release, you need to look for a key which is _no longer_ triggered.

This is how the tallying of live keys work in my example:

1. User presses (and holds) the first key. The note is triggered, and also registered as a "live note".
2. Shortly after, the key starts to send "repeated" events. Script says fine, key is still being held, and updates the "live note" with the current time.
3. Eventually, no more repeated events arrive. This is then detected by the idle loop ("live note triggered more than xxxx milliseconds ago") - and we can then release/forget the note.

Now...if this was all there was to it, we'd have a pretty simple, functional key-release detection scheme.
Unfortunately, it's more complex than that: once an additional key is struck (after step 2), the repeating of key #1 will stop and then, shortly after, key #2 will start firing repeated events.
So actually, along with release detection, achieving polyphony is the real challenge here.

I would simply try playing around with Noodletrap. Then you'll know how well it works in practice and you can decide for yourself if it's worth implementing in your own tool.

 

I think I understand the concept. I have analyzed in parts what happens with note and repeated. As I see it:

 

In case of pressing and not releasing the key, 2 events occur:

  1. note is pressed with key.note, and note.repeated is false; equivalent to "note pressed".
  2. Then an event repeated several times: note.repeated is "true", until you release the key.
If key.repeated is not associated with the note (key.note) but obeys to any note, it can not function as an individual trigger for each note. In a virtual piano, each key has to work independently, just like a button (button.pressed, button.released).
 
It looks like you include an os.clock() for register that key.repeated is active, but I do not know if this would work for the more extreme case. The most extreme case is to simultaneously press up to 10 keys on the USB keyboard (there are USB keyboards that allow the simultaneous pressing of all keys).
 
Thanks for your annotations in your signature: Ability to detect when a key has been released (dialog keyhandler)
 
In future documentation I would ask for a very specific thing:
  • A direct relationship of three things:
  1. Improvements to better control button status, including access to the color of pressing of the renoise theme used. When we talk about a button, it involves control with the mouse. It would be nice if Renoise and the API would allow you to configure right click, middle button and left button.
  2. For USB keyboard, pressed and released (what's commented here), to be able to have individual control by key and avoid problems with keys simultaneously.
  3. The same for MIDI input. A simple way to register the keys pressed and released.

What I mean is that these 3 things should have a similar scheme in the documentation, so it is easy to do the same regardless of the peripheral used ( 1) button+mouse | 2) USB keyboard | 3) MIDI input keyboard/pad). In my journey as a novice, these issues are the ones that have given me the most complications.

 

On the other hand, there is the issue of controlling the sound. Using note.key and "return key", Renoise already reproduces the sound, even with pressed and released, does not need OSC Server. I do not know if it is possible to use a button + mouse to play sound with "return key", obeying button.pressed and button.released (using mouse). If it were possible it would be magnificent. The theme was to have total control of the sound without using OSC Server, so that the user can easily build a specific virtual piano or similar.

 

For example, it is possible to build a virtual USB keyboard that marks you musical notes by relating the letters of the keys. It would be possible to build very interesting tools if these problems were solved.

 

Joule commented that it is possible to build a practically complete pianoroll. The main problem is the interaction of the elements with the mouse pointer, such as drag and drop, and things like that. If there are things to improve on the API, they should follow this path.

 

Finally another request to improve the API:

  • Create a text field with horizontal / vertical scroll bar that can contain other elements, such as buttons, drop-down lists, etc. This is very necessary for the tools to be compact.

I believe that I can include my wish list in my signature, it is a good way to keep a list updated!  :)


: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

#8 4Tey

4Tey

    Chief Above Chief Member

  • Normal Members
  • PipPipPipPipPipPip
  • 384 posts
  • Gender:Male

Posted 18 June 2017 - 06:13

Right as Danoise says here Raul, no key release event.   So that makes it pretty damn difficult to get accurate 'key releases'.  Now if you want my quick two cents worth (not that this is worth all that much Raul) the absolute most easiest way I can think to get a very very crude kinda visual feedback on some buttons via the keyboard is to just to let the key handler set the color of a button, and let say a 30ms timer function keep clearing the color of the button.  Sure you won't like it Raul (and it probably isn't what you are looking for), and sure the buttons will 'flash' a bit, but at least it is relatively easy to implement.  We all very much agree here that there should be a key release event from the 'key handler' function.

 

You have an API wishlist Raul for ol' Taks, add key release event.  Maybe also add mouse handling events, OpenGL 'canvas' with complete drawing operations and maybe even some audio ( :huh: )


Edited by 4Tey, 07 July 2017 - 15:36.


#9 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

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

Posted 18 June 2017 - 10:14

Right as Danoise says here Raul, no key release event.   So that makes it pretty damn difficult to get accurate 'key releases'.  Now if you want my quick two cents worth (not that this is worth all that much Raul) the absolute most easiest way I can think to get a very very crude kinda visual feedback on some buttons via the keyboard is to just to let the key handler set the color of a button, and let say a 30ms timer function keep clearing the color of the button.  Sure you won't like it Raul (and it probably isn't what you are looking for), and sure the buttons will 'flash' a bit, but at least it is relatively easy to implement.  We all very much agree here that there should be a key release event from the 'key handler' function.

 

You have an API wishlist Raul for ol' Taks, add key release event.  Maybe also add mouse handling events, OpenGL 'canvas' with complete drawing operations and maybe even some audio ( :huh: )

 

Thanks 4Tey!  The flash effect does not look very good here. It's a shame ...  :(

 

Yesterday I solved this issue as follows:

 

Spoiler

This code I use in a file called keyhandler.lua, using require from main.lua...

 

I have only used a 300ms timer to retrieve the color of each key (button) of virtual piano. Maybe there is a way to be able to execute a function at the end of the key.repeated associating it before each key with key.note. Maybe, playing with the code using key.repeated, it is possible to do so. Danoise has tried to explain it with one of his tools, but I can not understand it. There must be some simple trick to return a function behind the last detected key.repeated.

 

To see the behavior, I use rprint(key). In the terminal it looks like this (for key.note = 0, key.character = Z). A example:

[character] =>  z
[modifiers] =>  
[name] =>  z
[note] =>  0
[repeated] =>  false
[character] =>  z
[modifiers] =>  
[name] =>  z
[note] =>  0
[repeated] =>  true
[character] =>  z
[modifiers] =>  
[name] =>  z
[note] =>  0
[repeated] =>  true
[character] =>  z
[modifiers] =>  
[name] =>  z
[note] =>  0
[repeated] =>  true
[character] =>  z
[modifiers] =>  
[name] =>  z
[note] =>  0
[repeated] =>  true
[character] =>  z
[modifiers] =>  
[name] =>  z
[note] =>  0
[repeated] =>  true
[character] =>  z
[modifiers] =>  
[name] =>  z
[note] =>  0
[repeated] =>  true
[character] =>  z
[modifiers] =>  
[name] =>  z
[note] =>  0
[repeated] =>  true
[character] =>  z
[modifiers] =>  
[name] =>  z
[note] =>  0
[repeated] =>  true
[character] =>  z
[modifiers] =>  
[name] =>  z
[note] =>  0
[repeated] =>  true
[character] =>  z
[modifiers] =>  
[name] =>  z
[note] =>  0
[repeated] =>  true
[character] =>  z
[modifiers] =>  
[name] =>  z
[note] =>  0
[repeated] =>  true
[character] =>  z
[modifiers] =>  
[name] =>  z
[note] =>  0
[repeated] =>  true

Cleaning up a bit this (and numbering):

  [character] =>  z
  [note] => 0
00[repeated] =>  false

01[repeated] =>  true
02[repeated] =>  true
03[repeated] =>  true
04[repeated] =>  true
05[repeated] =>  true
06[repeated] =>  true
07[repeated] =>  true
08[repeated] =>  true
09[repeated] =>  true
10[repeated] =>  true
11[repeated] =>  true
12[repeated] =>  true

Here are 13 events. How to join the last 12 events?

 

Analyzing this, [repeated] => false is equivalent to button.pressed. Ok! Is the 00 event...

 

Then, all repetitions [repeated] => true hould be used as a set to be able to launch a function at the end of the last [repeated] => true (after the number 12), emulating the equivalent of button.released. Is the 01 to 12 events...

 

To associate key.repeated with the key.note (number), maybe it's possible to use: if ( key.note == 0 and key.repeated == true ) then. Same for all other numbers.

 

Any ideas????

: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

#10 4Tey

4Tey

    Chief Above Chief Member

  • Normal Members
  • PipPipPipPipPipPip
  • 384 posts
  • Gender:Male

Posted 18 June 2017 - 11:30

Any ideas????

Yeps, I have a lot of ideas Raul (and I feel your pain.)  But none of them work smashing.  I'm sorry.  Maybe I'm not clever enough, maybe the danoise system of time stamping 'key on/key repeat' works great and after a certain time of not receiving key repeats you then assume the key is released.  But you'll still get a bit of 'lag' on the 'pseudo' release I would've thought.

 

Funnily enough Raul I had a similar problem back in the mid 90's.  I can't remember the exact thing but from what I can remember this was in the Windows95 MS-DOS era and I wanted to write a little platform game.  Reading the keyboard was similar to this, it was giving me key on/key repetition (under MS-DOS.)  Whereas I wanted (like you do for most game writing) just the raw direct keyboard 'key on/key released' state.  I.e. the keyboard is just a set of on/off switches.  Just to finish the story if I remember I eventually used Direct Input API under Windows95 :)



#11 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

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

Posted 18 June 2017 - 12:45

@4Tey
 
Nice story!  :D  I see that some of you have much experience with this programming language.
 
This topic is very interesting. You will see! If you use "return key"... the "key" contains the note playback (sound!), recording the note and volume in the pattern editor in the selected row, recording the note, volume and delay when the song is playing and follow the player position even record the note-OFF when the USB keyboard key is released. I think it is only necessary to insert a "step_length" to jump the lines when recording the notes, after releasing each key. Because of not having a "key.note_released", this is almost impossible to build. Note that using "return key" the note sounds, without the need to activate the OSC Server or create additional code for this purpose.
 
Therefore, the interesting thing is, if there was a key.note_pressed and a key.note_released, would be possible to trigger a "return key" through button.pressed and button.released. Which means it is possible to reproduce the sound of each note with the mouse, without having to use OSC Server for sound.
 
I think this topic needs a thorough review so we can access the sound without having to use OSC Server. Let's be frank. Having to resort to OSC Server to be able to play notes through a tool is somewhat ridiculous. The API should facilitate these things, so much so that it would be relatively easy even to build a complete pianoroll and here is the topic of sound reproduction of each note.
 
Finally, note the lack of consistency in some parts of the API. There should be a direct relationship between pressed and released to use any type of peripheral, be it USB keyboard, button + mouse or MIDI input. That is, use a similar scheme, in order to avoid having to create strange code and use tricks, such as those used by Danoise in their tools, and are not an "ideal solution" but rather a patch that emulates something, such time without precision.

: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

#12 EatMe

EatMe

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 894 posts
  • Gender:Male
  • Location:The Hague, The Netherlands
  • Interests:Fuße wirklich richtig schmutzig machen, mit kräftig anlegen von, logischerweise, ein Schlammpfütze.

Posted 22 June 2017 - 14:47

can you make an array

pressedstate[119]

fill it with [1]=on local time [1]=off local time

and generate a flower from the time signatures
* website: eatme.pro
* discography: eatme.pro/music
* all Renoise projectseatme.pro/music/projects
* soundcloud: /eatme 
* some samples: this free breakbeat and another free breakbeat 
* more infoeatme.pro/about - please mention www.eatme.pro with a broadcast or share

+1

#13 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

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

Posted 23 June 2017 - 09:41

can you make an array

pressedstate[119]

fill it with [1]=on local time [1]=off local time

and generate a flower from the time signatures

 

I'm sorry, but I do not quite understand what you mean! Maybe there is some way to chase the note.repeated with os.clock(), but I do not know how...


  • EatMe likes this

: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

#14 EatMe

EatMe

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 894 posts
  • Gender:Male
  • Location:The Hague, The Netherlands
  • Interests:Fuße wirklich richtig schmutzig machen, mit kräftig anlegen von, logischerweise, ein Schlammpfütze.

Posted 23 June 2017 - 16:09

On each occurance

 

check key pressed (0-119)

 

if key is pressed, change status of keypressed[0-119] to "ON" and optionally add the local time

 

if a key is not pressed, and the status of keypressed[0-119] is "ON" then you can set it to "OFF" and trigger the NoteOff repaint event


Edited by EatMe, 23 June 2017 - 16:18.

* website: eatme.pro
* discography: eatme.pro/music
* all Renoise projectseatme.pro/music/projects
* soundcloud: /eatme 
* some samples: this free breakbeat and another free breakbeat 
* more infoeatme.pro/about - please mention www.eatme.pro with a broadcast or share

+1

#15 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

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

Posted 23 June 2017 - 17:48

On each occurance

 

check key pressed (0-119)

 

if key is pressed, change status of keypressed[0-119] to "ON" and optionally add the local time

 

if a key is not pressed, and the status of keypressed[0-119] is "ON" then you can set it to "OFF" and trigger the NoteOff repaint event

 

I am working now, but I do not stop thinking about this idea.  ^_^

 

I think I understood the idea. Tonight, when I have some free time I will try to test the code, see if I can build it.


: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

#16 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

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

Posted 24 June 2017 - 01:28

On each occurance

 

check key pressed (0-119)

 

if key is pressed, change status of keypressed[0-119] to "ON" and optionally add the local time

 

if a key is not pressed, and the status of keypressed[0-119] is "ON" then you can set it to "OFF" and trigger the NoteOff repaint event

 

This does not seem possible. There are only 2 states:

  1. [repeated] =>  false  = not key.repeated (or key.repeated = false, is the same), equivalent to "key.pressed", (first event)
  2. [repeated] =>  true  = key.repeated (or key.repeated = true), the rest of repeated events.

With the second case, it is not possible to change the status of a local to ON (or TRUE), to obey in the last event. It will change status as many times as repeating events exist. I have tried to save an os.clock(), but os.clock() does not stop running. Therefore, I can not compare the number of an os.clock(), with a previous number of os.clock(), to launch a function at the end of the last repeated event.

 

The question is: calling a function "func()" when the last repeated event are finished:unsure:


  • EatMe likes this

: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

#17 4Tey

4Tey

    Chief Above Chief Member

  • Normal Members
  • PipPipPipPipPipPip
  • 384 posts
  • Gender:Male

Posted 24 June 2017 - 06:33

The question is: calling a function "func()" when the last repeated event are finished:unsure:

And the best answer is (for the 100000th time):  You want a key release event/flag from the Renoise API (which isn't supplied at the moment) to do a press/release (and with multiple held keys) 'button' piano keyboard more properly.  (Like for example as you see from the Renoise virtual keyboard in the sampler section.)

 

Shame really because I was kinda hoping to see some flowers from the time signatures :huh:

 

I wonder how ol' Taks is getting along with his 'video editor' <_<



#18 EatMe

EatMe

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 894 posts
  • Gender:Male
  • Location:The Hague, The Netherlands
  • Interests:Fuße wirklich richtig schmutzig machen, mit kräftig anlegen von, logischerweise, ein Schlammpfütze.

Posted 06 July 2017 - 02:39

This does not seem possible. There are only 2 states:

  1. [repeated] =>  false  = not key.repeated (or key.repeated = false, is the same), equivalent to "key.pressed", (first event)
  2. [repeated] =>  true  = key.repeated (or key.repeated = true), the rest of repeated events.

With the second case, it is not possible to change the status of a local to ON (or TRUE), to obey in the last event. It will change status as many times as repeating events exist. I have tried to save an os.clock(), but os.clock() does not stop running. Therefore, I can not compare the number of an os.clock(), with a previous number of os.clock(), to launch a function at the end of the last repeated event.

 

The question is: calling a function "func()" when the last repeated event are finished:unsure:

http://nodelua.org/d...ferences/timer/

 

A timer function can be called with nodeLua. I dunno if that works on Renoise.


Edited by EatMe, 06 July 2017 - 02:42.

* website: eatme.pro
* discography: eatme.pro/music
* all Renoise projectseatme.pro/music/projects
* soundcloud: /eatme 
* some samples: this free breakbeat and another free breakbeat 
* more infoeatme.pro/about - please mention www.eatme.pro with a broadcast or share

+1

#19 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

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

Posted 06 July 2017 - 12:15

http://nodelua.org/d...ferences/timer/

 

A timer function can be called with nodeLua. I dunno if that works on Renoise.

 

The Renoise API has its own timer which has the same behavior, acts as a retarder, a delay. Make X function after xx seconds. But the problem in this subject is that there is no way to determine the end of the last "key.repeated". If this matter were simple, someone would come here and say, this is done like this. But no. This issue is too complicated and if there is any trick it probably will not be very accurate or high performance.

 

It is frustrating not being able to complete tools because of these details.


: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