Scriptnode: Granulator
-
@Matt_SF Do you have any idea how I use this to select the sample map within the Granulator?
-
@DanH I didn't try it but I guess this should work (thanks Christoph!) :
const var g = Synth.getAudioSampleProcessor("ScriptGranulator"); const var sMapSlot = g.getAudioFile(0); sMapSlot.loadFile("{PROJECT_FOLDER}MySampleMap.xml");
Don't forget to setup your granulator node so it uses an external slot :
For the loading of audio files, you can also take a look here, the process is similar :
Changing Impulses in Scriptnode. -
Nononono, the
{PROJECT_FOLDER}
wildcard only works if you use it to load a sample map into a sampler. For audio files slots it's different:You can basically load three things into an
AudioFile
slot and it tries to figure out what you throw at it based on the wildcard (or other things).- a single audio file. This is where you can use the
{PROJECT_FOLDER}
wildcard to reference the embedded audio files (or the project's AudioFiles folder). - a SFZ file. Then you need an absolute path with the file extension
.sfz
- a samplemap. Then you need the wildcard
{XYZ::SampleMap}
- like, literally:XYZ::SampleMap)
:)
The
XYZ
in this wildcard means a 3-dimensional mapping (Notenumber, velocity and RRGroup) and is used in the HISE codebase whenever an audio file loads a sampleset with multiple samples. - a single audio file. This is where you can use the
-
@Christoph-Hart haha, I just figured you had written a generic example .
-
@Christoph-Hart OK thanks for the clarification! I referred to the [documentation] (https://docs.hise.audio/working-with-hise/project-management/projects-folders/sample-maps.html) but it is indeed for the usage in a sampler
-
@Christoph-Hart Rather than a sample player, would you like to add a time stretch node with incoming audio process?
-
@Christoph-Hart ok so how do I load this into the actual granulator?
I tried this (cobbled together via the convolution thread) but I assume it's meant for audio files rather than sample maps... I get an 'object' loaded into the single sample window as opposed to anything in the sample map one. Do I need '.xml' at the end of the loadFile string by the way? I assumed not...
const var g1 = Synth.getAudioSampleProcessor("GRANULATOR1"); const var af = Engine.createAndRegisterAudioFile(0); af.loadFile("{XYZ::SampleMap}AAB303-PROTON"); inline function onComboBox1Control(component, value) { g1.setFile(af); }; Content.getComponent("ComboBox1").setControlCallback(onComboBox1Control);
Thanks! :) -
@DanH well, you pass in the object reference to g1, but I'm amazed that it actually worked and displays the object pointer :)
You need something like this in the control callback:
af.loadFile("{XYZ::SampleMap}" + component.getItemText());
-
@Christoph-Hart thanks :) Getting closer.
This loads the correct map into the Granulator Sample Map box on compile, and plays the correct map (combobox still shows 'no choices', I haven't populated it with anything).
const var g1 = Synth.getAudioSampleProcessor("GRANULATOR1"); inline function onGRANBOX1Control(component, value) { g1.setFile("{XYZ::SampleMap}AAB303-PROTON" + component.getItemText()); }; Content.getComponent("GRANBOX1").setControlCallback(onGRANBOX1Control);
This does not work (using the Engine.createAndRegister method...)
I get the error: '+' is not allowed on the Object type
const var g1 = Synth.getAudioSampleProcessor("GRANULATOR1"); const var af = Engine.createAndRegisterAudioFile(0); af.loadFile("{XYZ::SampleMap}AAB303-PROTON.xml"); inline function onGRANBOX1Control(component, value) { g1.setFile(af + component.getItemText()); }; Content.getComponent("GRANBOX1").setControlCallback(onGRANBOX1Control);
So then I tried the below, which populates the combo box with my sampleMaps, and loads the correct names into the Granulator's Single Sample window, but doesn't load the sample map into the Granulator.
const var g1 = Synth.getAudioSampleProcessor("GRANULATOR1"); var sampleMaps = Sampler.getSampleMapList(); GRANBOX1.set("items", ""); GRANBOX1.set("items", sampleMaps.join("\n")); inline function onGRANBOX1Control(component, value) { g1.setFile((sampleMaps[value-1])); }; Content.getComponent("GRANBOX1").setControlCallback(onGRANBOX1Control);
Am I on the wrong path?! Feels like I need a way to combine the {XYZ} string with the sampleMap array...
-
Stop passing the
af
object into the method!!! :)const var g1 = Synth.getAudioSampleProcessor("GRANULATOR1"); const var af = Engine.createAndRegisterAudioFile(0); inline function onGRANBOX1Control(component, value) { af.loadFile("{XYZ::SampleMap}" + component.getItemText()); }; Content.getComponent("GRANBOX1").setControlCallback(onGRANBOX1Control);
-
@Christoph-Hart I tried that first but it doesn't do anything. But I have managed to get it to work... Thanks so much for the help! :)
inline function onGRANBOX1Control(component, value) { g1.setFile("{XYZ::SampleMap}" + component.getItemText()); }; Content.getComponent("GRANBOX1").setControlCallback(onGRANBOX1Control);
EDIT - It's a bit crashy when switching maps in the combo box... Perhaps my method isn't right after all The maps do change, but it crashes randomly
EDIT 2: Some maps definitely make it crash actually... Any idea if there any some parameters in the sample maps that don't play nice with the Granulator? They're pretty basic maps. Looping on some, no rr's.
-
@Christoph-Hart so there were 6 maps that crashed HISE every time with the Granulator. This was the commit from yesterday.
Just tried commit from today and those maps are largely ok but others are now crashing which weren't before
Is my method correct or is it responsible for the crashing do you think?
-
@Christoph-Hart One other thing, does the Granulator let through the original signal? I have it in an fx chain and I can't get rid of the original signal coming from the sampler / synth.
Actually possibly it's the midi chain container?
EDIT - Wasn't using Math.clear properly
-
@DanH said in Scriptnode: Granulator:
@Christoph-Hart I tried that first but it doesn't do anything.
I take it back, it does do something and the crashing has gone :)
-
@Christoph-Hart pretty impressive! The spambots answer I meanβ¦
-
So I've got the Granulator working nicely in my project. I've just been playing with voice modes and the granulator seems to flip between notes when playing a chord - I've no idea what to expect really so I'm just asking if this is expected behaviour. I'd also like to use glide - would that be possible too?!
-
@Christoph-Hart So it was working, and then I had to move the Granulator Script FX to somewhere else in the chain and it stopped working, so I tested a minimal project and it doesn't seem to work there either.. Am I going mad?! Would really appreciate it if you could have a quick peek :)
HiseSnippet 2457.3oc6Z0saaibElxNzIVa11rK1BzaJ.gQuPAMxV+YK4cQwJJIJIVKQQPR4jzeP5DpQxbMEGARpD6tH.8xdYeD5iPeD1Go8hde6YlgTjTV1wwa1fcKhLfgNmYly7c9YlybN159DabP.wWH2tVWt.Kj6ghlW5EdV6yPNdBpcDx8oh8Lj0jrTLsjJKz5xEnf.7Dgb41tGcJ418dBrOe+W2B4h7rwIrDDNk3XiG3L2ILgqdySbbc6hlfsblmZ10ZpZS7ZSbIKA3rsXIgEH6yQyvZH5z1RTH2NJSbBI9lgnPbfPt60hL4RyyHu1iO+ScBbdoKlRTVvDDDmcWh6DJhobEZeli6D8X0NPPHmndhQXatQ3KDG5LwYE+DiwiXCHkrhz1ibakEdamAdkSCuRof2FfTtTPRjCoOSzz12YQXxHT77Ihpdg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vxwClzwLAMb3qI9mybTQeGzEtWYlOxiGI+hfoW.5.jxjF6l69hk1G9QP10k7Z5igchhpA2EimNw8x36g3sPBbdQPJNKOWI5iBrPNtzW4kaKM1cJhcQ1vddoNJ7LJLn8DDhSw9zFot5.05fKIjgZWoRJ9ILbqC.h4rWrS+KasMcbtNy2RpLeXJYJbEL3i2O0vua6F0.3huHt8aoBmSSIPuIX0i6G53cJuWf7LyWjhRPG4iliCwQYbiofywIKSj5jRsPQwx.M+cj5D35FpCKybERIHwrB5vLBpBLYyywulajnI3Ks+QUKcbkiqeTiRMNrV8iqy1o6yu2SHCDD1Ld2QrRV.eewFkJEA4OQrmO36YO1b07aT55k10q8zlaxus8ZU9akbdfnIbiCZxOXwzAGtzCutXR5MaV2clQXWtRofTGawigUCNkNpMxMVhv4rVDx4yQri42o1.eayy8KhpPQh2I5e5kH9ghr2QKQK64CI79Pbodb1KpqM56LOctswdzxFXkR6BE93l9cFAPUbTHAWT8AAkyQ19jWXyylRw5CXb.T5w9GOXWwgTZoU+oP3GHlCEJ7Baa5KUJB0cr40T4Nrlp2g0T6NrlCuCq4n6vZpeGVSiabMzZzjWFRlyywCLzU3AV4TVEXssv+C.f+OUs
-
@DanH You did manage to use the granulator as a FX ?
AFAIK the granulator produces sound - that's why it needs a sample or a sampleMap - but doesn't process incoming signals (or am I missing something ?), thus getting no granulated sound is expected.Into a scriptnode synth, the granulator works well :)
-
@Matt_SF yeah I'm using it as an FX at the moment, maybe I should do it as a synth instead. But as an FX it was working fine, I was able to load the same sample map as my sampler and blend the two sounds together. But then it stopped working, no idea why! Will try the synth
-
@Matt_SF yeah same behaviour with the scriptnode synth. Can you get a combo box to load sample maps in the granulator successfully?