General
How can one object trigger MIDI notes assigned to another object?
Started by simspace on .
Sign in or create an account to join the conversation.
[size=150]
I have created this layout (Pads and a Multiball) where each red button on the right triggers a specific note when pressed.
[img]https://i.ibb.co/w0vZnb6/image.png[/img]
The problem I need to solve:
I need the ability to press and hold a pad's button, but not trigger that buttons note until I tap (or press and hold) the XY Pad Ball. That is, the XY Pad Ball needs to trigger the note on/off midi message for the selected note.
The buttons and XY pad should function like the MIDI controller seen in this video: https://youtu.be/vjKZ-hflbQA?t=12
For example, let's say pad number 10 is assigned the "C" note. What I need to do is:
I am a professional software engineer, but a newb to MIDI programming. I am learning how to script Lemur, but it's not clear to me how to capture MIDI data when an object is pressed and use that data in another object.
In case this helps, the red pad on the right is defined as follows.
[img]https://i.ibb.co/M1rv29m/image.png[/img]
[/size]
I have created this layout (Pads and a Multiball) where each red button on the right triggers a specific note when pressed.
[img]https://i.ibb.co/w0vZnb6/image.png[/img]
The problem I need to solve:
I need the ability to press and hold a pad's button, but not trigger that buttons note until I tap (or press and hold) the XY Pad Ball. That is, the XY Pad Ball needs to trigger the note on/off midi message for the selected note.
The buttons and XY pad should function like the MIDI controller seen in this video: https://youtu.be/vjKZ-hflbQA?t=12
For example, let's say pad number 10 is assigned the "C" note. What I need to do is:
- Select the note I want to trigger (in this case "C") by pressing and holding a pad (in this case "10").
- However the note for pad 10 should not be triggered yet, not until I press the XY Pad ball.
- Now, when I press and hold the XY Pad ball, that is when the selected note (pad 10) is triggered and sustained (sends note on).
- Now while pressing and holding the XY Pad ball, I can drag the ball around and change other midi parameters for the currently sustained note (in this case "C") (pad "10").
- When I release the XY Pad ball, the note turns off (sends note off).
- I can then repeat the process for a different note by pressing and holding another pad and then pressing, holding and dragging the XY Pad ball.
I am a professional software engineer, but a newb to MIDI programming. I am learning how to script Lemur, but it's not clear to me how to capture MIDI data when an object is pressed and use that data in another object.
In case this helps, the red pad on the right is defined as follows.
[img]https://i.ibb.co/M1rv29m/image.png[/img]
[/size]
You can check if a ball is touched/not touched by checking its
z expression. It's just an array, so z[finger].Thanks for the reply. That's a helpful start.midikinetics wrote: You can check if a ball is touched/not touched by checking itszexpression. It's just an array, soz[finger].
However, how do I get the ball to trigger a note that is assigned to another object ... in this case one of the numbered pad buttons being held down.
I think that's going to be the tricky part.
Check the Lemur User Guide, chapter 10.2., Script Execution.
You can define precisely when a script will be executed, similar to the Observer Pattern.
So just execute when
You can define precisely when a script will be executed, similar to the Observer Pattern.
So just execute when
x or y changes.[size=150]midikinetics wrote: Check the Lemur User Guide, chapter 10.2., Script Execution.
You can define precisely when a script will be executed, similar to the Observer Pattern.
So just execute whenxorychanges.
Thanks @midikinetics, this helped. I'm almost there!
My current challenge is that the noteout() method is not producing notes. I am using MidiMonitor and there are no midi messages being produced by noteout().
I defined expressions so that each note button will set an XYPad note variable to the selected note number (on press) and 0 (on release) as follows:
[img]https://i.ibb.co/f0VT6s2/image.png[/img]
[img]https://i.ibb.co/5K22yTp/image.png[/img]
My XYPad has an expression script that watches the XYPad.note variable:
[img]https://i.ibb.co/TRjGL6S/image.png[/img]
I see the note values changing in the monitor. But noteout() is not producing the notes. Even a when I hardcode note values such as noteout(0, 50, 127, 0); the method is not producing notes.
I did try midiout(0,{0x00, 0x50, 0x07F}); and that did work. MidiMonitor shows the message sent by midiout(). But since Lemur variables are only in Decimal format, I can't use the variables in the midiout() method. I am thinking about writing a method to convert the decimal values to hex and use midiout(), if that is possible in Lemur scripts.
Before I attempt that, do you have any ideas why the noteout() method is not working?
Once noteout() is working, I'll update the XY Pad Ball to trigger the selected sound using noteout().
[/size]
Looks like the channel argument, 0, is out of range.Even a when I hardcode note values such as noteout(0, 50, 127, 0); the method is not producing notes.
Strictly by historical convention, user-facing MIDI components represent channels from 1-16.
The helper functions
noteout & ctlout follow this convention too.Not sure how a MIDI command with status byte of 0x00 should even be received? That is out of MIDI spec.I did try midiout(0,{0x00, 0x50, 0x07F}); and that did work.
https://www.midi.org/specifications-old/item/table-1-summary-of-midi-message