AllNotesOff and playnote



  • any one know why this doesnt work, or how to get it to work?

    function onNoteOn()
    {
    	Engine.allNotesOff();
    	Synth.playNote(Message.getNoteNumber(), Message.getVelocity());
    }
    

    I think it should play the note I just asked it to - but it doesnt...



  • @Lindon -- this works tho I dont have a g'teed value for samples - 1200 seems to work here whilst 900 ins intermittent and 500 doesnt work:

    function onNoteOn()
    {
    	Engine.allNotesOff();
    	Synth.addNoteOn(1, Message.getNoteNumber(), Message.getVelocity(), 1200);
    }
    


  • I think I asked about this before and if I remember correctly it's because notes are turned off or on until the end of the callback, although now I think about it that wouldn't quite explain the issue... @Christoph-Hart more info please 😄



  • @d-healey - yeah =- whats worse is that even with the "solution" above, synth.getNumPressedkeys() is broken - as it DOESNT return the number of pressed keys -

    if I add this to my note off...:

    function onNoteOff()
    {
        Console.print("PK:::" + Synth.getNumPressedKeys());
    }
    

    with the code above I think I should see a value of 1 being returned if I press and hold the key down - and I actually get a value of 0 (zero) which is just wrong...



  • @Lindon I've brought the numPressedKeys issue up before. In my opinion it should be a counter of the number of keys that are pressed but it's not. My solution is to add my own counter as a global variable.



  • @d-healey yeah but even that doesnt work in this case, the AlNotesOff seems to be firing EVERY note off callback - even ones further up the chain from it....massively frustrating...



  • @Lindon All notes off has a global effect, it's a sledgehammer approach to turning off notes. I try to avoid it.



  • @d-healey yeah I agree - but I'm trying to handle notes in the default arp script - and I dont seem to have a viable alternative...



  • @Lindon - except of course ------

    to handle NoteOff instructions in a graceful way I will need to make notes artificial.... and then the arp wont respond to them....sigh, this is never going to work.

    OK, look - this whole artificial notes, event id thing is not practical every time I want to do something realistic it breaks because of this...

    Here's my requirement:

    I want the arp to run in classic mode - I press and hold a series of notes and the arp plays them... - trivially simple

    I want the arp to run in latch mode - I press (and release) any number of notes and the arp continues to play them until I turn it off... - again trivially simple

    I want the arp to run in chained-latch mode where I press any number of notes (at the same time) and the arp plays them, however when I press a new set of notes (having taken my hands off the keyboard) the arp recognises this new group and stops playing grounp1 and starts playing group 2. -- impossible.

    In this last situation I need to collect the Event IDs of these "grouped" notes, look for no keys down (we've dealt with how this is broken, so instead I count and uncount key presses and execute my clean up when the pressedKeyz count == 1)

    So now only 1 key is being pressed , and I have a group of IDs of notes that are actually playing. So I need to end them - but to do this I need to ahve previously made them Artificial.... at which point the arp wont even play them...

    grrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr



  • I've not used the arp before but I'll give it a try now to see if I can find a solution.



  • For the chained latch I'm assuming that you can take your hands off the keyboard and the notes continue to play, is that correct?



  • @d-healey yes.. take your hands off it continues - and they end when you press a new note...



  • I figured out the problem! You're trying to get the arpeggiator to do something it can't do.

    If you take a look at the arpeggiator source code you can see it generates its own notes. When you turn notes off in your script these only affect the notes your script has generated, not the notes created by the arp script.

    Unless @Christoph-Hart has a solution, the only way to get it to do what you want that I can see is to write your own arpeggiator, then you'll have control over the notes it generates. The C++ code I linked to isn't that different from HISE script so it shouldn't be too difficult to take the relevant parts and put them together as your own chained-latching arp.



  • @d-healey said in AllNotesOff and playnote:

    I figured out the problem! You're trying to get the arpeggiator to do something it can't do.

    If you take a look at the arpeggiator source code you can see it generates its own notes. When you turn notes off in your script these only affect the notes your script has generated, not the notes created by the arp script.

    Unless @Christoph-Hart has a solution, the only way to get it to do what you want that I can see is to write your own arpeggiator, then you'll have control over the notes it generates. The C++ code I linked to isn't that different from HISE script so it shouldn't be too difficult to take the relevant parts and put them together as your own chained-latching arp.

    Yes.--- but no.

    I'm trying t treat the arpeggiator as a back box - I send it note on and note off messages and it plays note sequences accordingly.

    So under normal conditions - inbound note on and note off messages make the arp work (well huh..) normally.

    To make the arpeggiator "latch" all I do is defer the note off messages - issuing a AllNotesOff message when the user turns the arp on or off and when they change between these modes...

    To make it "chain latch" what I want to do is exactly the same as "latch" mode - i defer the note offs, but now, instead of a mode change, I want to use another note on (when note is the only note being pressed) to end the currently "held" notes.

    So i collect the playing notes' EventIDs in a simple array - and issue a NoteOffByEventId instruction. Which of course fails - because its not been made artificial - so i make them artificial and it all works fine - except now the arpeggiator wont recognise artificial notes....

    ..aaaaannnd we are back to the point about Artificial notes being what feels like a kludge - the usage and implementation breaks my required functionality...



  • @Lindon Yeah it will work with real on/offs because the arp uses these internally to generate its own notes. The only solution is to roll your own, or modify HISE to allow us to turn off real notes.


Log in to reply
 

27
Online

810
Users

3.0k
Topics

25.5k
Posts