Announcement

Collapse
No announcement yet.

MIDI Note w/ Params and Note on/off

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MIDI Note w/ Params and Note on/off

    Hi!
    Thank you for making OSculator, I'm having a lot of fun with it.
    I have a pretty basic question that I could not find an answer to online.
    In the latest version of OSCulator, how do I send a note with params and also an on/off state so that the note will play continously?
    For example I have /note connected to /params which has pitch, velocity and voice.

    I was able to add an integer 1/0 variable to MIDI Note to get that effect, but adding 0/1 to a Note w/ Params doesn't do anything.
    Also I thought there might be a "Note Param" of the on/off but I couldn't' find such a thing.

    Thank you for your help,

    - Avner

  • #2
    Update: I think I've solved it!
    I'm not sure why, but once I swtiched to a different message address, it was suddently able to read the on/off integer.
    Like it was stuck on not using it in the original address

    Comment


    • #3
      Hi Anver!

      The Note Params event is used to store note informations until a MIDI Note w/ Params event gets triggered.
      When the MIDI Note w/ Params is triggered it uses the last received note parameters to play the desired note.

      Have you been able to look at the /note message argument in a Quick Look window?
      Otherwise, it could be that the type you used to do the triggering was not an integer or a float.

      Best,
      Cam

      Comment


      • #4
        Thank Camille!
        Here is my working Processing code for sending a chord with a specified length. Would be cool if you can review that I'm using OSCulator correctly.
        Usage example:

        Code:
        float[] chord = {0.3,0.4,0.45};
        sendChordWithLength("synthbass", chord, 1000);
        This gets sent to an arppeigator that plays the synth chord for 1000ms. (In fact it is being sent every heartbeat using a pulse sensor).

        Code:
        void sendChordWithLength(String message, float[] notes, int chordLength) {
            float velocity = 1.0;
            int on = 1;
            int off = 0;
        
            OscMessage paramsMsg = new OscMessage("/params");
            OscMessage noteMsg = new OscMessage("/" + message);
        
            OscBundle startBundle = new OscBundle();
            OscBundle stopBundle = new OscBundle();
        
        // Start
            for (int i = 0; i < notes.length; i++) {
                paramsMsg.clear();
                paramsMsg.setAddrPattern("/params" + i);
                paramsMsg.add(notes[i]);
                paramsMsg.add(velocity);
                paramsMsg.add(i);
                startBundle.add(paramsMsg);
                stopBundle.add(paramsMsg);
        
                noteMsg.clear();
                noteMsg.setAddrPattern("/" + message + "-" + i);
                noteMsg.add(on);
                startBundle.add(noteMsg);
        
                noteMsg.clear();
                noteMsg.setAddrPattern("/" + message + "-" + i);
                noteMsg.add(off);
                stopBundle.add(noteMsg);
            }
            stopBundle.setTimetag(stopBundle.now() + chordLength);
            oscP5.send(startBundle, myRemoteLocation);
            oscP5.send(stopBundle, myRemoteLocation);
        }
        Last edited by camille; 04-11-2014, 01:24 PM. Reason: Code formatting

        Comment


        • #5
          Hi Avnerus,

          This is interesting how you use bundles to set the duration of your chords.

          The only comment I would do is that you don't need to specify the note params with float values.
          In fact using float numbers make things very difficult to read and understand.

          Since you just want to make MIDI notes, what about using integers between 0 and 127?
          There is a trick though: if you want to make a OSC message that will hold the note params as integers between 0 and 127, you need to tell OSCulator the range of the message. This is done in the Scalings Page, and you have an example in the attached files.


          Best,
          Cam
          Attached Files

          Comment


          • #6
            Hi Camille,
            Thank you! I will check that out and move to using integers. *Also thanks for adding the [CODE], I wasn't sure how to do that
            Regarding the chord duration, would you usually do that with a Timer object? I'm not sure which way would produce the most accurate result.

            Thanks,
            Avner

            Comment


            • #7
              I don't know if using a Processing Timer would make a significant difference in the actual result (because I don't know how they are implemented, so I assume they are not bad). However, I think it would help making the code easier to read, as you could get rid of the bundles.

              Comment


              • #8
                I see! But I also use the bundle to package the Note Params message with the MIDI Note message. Wouldn't that be better than sending them serially?

                Comment


                • #9
                  It makes no difference because messages are sent locally. Even if you sent those messages on the network chances are your network adapter would send a bunch of UDP packets in the same Ethernet frame and thus it would make no difference again. Go for the simplest code, make it work, then make it beautiful, and only then, make it fast.

                  Comment


                  • #10
                    Got it. Thanks
                    I'm actually doing it on the (local) network and it seems to work well for now.
                    Now I'm looking at ways to generate matching chords on random scale using pitch class sets (Seems it may be easiest to prepare a static 2D map for each scale?) , but that's topic for anothe thread.
                    Thanks for all of the help!

                    Comment

                    Working...
                    X