Sample Import Root Note
-
I am trying to create a way where users can manually set the root note of an imported sampled. I am using the custom import sample demo project but am looking to add in this function.
The idea would be to have a combo box or knob with note values and when one is selected it changes the root note of the imported sample.
I can't seem to figure out how to do this. Is this possible? Can anyone direct me on how to do this?
-
@kameron Do you mean with the Audio Loop Player? There's a parameter called RootNote to do that.
-
@kameron I haven't used this feature before so I can't attest to how it holds up for saving in presets and what it does to the original samplemap file, but my understanding is you need to use the Regex system
Here is a small snippet on how you would load it via a combobox but it would work the same with a knob:
const var Sampler1 = Synth.getSampler("Sampler1"); const var RootNoteComboBox = Content.addComboBox("RootNoteComboBox", 10, 10); const var notes = []; // Array of note names for a single octave const var noteNames = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"]; //Populate Combobox for (i = -2; i <= 8; i++) { for (n = 0; n < noteNames.length; n++) { notes.push(noteNames[n] + "::"+ i); } } RootNoteComboBox.set("items", notes.join("\n")); //Set the root note inline function onRootNoteComboBoxControl(component, value) { local comboValue = RootNoteComboBox.getValue(); for (s in Sampler1.createSelection(".")) { local R = (s.get(Sampler.Root)); s.set(Sampler.Root, comboValue); } Sampler1.setAttribute(Sampler.Root, comboValue); }; Content.getComponent("RootNoteComboBox").setControlCallback(onRootNoteComboBoxControl);
HiseSnippet 1819.3oc0X1saaaCEGWJIZs1qcnsnWraF.g6tvAIMUJ9Sjzh5DmOPvZRMhSKFPWQghLcLWkIMjnxR1PtaOP6QXOL6AnuAamygxwxNtYoYscaFnLhjG9i+4gebHaqHU.ONVEYYm6fSGvsrukS6Sk5dM64KjV6rgkcdm8UJ8dJM2Z8SG3GGy6XYaO61X814lyh98tmttenuLfOpHKqWpDA7mI5KziJsUiuSDFtkeG9Ah9YrtbicBTxlpPUBnkYcbsF3G7V+i364ilMiik8WrYGgVE0V6q4wV1ystpyos6o9Iow9WJhEGFxwLdVsAPlh2RE1AULVpUydhvNsFNlisrrcZMxCLqwCbemcEcDmW9HOwcnJXiZQV+g8LiKuYGSddYkm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Ji.Ji.JS.Ji.JS.Ji.JS.Ji.Ji.pP.pf.pP.pf.pf.pP.pf.pP.pf.pP.pf.pf.pR.ph.pR.ph.ph.pR.ph.pR.ph.pR.ph.ph.pQ.pg.pQ.pg.pg.pQ.pg.pQ.pg.pQ.pg.pg.pS.pi.pS.pi.pi.pS.pi.pS.pi.pS.pi.pakDyalDqU8w.l3lpYrt3UdfKao5fgSG+FX30NSq.NlZrq8f2YQFKzml8ZoeztV1UUh20okPGza5ZblonQ3DnOEZL8xr21Yytcg.liD3bNa88eZt4Z1t+aLc+8bZqgv18g6fkFCM8MECiy9w3ME6bkeSQqHdnxuSawOmwreuw5IfOJZ7R+sFTWsVeUhLSeMnQpx2mO.tNBLMmoM2rw96ucjJYvjs5cOkVTbPDDwGbEYq34RN3q0YGiMiTwwcggCwJNaUsRhNB8UiJYe9w7n3wKauj9v7sTxCw.y11PQuHliyuhfc8gK0bRVqodw8.eZNFdnEk2ah7KOQ9RSju7D4qLQ9pSju1n7FG5t9CvUF21YK+.Xw3osg6adgKYbiq1kL.Vs7gQeFKWWbz48iojwOIIiom69IIl4ElS4sZewmpmON2UaS3k+51+Gbr5Xu1M2PM1VfSUaJOF1tBkfZ7dvkv55mDpGV53GcrqRpFzSIEAiu4.VrezQ7nrZepCH3t9vdyQkb+F6COzvONyt6uswyf0j9Qium+CxW38A+x+oNe80NF4xvy6X+Sl29rtL6RCMN6UJz3Gc8d8CS9Y008UoALYPuGo+O977sbni3YXD4+sj59pDMDocXzNGHjXa3Z.A7rAFmAC1Zx6h4QA0lK6PY9S3WZkdCihhU5MrRqfgnfwV52zSJsmkKwPGzM9Bg3ygYWRGCW1.kDD46yhJ66GDodSf4cynVuIUBnRI8esZNmcw7LuIeiL7.UHd0aBBFG0EZ3xW2FV551vxW2FV451vpW2FV651v5+8MDuNwZIv6nLGlZYsaqMMK.s277EfyZ8W6aZTbB
**Edit: The nested for loops are bad procedure but if you are not using a combobox it won't matter anyways.