How to Play an Audio Loop Player?
-
@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
-
@clevername27 said in How to Play an Audio Loop Player?:
@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.
so what I do is set up a little script processor in each sampler/audio player that examines the midi channel of the note....then its simple logic to have one loop player allow Channel 16 (say), and the rest to ignore Channel 16 notes... then wherever I want to trigger the audio loop player _ I create a note and set its channel to 16....and only that player reacts to the note...
-
@Lindon It doesn't need to be that elaborate. If the MIDI processor is within the loop player's MIDI Processor chain then it will only affect that loop player.
Here is an example that has two buttons and two loop players.
HiseSnippet 1346.3oc6WstSiaDEdLIl13dQc6xO5O8tpZUnhRhCWiPUMPHoaTA1TBca+GZh8DxTFOik8jraZ09Hzmo1Gg9lz9FzdFegXuDxFBPkVofDHOy4bly2Lmaez1WXSBBD9HMiyF4QPZerdmQbY+58wTNp0gHsB5XlmjDHQGLxCGDPbPZZ49NkXsB4Qg+7Oe6AXFlaSFuEB8RA0lbD0kJGua6ZeOkwZhcHmQcSo8l0ZYK30ELw..J4zKi7v1WhufbBVo1R5nmiC5iz9J8J85ZWo2NarqUUqp6rYUKqs1s6lkqX6rU0M1X6Mb5UYW716BFsbCGpT32QhAzCG5AB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AicnpVtM3CIL3QJDieN7pzCOfIS1MaqfiEbgpmM0N6DAoO8hKH9ow9DuP6KkPg83cVo1oDFAGjJH9k0NBJvw9u8PsGz+AjIFu9B8H3ZpJfLuKws6kF52Kb1xMSb1t2w67ye69AJmJFHAtPGigDUUA7ICb6.TnrI.R3bBS0bSaIUann0kSXUzgvcBW7uvOwBsTq0hEZkHbd4KVYAew6DewJw7Eqby7E+CT9oxWTIeAew6.ewJK3Ktfu3B9hK3K5Qprfu3B9hK3KNC7E++vGtXaew41QMHU4xeX3Nv8lGx9pf9wp0lVWu0nKv+3ba6rG00Lrx7Z3FyqgaNuFt07Z31yqg6LuFt661PE8v8GHEtQkrHzwsaDNJSS6JF6Z4P+Gre0E3K
-
@Lindon Cheers, but…I'm using MIDI for playback…I don't see how I can my users,, "Works with any DAW, as long as you don't use MIDI channel 16." 🥲
-
@clevername27 Check my snippet
-
I appreciate it, @d-healey. Thank you for taking the time and creating a snippet. When I add that to my project, HISE hard-crashes because there was an LAF reference. I will simply remove the feature that allows customers to play audio files. It's OK.
🥲
-
C clevername27 has marked this topic as solved
-
@clevername27 said in How to Play an Audio Loop Player?:
When I add that to my project, HISE hard-crashes because there was an LAF reference
It's probably because it tried to embed my audio files, there was no laf in the snippet.
The principle is that if you put a midi processor within a sound generator's midi processor chain, any events you generate in that script will only affect that sound generator. This makes it easy to add play/stop buttons for samplers and audio loop players.
I'll fix up my snippet for you tomorrow.
-
@d-healey I didn't mean to imply it was your code—it was mine, in that I had assigned an LAF to a Component that no longer existed. And thank you, as always.