Polyphonie in Gen.

    Mar 02 2021 | 9:30 pm
    Does anyone know a way on how to get different voices in gen? I plan to build a VST-instrument using generated gen~ code and JUCE framework. This is why I can't use the poly object, but have to rebuild something similar in Gen.

    • Mar 03 2021 | 6:28 am
      Graham's reply in this thread might help: https://cycling74.com/forums/genexpr-parameter-variable-name
    • Mar 03 2021 | 1:25 pm
      Thanks for your help, but it's not what I was looking for. I don't want a gen~ patch running in a poly~ objet. I want to extract individual notes from a incoming midi-signal.
    • Mar 03 2021 | 3:34 pm
      the post has nothing to do with running anything in a poly~ object(not sure where you read that in Graham's post there). but anyways, best of luck.
    • Mar 03 2021 | 3:44 pm
      Perhaps you've already done this, but typing MIDI and gen~ into the search box in your Max app (or up above on this page) should at least give you a look at the dialogue and possible other persons who've asked the same question might have turned up (and you're not the first person to have asked). If this posting follows up on the act of doing this, I apologise; it was unclear that you'd done so already. The possibility that some answers might be found there was an opportunity it'd be good not to pass up. Good luck with your endeavours.
    • Mar 03 2021 | 8:12 pm
      Of course I did this. But couldn't find anything that worked for me.
      I tryed to use codebox. My goal is that it will output the note, vel and voicenumber.
      position = 1; existing = 0; voices = 4; if(start.peek(1) != voices){ for (i=1; i<(voices+1); i+= 1){ note.poke(128, i); start.poke(i, 1); }} // ------ Does the note exist? for (i=1; i<(voices+1); i += 1){ if (in1 == note.peek(i)){ position = i; existing = 1; break;} else {existing = 0;} } // ------- Note exists if (existing == 1){ // --- Note on if (in3 == 1){ note.poke(in1, position); vel.poke(in2, position); out1 = in1; out2 = in2; out3 = position; } // --- Note off else { note.poke(128, position); vel.poke(in2, position); out1 = in1; out2 = 0; out3 = position; } } // ------- Note is new else { for (i=1; i<(voices+1); i+=1){ //Note neu if (note.peek(i)==128){ note.poke(in1, i); vel.poke(in2, i); out1=in1; out2=in2; out3=i; break; } }}
    • Mar 03 2021 | 10:48 pm
      If you're looking for this particular kind of help with the patching you've done, I think you'll do better by selecting the portion of your patch you'd like us to look at, choosing "Copy Compressed" from the Edit menu, and pasting that in here from the clipboard. It's always better to see the whole patch. Were I in your position, I'd be using hmmm... say, a 4-channel data operator (where the channels would be something like note/velocity/duration (samples)/sample count (time) from the previous event) as a repository for your input and source for the output you want to mess with. Set the size of the data operator to some large number, and then you can always truncate the count you use to peek from the data operator to whatever number smaller than that that you need. You'd also have the opportunity to index the MIDI note events from any point, count in exotic ways, etc. Your mileage may vary, of course.
    • Mar 04 2021 | 3:10 am
    • Mar 04 2021 | 2:24 pm
      @gregory didn't knew about copy compressed
      So what I tryed to do was I have one data operator notes, which stores the notevalues. And one data Operator vel. Which stores the velocitys.
      Now if a new note comes in, the first thing is I look if that note is new or if it is already played and f.e. only the velocity of the note changed.
      Next step is if the note exists and it's a note on massage I'll set the new velocity and output note velocity and voice-number which equals its position in the data operator. If it's a note off massage it will set the velocity to 0 and output verlocity, note and voicenumber. Than it will set notevalue to 128 and velocity to 0 in the note and velocity data operators.
      Now if it was a new note it will look for the first empty voice (note value 128) and store the values in that position and than output the note, vel values and the voice number
      At least this is the idea and what it should do. However the reality is it does always output 1 as voicenumber.
    • Mar 04 2021 | 2:25 pm
      @testcase I was looking into that patch, but when I tryed it it did not work.