Global velocity modulator issue
-
So this looks like a workaround, but it's actually quite OK:
HiseSnippet 1475.3oc6X0saaTDEdVmrkZWREEUg3xQUUhMzhqcn+jRUUShicIpMMgX2.2UMY2YsGxtyrc1YcwBws7fvy.uA7BvKA222.3Lytd20jEWiQspTvMJ0yYNmY9N+elbnT3RiiERjU8AShnHq22t+DtZTmQDFGs2tHqKZuOIVQk3TR6LIhDGS8PVVq7PMAq5qhLed4C1gDP3tzBRHzwBlK8wrPlpf5ga8HVPPOhGc.KrD22bq8bE7Nh.QBfmUraghHtmRFReBQyVMaj0455wTBYeEQQiQVqtivaR+QhWvS4+XVL6j.pdQaTe3fRI2SD3oQr96nNiXAdGNUuiQHK6CKrBqjZEtr89LOVN8BqwGX1.WHQY6gUs4Au1KI7pUBdqlBuKY22UxhTE6nw1Er2iCNJeB3BJCqTdQV+hMti.3fqZFRNk1SBKxkv4VsZccL7q0u2ZM7S3tJlfiE7mHTzC3Nq236aTuwOz.+m2x2ux8zWjTDDPkUts1wKmmfN7jvSnxqiGSBRn4LBVfYMwWXwLwto5cIFE783L0AQz70oZ5TJsP4JXYRE5UYpF0oB1JHU3iaWgOFk4W.usUlnflpL950x70CHZ8hAmw4sMeuMxXaJms4QTDjUW6atYyY+L9fq8769n61r6wta1oYSe0AW6ov+72bvWcKX83wG.L4eMMq2sigeD5o6sq93xfDfN.wQTohos6V6RGCY1ogi0s2kFepRDY3MLRv05h068JUfuCR9rtC.7I5uzC9xKXdpQ5E+nEBMhxFNRoW8avVQSMX64oy.LGwFcGCWkoNDpTZh87RSNqnkSVdRRnY6X80psoYYO0RpUj9DSUeoAaNajlvrVC7ZMffrXEDvJwopG994BLjpxMLNWIc6qjJ3MtA9owTLIUHsIGKN4aotJLCxGjdPkWk.6lFUfUiXwXklSruTDhIbgZDvRrAkXGXANDzIP3rD60KCLk47ueW9PFm1zURgrns4dGQGxz03ygfiQqRwYSI0G1RXnaNf+xRDfY.9.ZDnuXMTRQpINE6KjFZCYfgGOlFHbYpIMpC+OI.OFrVY2GHr4aGqEyYevyA8.zTONSFm00HnN7CbU8gpAzzCVq2fJCDzpuvPjp8x.mSOFv0o84NYl.3T2k5xNgFD2SH06zyb.NiM2w6rE7ZclBds++Bd+SK3ctEof2Tve0slTdQdgucqUtv2OaFX5LC..igH7RBHpYmMQG+lsADbMScMciddLj7Tdfs+FCrzpxAVpz2tfv8R1GxTtipFu0p.u5YgdMi2rw+VytquOTBt.rqZ26aV1Y8VNnbwTnbA69PcJyL4Ff7Ql03ulLlheHkSkZiZ64LV9utnikGsvikefqBt9ARBONRDSKGQ0mFxF.oCwkuMn+VOI84Go8xko2QPjUt0KePOPIqTl9DUhzDtrcnHgqlI7XkkZ96YyZJweECiu5a2uUvZQeqvksyG+YiosUq5QC09IKa7760O.dKwY5+R3dXIz6E7uXpoUKUVLQvmDm2+G3BBh3wzzyqXX.bQG5h1xPO5osqKOXfoitogs9Ll4jldMvAFoi1f5JNiweJt8F2oYqYk.zkcDhvqiiUItmhgIqn3u.FeptI6qYT.YhV8ctM7Poom6526svYDZ7ujYDl2bAKU232bcJWYwJ2+JRQqOEi8YgQAztbcXEPQiwODzJeRRfZJ0YKxuufKhFI3L2xU.OhpjrgCoxxXuREZakh3dZAkKu0Qz.Job07qt0igDPhDrSzkzVzdwsEyye8w1ovEqiovuaLgyJ+2bBmiDIJFe39DHPU+7e3818gAKbo.R3bnttdp2Z5JAoqak+NbJ2yr32gOYa1Vu1Jay1S27MxcDRbkhmk8rbcr74MT.8la9qUV2de8Zb9iVrsa0rEJDlH3YttZy8mA1mpkYikPlOeIj4lKgL2ZIj41KgL2YIjYy4JidXrsSThvzTQfvgcMsXrr5x0SkXh5Q+Ab3GWwH
So basically what happens is that I am using the event's
gain
property to communicate the velocity response of a script processor's table down the line (check how I used theEngine.createAndRegisterTableData()
call in order to make a scripted table accesible to the main interface so you can still defer it). Then in each target sound generator, I am fetching the gain value and calculate the respective velocity for it. As long as you never use the original events (which you don't if I understand this use case, you should be fine). -
@Christoph-Hart Thanks, I'll check out your example
-
Your example works, but I have another caveat :p
The way I'm mapping my samples is like this
I'm separating the guitar strings, rrs, and up/downs using velocity, and separating the dynamics across the playable range. So when I play my artificial notes I need to be able to control the note number and velocity regardless of what the user actually played. But I still need the real velocity to be passed to the gain mod. I thought the global modulator would take the real velocity, since it's before the scripts, and that's what I'd get at the gain target.
I know I could use another mapping system, like one group per string but that's going to end up with a lot of groups when I have lots of articulations and rrs.
-
I've solved half the problem with my recent velocity range of 1 modification. So now each sample is mapped to the correct MIDI note, as shown in the below image. But I still need control over the velocity because I have each velocity layer separated.
I'm not finding any way I can get the velocity gain modulator to respond to the incoming MIDI velocity if I set the artificial note's velocity.
This snippet is a simple strum script. When you press a key a timer will play through each note in an array, each at a fixed velocity of 60. If I enable to velocity modulator in the gain section I just get silence. I need it to be fixed at the velocity of the note that triggered the on note callback, how can I achieve this?
HiseSnippet 1257.3oc6XstaaTDEdW6rPsgT0BEDBDh4G7CGkfkWHzhHpjqNQVDmXEGBHUgplrdr8nNdlkYGGvBwSDOBHdG3QouAv4L6tdWmrIM0psDQYUTTlykY9NWmyjNZU.KJRocbqb7jPli6a60chzLb6gTtzo0NNt21qMMxvzjXRaMIjFEw5435VdOjfakEbbbH+9e7mquEUPkArDR1uST7.197QbSF0Na7sbgXWZO1w7Q4jd0MZEnjaqDpw.dJ60vIjF7D5.1ATTrRdNtuQydbiR20PMrHG2E1R0aR2gpeVFK+I7H9oBFtv2oKrQwj2UI5gHF+amsGxE85jZ2QNvl1IyKTN1KbOu17d7ozy7F2wxfjoQd+gaoqBd94gWiBgmeAvyIG5VHFc.HT8FKnlYQFFNRXvUyFoZIMLYD2LIya+z0+WEt20qC2DLrX7Vp.7BApW13MI3unWy98YAlLvtf2t+vq1H8shgxG5smPcJUj4.URCfJl1hqONgMYJexTA7urRU36uttkpgW6RU2xy5QJe4dj7klETNtv+IJGe2KDZhdgVQ9bzeyMGjeyXHW06DlPEfGOB12a5xL35+rg62EwNlZwSVVTK4YLsAUJ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healey I just tried moving your script in the interface proc and it seems to work so you might want to check that.
-
@ustk hmm I will investigate
-
@ustk It doesn't seem to work for me, the only difference is the velocity mod is now fixed at 60. What result do you get?
-
Ok I just tested this in Kontakt and the behaviour is the same - how did I not know this!
The standard solution would be to use the change volume function on each note based on the real velocity. But I'm wondering if I can find a solution using a scripted voice start modulator.
-
@d-healey Like this, the velocity is the one you set in the script.
What if you do that:HiseSnippet 1339.3oc6XstaaTDEdW6rPsKA0RKHDHDyO3GNJAq0PZKhnRtZGEQtXEmFPpppZx5w1ix5YVlcrAKDuI7Fvi.h2Aj3EouAv4L6tdW2rw03lfZUY+QTlybN698clyswMUROVXnTYYW5jQALK62wo0Hgt218nbg0d6XYunSnVMnOwqmT01ZqQAzvPVaKa6h6hpXWZAKKKxu86+w5aQ8oBOVrHyyoRtGaedetNUZyM9VtueCZa1I79Yzd0M1ySJ1V5KG.voniqU.06bZW1gTTsBNV1uU81bsT0RS0rPK6E1R1dTqdxeTDo+o7P9Y9LbQMqVvKJRbCoeaDwnTqs6w8a2Lg1gVvKsYpSnXjS3tNGvayGKO0YbKyFjTKx5OrKLM3UKK7bmc3YmAdKDAua6zxSwCzo6fX6lN6IzLUGJbDjEVQ5ZU3uJ3rsDzPnq1mdNqgBVL1hJ220cEx8bcWZsEKuXY3fHTSFRUDd6PxCI0Ec4BVUOECnF5B1mGpqf5lpoI.4DofgF7X3ss5JjG7DPEEqKQIk5CkZV7xgLeoGWOJdomb.Bj05LP3o4RAQJPkORTYox+b4RKVtzA.OgPgp7tBohUeHvhJPXICgv3MQZsoRy6v83TeC7PaMAzUC0x.LfSEIO9SR.r5hqS.HrN400kYjb3f9mkXUBtmTqSikFoSxmipzQeO2p0VZsx+RYxySuNch3W4Rw9WpuOtQnYmm2D7vSI88QrXrZxsi4Vj+h.O.ln9DA.0Dtsb5Qzii4+SLG2n5vAc0PfKT+ArJhUHQzHvmNBMEkjP9kPZhlD8232zxKOgTdGRkDe727vLAGU8Yht5dKUtDp1EOaxm0UDlSA.DH9FyeHkXxbNmKOmKaIAunDgLJJE6I35iBXhKKSzJN6A9uGs2NTMESNikA5EvfHODB16vFBU8hRUK4rCK7bfdPcuKjGCUSjsG3S0SVhAqqFuA3ClHWFyWEgvYPZYyms90RcmYEt21oIW60Ke7VHG7Bdsqa7FWEeQm5c5v7zofcAmFe+0eI6rP4FQP4ib10WdF0O0ABwM.pXQkt+j3sIi2mLVgZWVOW34Om0dtAybOW6hyrGI+drt40DagWo6wNqw524BGSg+6yNKNaH9ELIvaGAyxNI8dL.78GuLEh0dwP7QgrSnFLjFEsmXHTPCMJU1NLO9YLLHlMs74hyVHy0TMmhuYVy4X4.MWz8.pVw+InOHL0RKHo1iAHQHX9XuQ6BXWrn0t3ZzyzhIZaV72vS7l0v01waVKYyrz8cin6McZA0nLMwMj8CLqIeGcHirKCpdcwHvq8JXG4ogO+IJpHLPFNwKtEqO2LDRVgPzeCE6GNFijxJeaIUk6VOa8F.Iy0lVT8.kIjby93vOSDB95Uk0ql5TS8FK2IVZJhpk2MWr+UGxkbyfoNU87N97K2Dnkupl.MgoIRbsFSvrhR4UVoF5jiZohdMd.24tAicglW3G73VPIq9A9r5B79MfDDiuGvpNzA95DoSFXdfTHC5IEburI3GyfZuc6xTYwdtDZSsl5cdpj6twwLeFMawpOai8ghLT0jMauJ8E1y340G5DAWBFSQdk5hIwSW+wwykY5azBu38XZXXvmlL2lQAhQi4b.I7JMICFA0aQglLE7mmBRUDLSUCK6ZSah9uNuoz9+ondCYJp+K9F8odJ4S8hp4iI62vHA3sv7ioVx4.bMolkoaFXmiaUWq9v3AO0yCc2eN3ex2luXNr4KmCaVcNr4dygM2eNr4AygMe0TsAmLayAZY+nTQPPy5QUVrqKvxLlndq+A32ldOA
I'm sure you already know the "how to", so I imagine you have something in mind preventing you from using
getVelocity()
... -
@d-healey I don't know how to use the scripted modulators, would be cool...
-
so I imagine you have something in mind preventing you from using getVelocity()...
Yeah this is the problem. I need to be able to specify the velocity. Have a look at my screenshots above, I have mapped each string, rr, and up/down of the guitar to a different velocity.
The other solution is to use individual groups but then each articulations (assuming 3 dynamics) will need 24 groups, and if I have 10 articulations that's a lot of groups to manage. And I can do it with 1 group per articulation with the velocity method.
I'm going to play around with the script modulator and if that doesn't work I'll just use a
addVolumeFade
command. -
I think I've done it :)
I capture the real velocity in a global variable and then I pick it up in a script modulator to apply the gain change.
HiseSnippet 1277.3oc6X80aiSDD2NoF0DnmtiCgPfPrOvCop8BNkxUjpN5eSqhnoWTSuBRmPUas23rpN6ZVuNbQH9Dw67BhuC2Gk6a.L6Z6XmVSuzHt1d.VQQYmcl0+lY142ra5H3NjvPtvvrxwiBHFlumU2QLY+c5ioLiV6ZXdOq13PIQfhEs8n.bXHw0vzr79JAlUlyvv.8q+9erw1XeLygjHR+bBm5PNfNfJyj1Yyuk56uG1kbLcPNsWcyVNb1NbedDfmxV1FAXmywdjCwJ0JYYX9NMcoRtnqDKIgFlysM2cT297ehEq+IzP5Y9D0fFFcgEJV7dbeWEhURM1oO02sSpeGZ.KZmrnP43nvGX0l5RGKOKZbe8DnLKxGOLKcUvqQd3YO0vyHG5lKFc.H3tQ9X4jHSkNRlfxmLS0hIIrPpbTVz9UabqB2GX0gJc5WLdKU.dgD0aZ7lj7WvpYudDGYFXmyZuu+lMSOeLT9Xq884mg8yBfblDPEQnw0mlLMZ77nwJz3uqTEdd4zVpFL0kplkm5HRwkl1EUZN2sPo40.dlWdy9Cr55HnAxrYTX6gIRyP2jom3YMLeokWbB06zgDetCTArduHlip.AwYGxkjmxpsX0etZkLMPOA0FVSfnrtGQdRhzZKtd0eoJ5hV2qWr4WXN01FA22mHJbZU1WbUFViEM3LhXYzPreDYrhPXYx3d0oKtCat.B.YNE4rVLp7oAjDp9zfQpjFFicv7Jk4W4kpcmBTKSTAUm6DiI3WOq0tXIVk+SjA5EPDRpxCM2kLDJjh2MTwZWR34RdvTyK9vKURG91LSd4+axjeDORRYdswRA8EFlVGFMnKPU5P.jvXDe3EYYVRsoJdrsZrJxzkvb0C9S3IYxFpwlIS1Hcx7t68hc220pKv7qO+l1Y+P8Xz2gGRP6SfdBpD2Mbegm5HgW+wBLKLfGNwB2kLfdLmoh5YBeVHYOA4GORsSJu7c3XQgS8pM1CbxBsoKVFIzaI2Z.OhImXK3aW8qJOcv6FnGUoCKYA43PIP0KPT2Pn8SSlGjCp6HH.ZUd0AzPIz.ZgpYZ5zmKb0oavfmauLZ0kQq8CfJBhGRv4RE6cxPGU1hHJt02BUqj1ti5w3BRyg.EbMo.56.1WA9nKApGB7tIMtTxSVT3saqFl9Jmr6oRxg5VYwFktRXgLdorq23parlDKv99JwgZ4qOicaWnJBdf94P+.F.zTLuTVv74ItkJRFqNjRpGBmCP0HtFaYTrKD3iGoLUI4w1KpbNkxwemrFKszDRo8P0RCZeySxk.q6SXdx9KVshRsKGruidDA6+kbDg2n2z6ZP1Upyk92CtOzwYPfOoISc3TPhBuuO3g8vQ9xToSxqzly3A84LpSd94iHPqSOOhHueTnyskThcNOmsadDwmfy2q4y27.nlDKfXF4phK+ixxVXt6irhgKRs+Bcm515Vwv9SRZCna62UQ7M1Mzdvmk1lPq.RqQ1gUW406Ho2042rxSRj85pMT8yVLWxKzjDBBzEmk6FQnu.0Xk0paeQdljkfGbwU35w9dMoqle51ybYxoLON+cXF6DudJp6NLR++U.tctBvMw6X.1QvO0IdulhpadsDvuY5+V1JVsUiQMLzEJfcV10sMF.mB7TGGU39QP7oXaVYFr4KmAaVcFr4qlAad7LXyZyfMe8UZi5.3aEI4ChKEAAcZpq8MMaxvvNY8tdi+BDx2eVL
-
@d-healey Glad you found a solution mate ;)
So if I understand well this function returns the Gain (0-1 based) because the Voice Start Mod is in the Gain modulation...function onVoiceStart(voiceIndex) { return g_velocity / 127.0;}
-
-
Thought there was nothing in the doc yet... Wrong me...
-
I think it's probably better to use a midiList and record the velocity for each individual note, although this might be overkill
return g_velocity.getValue(Message.getNoteNumber()) / 127.0;
Although this won't work if you're offsetting note positions.