Make the Gain knob smooth the gain?
-
@CatABC You don't need to put the midi processors within each sampler. Just use one below the interface script. You don't need a loop in on note on.
Start really simple.
Make a practice project with only one sampler.
Every time you play a note the previous note is turned off.Once you have that working we can start getting more complicated.
-
@d-healey When I only use one Sampler, it can achieve that when the second note appears, the previous note will no longer sound, but when I add a second Sampler, it needs to be triggered at the same time with the KeySwitch below, which makes the script completely illogical and gives me a headache.
-
@CatABC said in Make the Gain knob smooth the gain?:
When I only use one Sampler, it can achieve that when the second note appears, the previous note will no longer sound
Share the snippet you have made for one sampler and we'll go from there.
-
@d-healey
This is my method using only one Sampler, I used artificial notesHiseSnippet 1352.3oc4Ws0aaTDEdVaOHrSnkhpP73REOjhJQdcb7EPQ04hcZTqaCYcaAwCUS1cV6QY8LK6NaRrphTE+R3m.Oxi7Sp+CfyryZ60tNEWqREB1Ghx41b9lybt4iCENznHQHxnTuQATjw5X6Qb4f8GPXbzQGfLVC+P5H6KXRmAn8FEPhhntHCi7GpTvnXATx2qu+dDeB2gNkEB8LAyg9H1PlbJ2ia8PlueGhKsGaXFsq15HGAeeguHF.SdbYT.w4LRe5iIJ0xgQOfDM.Y703sqrkSU25tUprcyZNjZzldDOOqsbqVsVilVa0jTsQMZ4sQFeTaWlTDZKIRZDxnvdB2Q1CDWv0N3YrH1o9TEgExF7rlcGguq5Jp3h1e.y283wQoHDx.e7zXVdcL613tLW1D9SiceZh.yoVjM.ZjaV3keF3YkEdky.uE.IiLPpfFR2Ba6DxBjSkneKOhKogdD3cJKTz5hx8JC79BPCtbygjyncBAhIVrQsxkumI7m69ckJUJj12jdNn4QtQl6X9MVJlvmWL2QxDbSA+wBI8I7MtaoWVpHyaiIZ+kJ0uaoh.6hIIaaxUZ54s2n1ZclnK3phWUrTwLdpKbcfzhD.tanj4wbXD+M.Mupj47d2yah6uN6L2YmIWjTPM28p3U.u4NcUXJT36SC0NXNwpb6EKI0vM3wCOkFdOyyI9wzIJBueylTfu9jhr4rN5WsLJJ3GwYxmDP4WWlL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nMm.Y7IUGn+Bn0aimN
-
@CatABC You can use
Message.getEventId()
to get the event ID if you don't want to make the note artificial.Now modify this script so that when you press a keyswitch key (whichever key you want), while another is held down already, it turns off the note that is held down and plays a new note of the one that was held.
For example, if you're holding down C3 and you play C0, you turn off C3. Then you play a new C3 note. - And you ignore the C0 note.
All of this in a single sampler, for now.
-
@d-healey
When I use Message.getEventId();, and play two different notes, the previous note does not close.And I don't know how to convert the events into notesfunction onNoteOn() { if(eventIds != -1) { Synth.noteOffByEventId(eventIds); } eventIds = Message.makeArtificial(); if (Message.getNoteNumber() == 36) { Message.ignoreEvent(true); Synth.playNote(60, 20); } } function onNoteOff() { if(Message.makeArtificial() == eventIds) { eventIds = -1; } if(Message.makeArtificial() == 0) { Engine.allNotesOff(); } }
-
This returns an event ID that you need to store, so that you can turn the note off when the key is lifted. Otherwise you'll get hanging notes.
Synth.playNote(60, 20);
@CatABC said in Make the Gain knob smooth the gain?:
if(Message.makeArtificial() == eventIds)
Here you should use
Message.getEventId()
instead ofmakeArtificial
@CatABC said in Make the Gain knob smooth the gain?:
if(Message.makeArtificial() == 0)
{
Engine.allNotesOff();
}What's this meant to do?
-
Synth.playNote(60, 20);
The 60 here should be the note that was pressed before,
Synth.playNote("eventIds's note", 20);
I can't stop the artificial notes
function onNoteOn() { if(eventIds != -1) { Synth.noteOffByEventId(eventIds); } eventIds = Message.getEventId(); if (Message.getNoteNumber() == 36) { Message.ignoreEvent(true); Synth.playNote(60, 20); } } function onNoteOff() { if(Message.getEventId() == eventIds || Message.getEventId() == Message.makeArtificial()) { eventIds = -1; } }
In this case, the D3 note cannot be turned off -
@CatABC said in Make the Gain knob smooth the gain?:
Synth.playNote(60, 20);
You need to store the ID of the note in a variable so that you can turn it off later.
@CatABC said in Make the Gain knob smooth the gain?:
Message.makeArtificial()
I think you're misunderstanding the purpose of this function.
-
@CatABC Here's a basic example using a sine-wave generator.
I've put everything in the interface script but in a real project it should be in a separate MIDI processor.
HiseSnippet 1122.3oc2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PfObgoZlkeKIUszi93qNACxkpSeJtFLos3vQxXgNWavF4qCatZit4mHxH+RtgcyOAW5+2yX0mvI+buKwYFF6yGEF.sEiw65PNFL9U39LeZbfdF27M1ckBY3PofyxV0u.zJ9fAfJK1WZ.cnViOebAmmcvEP.Py1A+sGbJ14QUXdBVybwC+MZKsd8b6T35ZlFc+u6F6M9+8F6KjwZtXPWJ1D9K3eJ.eHTebQICPuKDP.ZbaqBlkcozULzoaJEdID+A9Y5gUMzVSOr5rC+WwGinLk7crz2FY5S+rDNXbKR9uVN3e5CocqRRduT1Z4HbK26Xr7l5NJVacUbm0Uw5qqh6ttJ1XcU7Eqqh68Wqn4RnCi0xQoilDR2dsSdfokUaAE6xSlHH+IYKulm
-
@d-healey
I tested your snippet, but in this case the second C0 triggers the playing of C2 again, is it possible to not trigger the playing note when there is no note above? -
@CatABC said in Make the Gain knob smooth the gain?:
is it possible to not trigger the playing note when there is no note above?
Yes, this was just an example to get you started.
Synth.isKeyDown()
might help here. -
Have you messed with scriptnode fx at all? This seems like its pretty simple in scriptnodeFX. You can rig as many samplers as you need and trigger them with built in X-Fade nodes and so much more.... ??? Skim thru the documentation for the entire scriptnodeFX section and see all the stuff you have at your fingertips!
-
@CatABC for example....
wanna fade between 3 samplers that start at the same time?....different times? You can do that too...either way check this method out. The fader node has different fade modes, blend & switch modes.
-
@Chazrox This looks like a good choice. I tried it, but there is a problem. When KeySwitch is triggered, it requires the Fade knob to automatically and smoothly go from 0 to 1. How can I control it?
-
@d-healey This seems to be back to the HISE snippet I provided at the beginning
function onNoteOn() { local n = Message.getNoteNumber(); local v = Message.getVelocity(); Message.ignoreEvent(true); for (i = 0; i < 127; i++) { // turn off previous event local e = eventIds.getValue(i); if (e != -1) Synth.noteOffByEventId(e); //Synth.addVolumeFade(e, 2000, -90); // play new note if key is down if (Synth.isKeyDown(i)) { local newNote = Synth.addNoteOn(1, i, v, 0); eventIds.setValue(i, newNote); } } }
I don't know where to put Synth.addVolumeFade(); to make it succeed
-
@CatABC Don't use that snippet, use the one I gave you as a starting point.
-
@d-healey
I used something like this to prevent lastNote from being triggered when only ks is pressed. Now, I tried adding VolumeFade to the old events, but this doesn't seem to workfunction onNoteOn() { local n = Message.getNoteNumber(); if (n == ks) { if (Synth.getNumPressedKeys() > 1 && lastNote >= 0 && eventIds.getValue(lastNote) != -99) { //Synth.noteOffByEventId(eventIds.getValue(lastNote)); Synth.addVolumeFade(eventIds.getValue(lastNote), 2000, -99); eventIds.setValue(lastNote, Synth.playNote(lastNote, Message.getVelocity())); } return Message.ignoreEvent(true); } lastNote = n; eventIds.setValue(n, Message.makeArtificial()); }
-
@CatABC I was thinking more like this
HiseSnippet 1134.3oc2W01aZbDDdOfqpGoMpoJJpR8KWk5GfJWDXiIFEYE+FNEEiMx331uEsYu4fU9X2K6sGsnJ+er+Tx+f1YuiWtyl35fZpZJe.wL6L67ryKO6RekjAQQREwp7ESCAh0WXOXpPO5vQTtfz8Hh0Cs6QizfxMU0ASCoQQfGwxp3KLJrbJQR97tme.MfJXvRUDxkRNCNgOlqWps+dujGDbL0CtfONi0M2qKSJNTFHiQ7TztNIjxthNDNkZLqfM4mnQiHV+f81atEqo2S81bysa2hQaAs8o99M1xqYyV6ztwVsoM2oETeah0m0wiqkpAZpFhHVkNP5McvH4uJRCvk7H9aB.iPCx.LxopOVF3YNhFsjCGwC75OOQEQHV18Wl1Jll1drcOtGeg9kouuJYA2kdjMAZUHO7JlCdMxBu5Yf2JfjUFHUJEROxd.SwC0KWwfmGX2UfUSeJVmxBkTaIE91h1GJQKD5ZioWAGqPgEdToU85a3heU8YkKi0pHs6UQt65tYyExvDz0tdFscDC4BnFSA3oyjENgGoqftN2lZ9XePkercay1ofgtAXm1oRM7L+XASykBWovHelnR0x+dYm.IiF3Jv8tGdhvNiZCgDGNMd7a.kYucJ6v8cqf1rKhspkcP2RzrHnnKWRChgJyiVU2uaWWCJPKMV6jLATSXBru+AS6j54csCl.6bc4YgJ0edzKgoGg0xLlY18EaSzM2lMbS8LLfN0HmYgLm2KALMv0SqTECqiiInJPGqDKLhOTHUPBrqnUwfAcWaxLy2OLAJPc2FIhkQxT82Wo49bFmFTI8HV95xt2r136+gVbtchTjoFXJA26JfnZ5gKOtLcvJYPfIpFncikMzNqdkYNVQj.4MbmXBxBCwQq7yq1u+40rzIrzApLFJEcEb8Ygf38QxPlMEh+5UcOhpolg7Y5P6BArzXff0QvDjhMcj2w9HH5JsLDIYuEe.xDI8hCn57zSFR7YKf4fbbBl4dQD1pkkj+eLNq6KDejcetlMZ0XrvJvHlo9XfwYL8eocGeefoWBvR1G+Kebn0yF9GlF9GXO.IUSlORB9SRjc+Y5Dv8Ef.TljWi63Z5+39dMc389Z5yXZL7WnnhnPYTtMd.LlegTXxBKU9pH7dE3smaplY0enjpV4Ru64GiGxU5y.JR8kzVr+XYrPmqMn3cc6ei071+R+m61+OAF1y8.Em4Xb.ebX.zQLAuRC0Xv3WiTX9z3.8bs46k6IExvQRAmksPeNnU7gCAUVruxCz9ZM9lxkZd7dmCA.MaS62u2IXyFUg4IXMyEM9fer1JqWeicJbcMCfte5RRW7+2jzmKi0bwvdTrI72vGEfu2Y.xMx.L5BADXdnfUAC+VpbcibJ4nvKQ3OwOyVrgQ1Z1hMlu3+JwXLkojulk9DHSe5mmnAO2hj+.lC9OAQY2FjjmEksVNFY4dMikeqtkiattNt055Xy00wsWWGastN9z00wc96czbIz9wZ43zQSBoW+NIuozxpifhc4ISDj+R75.WQ
-
D d.healey referenced this topic
-
@d-healey Yes, it is indeed more logical to use isKeyDown,
I put the code into the MIDI processor of the two waveform generators, but now I can't control the fade-out of the sound of the previous generator and the fade-in of the sound of the next generator when the KeySwitch is triggered. I used MIDIMuter, but I found that this is the wrong way to do it. When I use two waveform generators, I need to ensure that only one generator makes a sound at a time. Once I use MIDIMuter, they either make no sound or the sound can't be stopped.HiseSnippet 1587.3oc6Y8tbSaDDWx1hAInzRKszOJX5GrYRShTbBICCC4eNPJXhm3Pnei4P5j8MQ9N2Sm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