AudioLoopPlayer: how to fetch loopstart and loopend



  • and one more...! 😉 when i have an AudioLoopPlayer added to my chain, i can load new loops into it as well as editing the start and end of the loop with the AudioWaveform directly via the main interface. now i want to get the sampleaccurate position of loopstart and loopend, but there seems to be no method for it. when i change these values with the AudioWaveform, the info panel in the upper right corner of HISE shows me the actual sample for loopstart and loop end, so there must be a way to fetch these values, no?
    1.png



  • @Christoph-Hart said in How can I create an interface for Start-/EndLoop of Audio Loop Player?:

    There are two ways:

    1. Create a AudioWaveform, connect it to the looper module and drag the sample edges to set the range.
    2. Create a AudioSampleProcessor reference to a looper using Synth.getAudioSampleProcessor("LooperID") and use its method setSampleRange(startSample, endSample).

    Check this example (you need to load an audio file in the looper to see how it works):

    HiseSnippet 1212.3oc4V0zaaTDFdV6rkZCthJJRbbUDGbPoQ1k1Rj.DNwIAYQRZT1PnmZ0jcGaOJyNypYGmVSUk3X+Cv+KNvYtf5Qj3Bmg2Ylc8tKdyGNT.IXOsyLue7LOy6WGHEAjjDgD4z3nowDjy635OkqF2eLlxQC1B4bK28vIJhzyt0lSiwIIjPjiS8uTugSikPlue8K1Dyv7.R9VHzwBZ.YWZDUkuabuuhxX6fCIGQiJH886MHPv6KXhI.dp61AEiCNEOhrOVKVMWji61gTkP5qvJRBxYoMEgS8GKdF2J+wzD5ILhdQWjOXH616HXgZDq+G0eLkEdP18NAAF8fbVntkEti6dzP5r8yYi20bfWtFE4CmZWD75dMgmSA3sjEd210OPRiU4mnw1a6NfCOTCwvSPQXYkEU6mp41W.RvUqEgOkriDVLSi1OrSmU8dPmNq7osZ1pI7Pjn7NCK81UHhgW+O2yDWr1HhZiIgTgONJlQlAf1KakaYs51eWKgnrRcHlOhzFL+5qeu4cv17Pv5YHCreeQTrfCKZuLblwh4RCbqTctxaNEz3IOQ6CJmQ4DugS3AJpf6I3f8zJJEr1AYZsJXW1DxJsZ9hVMaTM1M1U6qi0h1dkLc.n8Ry04Bfu1VoNsOlwNAhoaWDIV9XdrZ740BsFIVUSrEf7kg0TpqZzVDKZCU.l6KTjGwauRyWzrQyWN2ICGV0QolhQjUcptrf7BTqMeRzIDYFUjJGjcTN86FWszu.KcTPPAe.mpdTLIccdBZ2JRPQo7IjpVOEffuUlD02OMQ0jx7M3yHCExHDMTWHozdcQl6RwRmR8aog3gRTNy1AdU0qe0icPCor7ZinY9tt022J029LZHQZb5a4Zs2b95pnrqq10kT86d0u0C80C1Bqv5BUoDAPNPPohpeCb1hbFzAvV1pg6VjjSUhXCSkF4AnZg4pmqYfOB.vT8O2U2SI6AY.H+Mcs4EnmQCUi0h7i.+MlPGM1vkSs23Y.3FWJgYb3mk4veF9AZIF6S+VhlW5tVGTD944rxq6gl+9ctTpw3sbRM9uTkwKzm86ecuR9BdAluAAzlRDNggUk6coaXmd.jPUpIgtQ.OgplVrg9BzPqSkMzpLe4JB2a6d.UELtZ7VqB7Bgf+ci2zwCZ4t8vgj.UNXWxcmGecmE35Ak2KCJlbiz.dMTlE8e9ip8Cu4GUClNH.dpHECeLueGIgVHT9nhtRCvs4X39GVb6CEBktoQ9dGzy1WyjEBlujzjyHxjxVXmhUDMYM1JmlLFaQSF36RUUYFvDlszo90ZHtxoVEjuhI5V5egANeyme9WubR8qFbujYhajgQepNTYa9YDFD+mVCYKxP7DlZ1tEA4dBtHdrfSCJGWojzQiHxhPux6yFJEDamuyc5cHgQvIEBf+vd6Bi0gk+4TiEfJ5d0ohK545Cbsv0SmI68eit.0++YWfCESTPE08vPfptt19Sh7gBwAD.IbNgknqkUSOiiccmrZa9DdnYwuCeoG1Uu1I8vtYG9OhOhvARwSCridpikuoYG3dyM0va3tmds2rgi0bSDTN7oAAZx9tcQnp03dKrFe7Bqw8WXMdvBqwCWXM9jEVi0u.Mz8d1XhRDYS8Pn+.vKqk91
    


  • @dustbro
    yeah, thats amazing! 1000 thanks! 🙂
    this idea could have come to me as well, since i recently had a similar issue with parameters with a sampler, which i referenced with "getChildSynth" instead of "getSampler". anyway, thank you very much again! 🙂



  • @dustbro
    edit: sorry, i was too euphoric, so i didn' see, that this was not the subjet of my question.... this was a missunderstanding.... 😕 i already referenced it as AusioSampleProcessor, but what i wanted was to get the values for start and end, which i assigned via AudioWaveForm (which i couldn't find a method for), not to set them.

    ps:
    in the meanwhile i thought about a workaround: i presumed, that the AudioWaveForm itself would maybe spit out values for the set start and end (maybe between 0 an 1, which i could then multiply with the value of "AudioLoopPlayer.getSampleLength".

    i thought the following callback function would print some meaningful value or at least a message [array], because i expected the AudioWaveForm to produce at least 2 values (for loop start and end)

    inline function onAudioWaveform1Control(component, value)
    {
    	Console.print("AudioWaveForm: "+value);
    };
    
    Content.getComponent("AudioWaveform1").setControlCallback(onAudioWaveform1Control);
    

    but i doesn't. it only spit out a 0 immediately after compilation, changing the values of the AudioWaveForm doesn't trigger the callback and no values get printed in the console (..while it does with a knob for example).
    ideas?



  • to clearify what i wanna do:
    my idea was to store different ranges of a drumloop and then assign these different ranges to single notes in order to dynamically rearrange the loop, similar like a loopslicing.
    it would be possible to set start and end points of the ranges via knobs, but that would be a quite loveless workaround, since you already have this feature implemented in the AudioWaveForm widget.



  • okay, i broke with the idea using a panel instead of using X sliderpacks for storing data of X widgets, which is much easier to handle for my gains at this point. still feel free to give me suggestions, if there's a more graceful solution for that! 😉



  • @toxonic panel and sliderpack are the way to go when you need to store data.
    However in your situation, why don't you just use an array containing all your start/end values?
    Will they change from the combination you already defined?



  • @ustk
    good god... after sitting hour over hour in front of HISE yesterday, i seem to become completely dull in my head, so that i mixed up 2 of my own topics in the forum. 😕 my last post doesn't belong in this topic, but however: yeah, i used an array before, but the problem is, that the data won't be stored persitentliy, so each time i compile or restart HISE the data in the array gets lost.

    at this point i want to refer to my first post in this topic (after i managed it now to completely mess up two different topics)! 🙂



  • after tinkering around with different widgets, i found a workaround in order to get the start and end samples of a looprange:
    i used a slider in "range" mode as child widget of an AudioWafeform widget and adjusted it's size corresponding to it. i set the max level of the slider using the "getSampleLength" method of the AudioLoopPlayer.
    Here's a snippet.

    HiseSnippet 1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dlIPO9G90+p7iqzvPCOVQ6fe58e9e7i2tA5qZsMVhUcRiihPjMjHjT0kl01jifQTl9pEs2lDcnjGpkMNiEfvKcfd7Lf9YMlj9PXxsZKO0Xl46VhdB0SNbpJ+9yaLjPGLL07yusQFzsxKLzMVcYpzbRxehjSTIlW1V2G.EXhXe2O25J4Vu4BdgygIpjDXlTuIP9REJb7wJNyHqndrgHp2fYzfiumhljLVNujgXA3Sobt4hrn4mFByj4di7wxrCpUamDy.JmyLQTM0iEQkSRu8xExz6kEtWytMU5Nbw3M2BvqpSvELdi2EZE6l86Sbky.aA6c9lK9EeRCk2NAJSmnQL67rvJnSeG0eaY2QMbo2QEVGxEt1HoSkz2kOT.iznrAoeUJX1jggXgWZxGv4R0Drz6HaZrp6MClOizjiHhnrVXmKx1zApPnY7ftSgYxfR+oiNTXvW6b5IG+xnKAQmkNo3kXY8B+qdY8Wccmxubv8E78DESvXGpJ+nI6HhOTaow3aACC6iG4KSnlsvZONiGNTkhkM2TJnCFPDow9Bcn6HkP8wLJWuwADeBNJUQvGzXWX0Zr3jkWuDwh5Ker3rtudWaCbcTcCb9uwTk7++bpxA7QRnq7dXHQU0Ka+QAcfl4tD.ILFwWsHuUN0J2ly0RZu0A97F8AXYkiiYVWc1JlY8DluRdGAXWAuqqYAZUt7qoo.9MSOGnn8dpyNS2521tVkZPubOZWWWU39if3yh0YyygN23bnyMOG57wmCc9jygNe54Pmacl5nFFcmQRdfoTDHzto9KSrrltSfUdz+vRK2kz
    

    You have to load a Loop into the AudioLoopPlayer in order to get it working, and then compile.
    Somehow annoying is now, that i'm not able to load a loop via the interface, since the slider is now layered above the AudioWafeform widget. Is someone out there with a good idea, to get this to work?



  • it would also be possible to load loops via

    AudioSampleProcessor.setFile(String fileName)
    

    but then i needed a kind of file browser / open panel for selcting a file and getting it's filepath.

    referring to this old thread, a file browser once existed - what happend to it? i cannot find something like this within HISE. any ideas?


Log in to reply
 

10
Online

553
Users

2.1k
Topics

16.4k
Posts