Trigger Audio Loop Player With Specific Midi Note
-
I've managed to get the step sequencer and pitch sequencer going now and a bunch of other controls. So far, so good there. I still can't work out how to trigger each player with a specific midi note yet though...
-
Still no joy yet. Can anyone help, please?
-
This is the closest I've got so far that kinda makes sense but it's still playing all of the midi notes, not just C1.
My audio loop player is named 'PlayerPad1'
In the players midi script processor, in the onInit I have:
const var PlayerPad1 = Synth.getAudioSampleProcessor("PlayerPad1");
...and in the onNoteOn I have this...
function onNoteOn() { if(Message.getNoteNumber() == 12) { var timeStamp = Message.getTimestamp(); PlayerPad1.play(timeStamp); Message.ignoreEvent(true); } }
...but it still plays when any note on the keyboard is played. For this player I'm hoping to only have C1 trigger the sample, and then the next player will be C#1 with midi note 13, and so on.
Can anybody tell me what I'm doing wrong?
-
@SteveRiggs said in Trigger Audio Loop Player With Specific Midi Note:
var timeStamp = Message.getTimestamp();
I'm not familiar with the loop player but change that
var
to alocal
.And if you want it to ignore notes then you need to use
Message.ignoreEvent(true);
for all the notes you want to ignore, not just C1. -
@d-healey Thanks man.
I've changed the 'var' to 'local' in the onInit of the midi processor for the audio loop player.
It's C1 that I'd like to trigger the audio loop player for this one and have every other note ignored if possible.
How do I go about referencing all of the other notes that I'd like ignored? Do I need to have a string with 0, 1, 2, up to 127 inside brackets somewhere, but just miss out the note number I want to use?
-
@SteveRiggs
You're over thinking itif(Message.getNoteNumber() == 12) { var timeStamp = Message.getTimestamp(); PlayerPad1.play(timeStamp); Message.ignoreEvent(true); } else Message.ignoreEvent(true);
Actually since you want to ignore all notes you could just put it outside of the if statement.
-
@d-healey said in Trigger Audio Loop Player With Specific Midi Note:
You're over thinking it
I had a feeling I would be
Thanks man. I've added that into the midi script processor but all the keys are still triggering it and I'm getting this error in the console...
Script Processor1:! Line 1, column 25: Call of getNoteNumber() outside of onNoteOn / onNoteOff callback {U2NyaXB0IFByb2Nlc3NvcjF8fDI0fDF8MjU=}
-
@SteveRiggs Post your on note callback
-
@d-healey I have it like this:
function onNoteOn() { if(Message.getNoteNumber() == 12) { var timeStamp = Message.getTimestamp(); PlayerPad1.play(timeStamp); Message.ignoreEvent(true); } else Message.ignoreEvent(true);
It's in the midi processor though. Not sure if thats correct now...
-
You're missing the closing
}
-
@d-healey Silly mistake!
I've added the last } in now. The console error is gone and it compiles but all the keys are still triggering the audio loop player
-
I don't see a play function for audio processor in the API help. You sure that's right?
-
I just built a little test project. I'm pretty sure this is all you need in the on note callback, and you don't need anything in on init.
if (!Message.getNoteNumber() == 12) Message.ignoreEvent(true);
-
@d-healey Weird man. Tried that as well but still all notes triggering.
I have a snippet here if it helps? The sample might not be loaded but any thing will work.
HiseSnippet 2800.3oc6aszcaabEdnkFaQYKYIa2WmSWftoGoSikHojrraZhAEeXxJRJXQ4Gsm1ZCALjDVfXP.AnDSZZT6oKx11Mca9KzUcYS+G3bxug1Mdi+GzNC.Hv.PPJHX4TIerVnilG267cuyL2WCjfAVB0qG1.jJ8dCzQfTWC1bflYmBcDUz.UKBRs.L6c3DDk4ZJ1UWEY.1ZftXudHYPpTS8.5rRkdZf8Ou99aIpJpIg76B.dLVQBUSoqhoeuB7aqnpVVTFsmRWlYuNeUIrVArJ1hfnofY.5hRGH1F0PjNsKAAotbIYESrQSSQSTOPpo2BKOnYG7gZNy+wJ8T1WEQajEzjvHmtKiUkoHl1KnPGEUYggRdO.HETvWOLkid3Vv5JxJd8ypOnCv4SAq9H0klD7xxBuLwGdoXf2zNvaQXSICEcS+QnX6pvpZlHiVhjs.VX4LWPp+Er.lLAMyU5Jd.prAogGAKkMWlLe.2lYxr7G1xRSxTAqwg0ZfMQ6nszxy9Yyld1OeVtvC0pUjiQWGCrJ47RjCS21MlDgKoY0cejwGv0WT0B4MQh7GTACGuBlc+WxQrYlHVqplh4N5Hswo1At5JxFvBtnhb7yzV8+8bU+4sjUvOQrOpE1nKPQld7HPeYA1B.6EBCQs1HB9MHaHvTd8TRSl1dy8uBnkhp6IdA3pOpGxn2pxcDMNfnlNnypEwRVcI3p2pN2H4porugnw.tkpS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5mTmvDRpfqzFYG5VC6OnhkVl6i9Htr4V1ddzeFNMk1ZXCTo9DmxKYZXgV9Cma1O+b1W6wrmMesGY.CUb9e+GdBH6j7kK1dsEmHlleWSJdmD8xhe2kL4TwKinSH1xq6fwq.yWoXyccgl8eWRqOwyfNJ3g65XMrdGrlhTv7HLMTZ2llDtOfiTJxaZRrtVvxne.iqEQRhCFoWmIOZO0Hosnx1cERvzivN+hS7Y7Ms5Y5m91w+4W8M+ycIVlD64ud+6+AeIIb37uNEZ8IGGcfOcsIcxfDlusPxYmt346ZLL+Pr5rib9FrWCZer3hfd85P2CrWHTryCcuKcdQ0NiCXm0K1VaX5GpqmLj8jA6i5g1yoztrV15SbCfBaxQYejZP6G.vvkzlG1tSr+3XOqrpblTLvotnULvj65aJgQ9NpuAT.qNvwmlyyo59E55+5piuJf.f+Ktx77pOzsA+Zq8s2O3QBN9GZIpFRWukhNVUzHV6CI2Czzw7vx22+Yj4t.Uta5NyEG79ifta5bTk8EGbOO7gmu.6IcMtRhtFe7q9lM7tF+7Vs9OgtF+ie+032eM98WiOyiY6ZvlJz2U5A9oC42wjuBWDoJF3J2SB9og7q3i3E6bBkSftCF9B6TeWeg8h1Y+a.sU4Wj.r8QhKN.dAnf34gCD6hsLUzZWWzzv96ji93ZXKCIja0To++ck5Rzhm4zNyvmxsIRS1tw+k7i6fYosS4NX1gC9NyZzUTx.+LImJMRu9OicODcql8qpmFVm1ly6+kAHLyJYne0gJOSRhl8ysyB.QSStDPyZIfl0S.Maj.ZtSBnYyDPycmHMzG2OukItqycLRGBkbRUOk2WXQpo.+O.c5jWBA
-
Sorry my fault.
if (Message.getNoteNumber() != 12) Message.ignoreEvent(true);
-
@d-healey said in Trigger Audio Loop Player With Specific Midi Note:
if (Message.getNoteNumber() != 12)
Message.ignoreEvent(true);No worries. All the notes are still triggering it though. Should that make just C1 trigger and all other notes be ignored?
-
This snippet is working for me
HiseSnippet 1004.3oc4W0saiSDEdllXVRDKhksWvkFIPJUBZhK6t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YNl9EkzeExEdadt31pWumSNccs8Tt+23lLM9+4MYtPkZvaBLhgMp1yDQ4Ve7BDA.xDoDDI1yA2wpDjOtWwQn9fLLavegOqlzyNltZRuhIuS9FQr.sZRPtjlsW9MyPv3Vlc2iV3OGgic8HYh0neN81uGdmfP9jf.a59i8Hj584fsvmOYK74QagOOdK74IagOe5V3ymcq9XuGyQoFUT9VQDX7friXnzatGJsA4uAzKcC3M
-
That's weird. That one works for me as well.
I just tried that with mine and it seems to stop working when the arpeggiator is turned on. Is there any way of getting around that?
-
@SteveRiggs Try changing the order of the scripts
-
@d-healey That's got it. Just moved the arp below and it works now. Spot on mate. Thanks!
I'm wondering now... if I add more players and have the same script but with different note numbers, am I going to run into any duplicate declaration problems?