Scriptnode: Granulator
-
@Christoph-Hart How can we control the sample map selection in the granulator from the ui? I can't link a knob to the combo box in the granulator itself...
-
- Register it as external audio file
- Use the
loadFile()
method, but with the samplemap wildcard identifier:
const var af = Engine.registerAudioFile(0); af.loadFile("{XYZ::SampleMap}MySampleMap");
-
-
@DanH yes I just typed it out of my head...
-
@Christoph-Hart Forgive the noob questions on this, I'm coming into it very cold.
What does the XYZ::SampleMap part of the wildcard refer to?
Essentially I'd like to select the sample maps in the Granulator with a combo box
-
just set the sound record opening to outer, then, at that point, connect it to an Audio Waveform like you would do with a Looper or Convolution reverb.
Then make boundaries for the handles you need to control and associate it to your UI handle.
Thanks
-
@mrfurniture5e amazing....
-
WTF? When a spam robot starts to post working answers to a super specific problem you know the uprising isn't far.
-
@Christoph-Hart any chance of an actual answer to the question though?! :face_with_tears_of_joy:
-
@DanH isn't it simply :
af.loadFile("{PROJECT_FOLDER}MySampleMap.xml");
?
https://docs.hise.audio/working-with-hise/project-management/projects-folders/sample-maps.html -
@Matt_SF I hadn't tried it - I thought it was a different kind of wildcard :man_facepalming:
Thanks, will give it a go now :)
-
@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...