Granular Synth: How do the Scrub Mode and Set Playhead Time nodes work?

Hello there!

First of all, kudos and praise to Aaron and Dan for their fantastic work on the new audio engine :slight_smile:

I am currently trying to get my head around the new granular synth component, as it might be a great tool for procecdural sound design.
One way to use the granular synth could be for scrubbing through sound files to change for instance the nature of a looped sound - I think there even was a short example of a water stream that was using the granular synth to scrub through a ramping up water sound depending on the strength of the stream in the GDC presentation.

So I am trying to build a system that uses the sample of a pass by of an engine which then can be scrubbed through forward and backward at various speeds and even halting the playhead at any position within the audio file resulting in a short looped section at the playhead’s position. This is a common feature in Granular instruments like the Mach5 VST sampler, and I am super excited to probably have a similar feature now within Unreal.

I could not find any documentation yet on the granular synth unfortunately, so I have to figure out the function of the various granular synth nodes simply by their names and their pins and values and by trial and error.
So far I have been able to simply play back a wav file (which is a 10 second recording of an engine pass by) by creating this setup in Blueprints:

Adding these nodes allows me to monitor the position of the playhead while it moves through the wav file during playback:

So far so good, when testing ingame I can see the position of the playhead then counting up and going back to 0 when it reaches the end of the wav and restarts playback.

Now I want to control the position of the playhead. To do this I insert the “Set Scrub Mode” node and tick its checkbox which seems to stop the playhead from moving through the sound, then I add the “Set Playhead Time” node and set the value for its position to 5 seconds, as this would be the middle of the wav file:

I would expect the granular synth now to play back a tiny section of the wav file at the 5 secs mark of the sound. But ingame I hear no sound at all, and the playback position seems to stay at the 0.0 position according to the debug displayed by the print screen setup in the second picture.
I hope this all makes sense :slight_smile:

So does anybody have an idea what I am doing wrong here?



Hi Felix,

It looks like you’ve set Lerp Time Sec to 1000 and your Seek Type to From Beginning, this means it would take 1000 seconds to interpolate from the beginning of the file to the 5 second mark.

Did you wait 1000 seconds before evaluating whether the Set Playhead Time was successful?

Hi Felix-
Good questions all around :). I’ll share my setup with how I created my granular demo (in this case dynamic water) for GDC to compare methods :).

First things though, is that Scrub Mode is (as I understand it) is for varispeed scrubbing (like a tape transport, going backwards and forwards with the option to alter playback rate/pitch). It’s not a granular scrubber; the granular player has this ability innately.
Also, looking at your Set Playhead Time, the In Position Sec is fine, but I see that your Lerp Time Sec is set to 1000 seconds. That means a Seek from the beginning (0 seconds) to your In Position Sec (5) will take 1000 seconds… quite a long time :). This might explain why your playhead isn’t ‘moving’, it may just be moving… very slow.
I also see your Grains per Second is 1000; this is pretty aggressive, and will result in more of a ‘wall of noise’ than an identifiable sound… consider orders of magnitude less.

That said, what you’re after should be possible. Here’s my setup that I used:
I’ve made a 12 second sound that goes from a water trickle up to a raging torrent of water (made in Reaper by crossfading content in 2 second chunks).

I’ve defined the variables like this:
Grain Duration: 600.0
Grain Attack Time: 20.0
Grain Relase Time: 400.0
Grains Per Second: 30.0
Grain Envelope Type: Hanning
Slider Value is a float I’m getting from an interface from another Blueprint (from a slider) that returns a value between 0 and 1.
BaseIntensity is just a remapping of the Slider Value float.

In my Event Tick setup, I’m remapping the BaseIntensity float to vary from 0 to 11, to correspond with 0 to 11 seconds of Playhead Time.
I’ve also introduced a plus or minus .5 second random position variance in the Playhead Time by adding a Random Float in Range.
I’ve also hard clamped the Playhead Time between 0 and 12 seconds, since that’s the length of the audio file.
(see granular_water_part1.jpg)

In the second half of my setup, I introduce Pitch, Volume, Pan, and Grains Per Second variability to make the audio sound more ‘alive’ and dynamic.
(see granular_water_part2.jpg)

The slider ingame moves the value of BaseIntensity from 0 to 1, and the Playback Time shifts around accordingly, even at a static position.


Here is a video of the slider moving the Playhead Time through the sound (and changing VFX with it):

Hi Dan, hey Zak,

Thanks a lot for the quick response and the clarification! This is a lot of useful insights you delivered, very appreciated.

D’ouh, that insane Lerp value that I put in there didn’t help of course. But even after setting it back to zero the result did not change.
So after looking at Zak’s posting and his set up I removed the “set scrub mode” node completely and also moved the “Set Playhead Time” and “Note On” node into the “Event Tick” controlled section of the blueprint. See pic “GranularSynth_fixed” below:

This did then indeed deliver the expected result, the playback was jumping to the 5 secs mark in the center of the wav file and playing back a short looped section. Funny thing is that I did not even have to add any randomisation math to the playhead position, it seems to slightly randomise already the playhead position then as you can see from the debug read out of the playhead position in the pic below:

Two more dumb questions then :slight_smile:
1.) The playhead position read outs above are matching a playhead position around the 5 sec mark - is it possibly displayed in samples instead of seconds? ( 5 secs ~240k samples @ 48kHz).

2.) Is the “Start Synth” node required at all, because I could not find it in the water stream blueprint and removing it from my set up had no negative effect as well?

Cheers and thanks a lot for the help!


Hi! By any chance would there be a link to this demo project? I´m finding wrapping my head around the granular synth a bit challenging without documentation. Or maybe you know of another useful resource. Thanks in advance:)

Forgive me, there is indeed documentation(sparse as it may be haha) now! Specifically what I would like to know is, how to map the playhead position to actions, like in your example. Any insight would be appreciated, until then I will continue my research:cool: