Changing synth velocity with variable

I’m trying to switch between two variables for the velocity pin when a key is pressed - I want to start the note at 0, switch to 120 with the F key, and then go back to 0 with the F key again, while the timer is already playing, so that it’s in sync with another timer. Can’t get it working for some reason… I’ve attached an image of the blueprint

Here’s video - sound is bad but you can see what’s happening

Two synths set to timers that trigger when the player enters a trigger box - the first synth plays random notes from a C major scale, the second plays a single repeated C note. The second synth begins at velocity 0, then when F is pressed it should switch to 120, and vice versa.

So I’m trying to change the velocity variable of the second synth with a key press but it doesn’t work. It seems like the velocity variable is changing as I want it to, because the string is printing correctly but it’s not actually changing the audible volume of the synth. When I press F the velocity integer seems to be switching between 0 and 120 but I can’t hear the second note that’s on a timer

Any ideas?

Hi Donalf,

I’m not sure exactly what’s going wrong for you, but I just tested changing a velocity variable by setting it to arbitrary values (0 and 120) with keypress events, and Modular Synth responded as I’d expect. Are your two synths definitely independent of one another? Not sharing some var or event that’s causing a conflict? And are you certain that each synth is playing the notes you think it’s playing? It’s not completely clear to me which is doing what in your vid - maybe running up some distinctly different synth presets, and perhaps hard-panning each to left or right while you’re testing, will help troubleshoot that. Or just drop one an octave, maybe.

Hope you get it figured out - curious to hear either way!

Hi echolevel - thanks for your reply, I’ve been trying to get help with this on the unreal engine answers forum to no avail :slight_smile:

I’ve set up a simpler version - when the player enters a trigger box above the pink square, a timer starts the NoteOn through a custom event. If the Velocity variable is not connected and I enter a value manually, this works correctly - I can see the timer working and the note plays at 2 second intervals. When I connect the velocity variable the note appears to be playing (that is, the timer is looping and the string prints correctly, switching from 0 to 120 and back by pressing F) but I can’t hear anything… maybe could you post a shot of how you’ve implemented it?

Is it something to do with the default value of the variable? I see that if I set the default value as 120, it’ll play when the timer is triggered, pressing F doesn’t switch it to 0 though. I thought that entering 0 and 120 in the box of the two ‘set variables’ would work, but it seems that it’s always going to be the default value in the details panel. I’ve been messing around with the value range, and other options in the details panel, but that doesn’t seem to work.

yeah something is wrong, I just tried to make the simplest of demos and I also can’t change velocity of the synth after a note has been played. Its really simple to test, I will post to answerhub bug section but if anyone else would like to confirm it try this. Create a blueprint with a synth component and synth preset variable. Enable inputs and have a keypress assigned to the synth’s “Note On” function. Enter an arbitrary note, I used 60, and a high velocity (100). Create another kepress function and have it play another note but with a low velocity (30, so you can still hear it).

Now what happens when you trigger one of the keypress it will be correct the first note, but then try the other keypress with the different velocity, it will have the same volume as the first keypress. Try it again but reverse the order and you should hear that the first note is correct and the second note played will match the first note’s velocity and not its’ own.
Maybe I am missing something but seems like a bug.

synth velocity.JPG

[ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“data-tempid”:“temp_116366_1504745357214_474”}[/ATTACH] Here’s what I had to do to get elindell’s example working. It seems that, at least when triggering notes this way, either the synth’s output has to be killed or you have to wait until the release tail of the note is completely finished. In fact, I think on elindell’s example if you hit J and wait for the sum duration of the ADSR envelope, then hit K, you’ll get the new velocity (I could have misremembered that; started tweaking straight away, sorry!).

I hadn’t noticed this as a problem because my (now fairly complex/gnarly) synth BPs are managing NNAs - new note actions - pretty strictly, and the synthesised elements of my music system have mostly been using subtle velocity ranges and some LFO/Timeline-modulated oscillator gain levels, making this hard to spot.

Keen to hear how people get on, and what the official word is on it!

This has the same effect, of course, with less node-clutter. But “Kill All Notes”, while an admirably bold post-structuralist sentiment, is a touch brutal for everyday use in synthesis… You might get away with it on dirty big squarewave basses, but not on gentle pads.

We had a brief discussion about this and none of us can remember this working differently. Basically, when you’re in monosynth (when poly is turned off), it basically acts like a monosynth where your first velocity input is your velocity and doesn’t change until the voice is totally dead.

There could be improvements made to this functionality, maybe something like when Retrigger is on, the behavior updates the velocity levels or maybe it interpolates to the new velocity over the attack time or something.

It’s more a synth than a midi instrument, for sure.

For the time being, it’s probably just good to take note of this behavior, I’m not sure when we’ll have a chance to tackle this–that is, I’m not convinced it’s necessarily a bug.

Thanks elindell and echolevel for looking into it :slight_smile: And thanks Dan - I’ve got this working now, all it needed was to turn poly on! Yeah, I wouldn’t say it’s a bug at all, just a consequence of synth types. I’ll post a video when I get something more interesting done.