How to Play an Audio Loop Player?
-
This post is deleted! -
This post is deleted! -
This post is deleted! -
-
//-------------- add this in the onNoteOn for the loop player function onNoteOn() { if (Message.getNoteNumber() != 81) Message.ignoreEvent(true); } //-------------------and then just a classic Synth.playNote for the play button const var YourAwesomeLoopPlayer = Synth.getAudioSampleProcessor("YourAwesomeLoopPlayer"); //--------------------------------------------------------------------------------------TEST SAMPLE 1 const var YourAwesomeButton = Content.getComponent("YourAwesomeButton"); inline function onYourAwesomeButtonControl(component, value) { if (value) Synth.playNote(81, 100); }; Content.getComponent("YourAwesomeButton").setControlCallback(onYourAwesomeButtonControl);
-
-
@clevername27 it depends on your set-up and goals but you can easily give every noisemaking module a similar onNoteOn as I wrote above, just give them each their own scriptProcesser. you can also assign playable ranges rather than just single notes, so Note 81 could trigger the audioloopplayer and the, for example SineWaveGenerator1 could have a playable range of 0-80 if you wanted. at least this how I have things set up, generally.
Here's an example of adding a range
function onNoteOn() { local note = Message.getNoteNumber(); if (note < 0 || note > 80) Message.ignoreEvent(true); }
-
@rglides Thank you - yes, I can add the that logic to Audio Player's Note-On function in its own Script Processor. I'm just confused as to how the note-on to the Audio Player (and not everything).
-
@clevername27 I'm confused by the question I think
- in the first example I gave,YourAwesomeButton should trigger note 81, which should trigger the AudioLoopPlayer.
When adding a sample to the AudioLoopPlayer, it doesn't populate a sampler so as long as you have a specific button and note assigned, it should work and shouldn't trigger on other note presses if you have the ignoreEvent
-
HiseSnippet 1312.3oc0W80aiTCD2aR1BIPOcG2gDOZp3gTopRBbbTQ0I5eRJJhl1ntkd7PkN4tqShU20dkWmzFN0OI7kgG4QDOyGBDeAfwd2jc21kdogVDrObWmwyL9mGO92LomT3RihDRjU0imDRQVuusyDtZ3tCILNpSKj0ir6RhTTINV0NSBIQQTOjkU4uQqvpZEj462+5cH9DtKMUEBchf4R2mEvToZ6s02x782i3QOlEjw5muUGWAeWguXDfmx1MPgD2yICnGPzlUxFYsTaOlRHcTDEMBrYGg2DmghK3w1eBKhclOUKzD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o1wFvERpYTk5JIzMey30W9+fySXeeMOwsMCwB0c8+A8TxUQVcJFcX5m+s4io9vgzfwO.NU8Ii7US0ludrqfKBGJ3L27rNJIav.pLK1K7.ssRALeoZd1VGQ8ojnLzaexV6CyuSjWm37A82HU380GYGCWrtFF+O4d6dgU4dYtfxy0bA263cwmQ39AJGIFof9scIPgptOFvL5.soco.R3b32yo6cURyDDK2XZqMGJ2yH7mvWxhM0xVIK1b5h+qrGADWo30twLm5Z420nAN2bSG9p1c0x3B9EIAPSvW65lOT2vwOaQc7yWTGe9h53WrnN9hE0wubQcbi2ti5YT1djRDD+jEg51qsoUjk0roBsJi9K.LW5UFA
-
The confusion might be that usually it's good practice to use
Synth.getAudioSampleProcessor, but in this case it seems to only work with Synth.getChildSynth -
@rglides Sorry if I'm not being clear, and I do appreciate you sticking with me on this. When I create a note-on, it's sent to every sound generator in the tree—so it triggers every sampler, every synth, etc. I just want to play the audio file.
-
@clevername27 Sure, like I said it, the way I've gotten around this is to give each module an SP with a defined range
-
@rglides I'm trying to grapple with the idea that an advanced audio API cannot simply play an audio file. Every time I hit a problem with HISE, people tell me it's an edge case. Apparently, playing an audio file is also an edge case.
-
@rglides
Synth.getChildSynth
got ya—that should work. Cheers. -
@clevername27 ikr! haha, although I've come to enjoy how tricky the simple things like a play button can get, learning a lot
-
@rglides Not to prolong this 🥹, but do you please know the syntax here? I was thinking that
getChildSynth
would return aSynth
object, but…maybe I'm missing something.I thought this might do it, but it doesn't seem to…
-
@clevername27 you can call it whatever you like but you still need to write Synth.playNote rather than apSynth.playNote
const var apSynth = Synth.getChildSynth("Audio Loop Player1"); const var Button1 = Content.getComponent("Button1"); reg EventId = 0; inline function onButton1Control(component, value) { if (value) { Synth.playNote(81, 100); } else { Synth.noteOffByEventId(EventId); } }; Content.getComponent("Button1").setControlCallback(onButton1Control);
-
@clevername27 All you need is
Synth.playNote
you don't need an object. -
@rglides I feel dumb, I added the EventId and yet not using it correctly. But still, this works for the player regardless