Sample Range



  • I would like to have a problem again 🙂

    I would like to give the user the possibility to limit the sample loaded in the AudioLoopPlayer from the start and end point.

    He can define the start point with Knob SampleStart and the end point with SampleEnd.

    It is important that the knobs only allow the actual sample length.

    The sample length is recorded when the sample is loaded and determines the min and max range of the knobs.

    I already had it - but then HISE crashed and it was gone - now I can't do it anymore.

    HiseSnippet 1377.3oc4Ws0aaTDEd13rU0lVDUDj3wUQ7fiTR7Z5EPpB0MWbPVMWrxlVPU.VS1cr8nLdlUyLNIlRj3mF+D3GAR7JuvyvY1c8do0I00MsTU7KVy4xrem6moiTDPTJgDYU8nwQDj0sr8Gy0C1Z.lxQs2FYsjs2dzSHa53iGFwHGh48InMGGgUJRHxxpx2Zjzp5hn3e+0i1Dyv7.RNID5oBZ.YW5PpNmZj2ioL1N3PxQzgEj9ddsCD7sDLwH.UUrcQQ3fSv8I6iMhsfMx5FsBoZgzWi0DExZwMEgi8GHNimH+SoJ5wLh4PSjObQIj2QvBMH1PEs0.JKryDqWgPV1cx8EUR7EKYuGMjlQO2m7IwLbx0nn+vZgqBdMKBO2YGdVEf2hIv6N19ARZjNmiAaejcatlH6gCJGlRjEsvyss2R.Rv0qODeBYGIbHSi5Ov0cUm665txCqUqQiSwR0ZuA+pAQRk1AtFmNL7XhrqeSmuwINCa89D8FiBohj7pLin9xYht7JO710LJq1kv6OPCplwyndhlFd5A0ADC1kRvHqGIobc8Tk.54nHQitPnQZtsINB3t1RLLRvgC0WtnPK+RpSXcawCuRkSDwnZiFq8F4+LAgDv9Xt3343BnbFkSb5MhGnoBtifWz5LlfTvpGLA+qBlIaDYkZOuV0LhqqHfgMjxWdUGShwKwAeNvI2cW8xhCETLXfoORnIpUMOlplDSi6xT2s3sdQb78UFtL2QpYsElwNF5cTepF80TzwjKbsFaRRd9fIxLoV3xiKkL3qgnxsqUvituPSNfWO1sU6hZNuHqd8lJuTzvHxox1LwRdUJVmOZ3wDYwflQPn0c4YC1W9rghitBRbuEDTvayo5ChH7KahAJMl.yNpjhJXxoNdxwmkN4Ht+62gOkzSHGhnglIakn0DEa.EmkGh0Xj0uX23IJhT0XHNHjbJgIhZrMQchF92soyZN6eP6m8rz9spFabrRKwA5NDYvHkB7UcgOQW+NMN.p..6RqZLg2oDmiHmqGIIIzRO.B208tqeF9TjzjCFWKCdPKCnho.YQly+3yuQhwGawURr3ON0h8YzPhL1TARE5JT1PW4G9yGMK2wsryyfKcC+1eW+OdD5Is213sfwuoACH.EQjZpI1asM4TXsnjY4UsS8dwQqzJHj0MesiWmmGqZ4MN6vutiWzjji1glsDxpsQmQC0Cxjz6BuADJTYmS4m7Twdp17Px4IYjnBf7FypK9RvlWOOklD4S+YRw8HglWEBmyvWqTvH+a4d1q225kWzBV2SDNhg0k2Azr3aJCHgtzxVlEp3JpdbwOxakECmU3dG6NTcvfoi2ElBdgr1213McM6aa2pWORfNGrKZuy2+1em5hP4Sm.k3xocElxzz0oyKTt7W876W+u5AVRN.hVkRSiCgGAMROgx6W7SY.bKNFbAgEIenPnMi4xo0wKohLtfDt9RRC8wkpx2vNTV5Cu9Osi+PiyNoUegRUFX0kFCvhcCYSArpLyYMS+ghtS6kXK9d8CEe209pxrA2WwaYqNAi9TShSKdblEIsm01jd3QLcF0hfbOAWDMPvoAkSh0RZ+9DYQnOU6YCsFJjxorj2gDFAqJTs7Ed6BanikuXc3qgqn4r6Jtpv0mam.WGSaCmOLl5T4+mScNTLRCsu2CCIplVY6OZnOz0Of.HgyILyyBrVvr.exY2Ic27I7v3C+C7KkYSyYqTlMmv7cx2.lCHEcCRVR1jKeyXJfcyiGXT0dOyYmr2PXa6ttKzJOj1MHv3tWqIBMcc9x4Pm6NG5bu4Pm6OG57f4PmuZNz4quRcLyh1XjVLLoTDHzoU7CTrrxVdvpB5eA6KZfG
    


  • @MikeB you have

    var sLenght = Player_S1.getSampleLength();
    

    outside both sample start & end callbacks, so when loading a file there is no length information available to set min & max



  • @ulrik I don't understand - Console.print shows that the value of the sample is recognised - in all cases outside and inside the callbacks.

    Even if the SampleLenght is called inside it doesn't work.

    The min and max values also change in the PropertyEditor.
    But the knob does not accept this value.

    Bildschirmfoto 2021-09-16 um 18.38.33.png



  • @MikeB Hm, is the audio file already loaded when you open the project maybe?
    Here I have to load a file and the length is not recognised because the call for the length is outside any callback, it is only recognised on init



  • @MikeB I moved the length check inside the two knobs callback and this works here

    HiseSnippet 1368.3oc4W0saaTDEd13rU0lVDUTj3xUQbgqTarcSaAoJT17iCX0jVSb+AwEDMY2w1CY1YVM6ro0fpDOI7bviAWwMHgPhW.dCfyry5cms0I33lTgn6cy4Lmy7c9+r8kh.RRhPhbp+3IwDjyUbGLgqFu0XLki5sMx45t96QOhro2.bTLirOlOhf1bRLNIgDhbbp8E5a5TeYT12es9lXFlGPJIgPOUPCH6RinpRpw9OfxX6fCIOlFYc6632KPv2RvDo.pp41FEiCNBOh7Pr9ZK4hbtT2PpRHGnvJRBxY4MEgSFLV7bt49OklPOjQzG5fF.JxPdGAKTiXMUzViorv9Ss9DDxwseounlwWbc28ngzB5k9jOHigWoD19CmkNM30wFdsme34XAukMv6ZtCBjzXUIGM1dO2dbEQNDGTMLYtKZoey0cKAbCtZ0H7QjcjvgBIZdu1suo2ca29F2uQiVsNFKSt0avWCHRln7.030mgmPjGLni2m6kkgs5HhZizPpvjWUXDMWo3pqbi6eUCJ7R1kvGMVABWvUq.irZdpwMAL2pEXaIBFY0XIkqZlKFvoDIFYN.BORs9l5L.sskHJVvgCMWw9Rq7ZhSXGzkGdpBatxJYX5VuQ9Pcfv.1GvEGt.JfxYTNwaXJOPQEbOA215zlfTvZFLE+2DLSVJ4FM9gF0Yh.Ladc90KTwpIDvMDQ4qbSu1yhC9E.mxfS8SJpYIXvXcmmvrGpDFISgQVeolss05Kuei4I3p0QtSXKLicHzso4LcQmSwRcly4Zjzjp8NZbbZc1IGEq3dNGhgWsgk++gBE4Q7lYN4Furg2qxZ3vYxKGMLhblr0SDkmlfM4oQGRj1gX8EgQCUm83dxydrGMFXbuVWTv6wopGES3mzDITdLAlMUKGUvjYU1joOJexTV+8mgOlLTHiPzP8jyJz5fxL.6cEBwJLx4aba8jDhLoUJSRO5PQHg2ZuzDZPqujlPZ0cDGqG+9cj.UqdPqYYZDfkVYJ2aWgHNOE2PYGJijzBe6UwzgHoNCKqtF7ON5mLiBjinO+S+5RFSKydpYrm2O2dFvngDYlg.jr5PTwL7Was+b84QGWwsL+rhF9iu5m+80QOo21ZeAL7N2UCFbLQpn5Hqy1jigkpLaBT2caRxQJQbVrHu9.4b4ybz3EkQht9SJN7i63GOMz2KTuiQQkK54zP03ha5+R+wDJT2VR4a8Sx7T83gjWXx2PVf7RyqK9Dvl+P+DEId.86I1agBslrBmywqUIXT9Vse9Y6sd80zfkEEgoLrp5Fj50lyY.k1UVUSuNFOgplX+HWHqUNuv8Zt8opfwyFuKMC7BYsWz3MeI8q51c3PnMPIXW1cmu9heiban7gSgRV4jt8CY5x3kEJm7+L8Km++yDrhc.DspjllEBerDlLR4ireJMf6xwfKHzl79BgRODqjVeeSEYVAIn9J2lbLzutpFz8cM+11EX+7HsqzzH2pPjAxToIOKyHK5w6TatyINC+D4x+m9mHe60bp17A2+k+ys9TLNfpy55xOlvfRq7NRaSFhSYpBp1fbOAWDOVvoAUSQUR5nQDoMzmo8rgRAkIkTtt+9DFAmXUK7I96B6hikuZU1YvUzY9cEmV35icMv0S2Tv6+GyTp8t4Lk8EoJn47dXHQU2J6goQCfd5AD.IbNgoWo2YI8x2lysm1ca.gGlc3ugublczmcxY1YJy2JuQDNPJNHvrBrNW9xYT.6lmMNnt6d5ydE6+651d01Pq7P5AAAZ28s5fPyVlau.xr1BHycV.Yt6BHy8V.Y9zEPlO6TkQOKZiTkHxTJBD52M62ObbJVMvoF5efNtBgj
    


  • I cannot get it to work

    Unfortunately there is obviously no "SampleStart" or "SampleEnd" but only SampleRange.

    How can I use the Start Knob to set the SampleStart and the EndKnob to set the SampleEnd without the two overlapping?

    If they overlap, the sample is unfortunately unloaded.

    HiseSnippet 1369.3o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xj27D8Gai9gtsTGJn6cRNCxiAjPIUQQVsHmASUEOJPY6VjnSkh.cRMoLEYc624z5EY.ns6zzE+ZG2fYbXWe0PFo2pPmS8kiRsz8R2QDJbmLSxO6Fm96x8IWDW3fL.4sJZJ9Jvl6.2HIInO8WHligBOoXVdTrcLGgj4e8yK39kT971ypASLJ7mvvx7iQplcNQAbOM27ZpYx3QT4TyM4FY1xhB26Y2iJ8FMe7txbvKT4dSi2jI0uqc6ACHdxLvtpcme5lerbSnb+YPQekZWg5pZxD4YWVt5eb52+v+iSvb1d.akqLUSgGFBMon7glakBvs4XHE3aJ9.gPp5HkIqma7cD8kRH74rlbFILJeD5PYI+6VQdbdrJmDeMx3FEC.WtWrYZzl9fsUoBStuC+R3p+q9WB+38JSohA2q4uVKOCi8oJ9tM+LBCtij7zRKx.7DlLUpIH2SvEAiDbpW9ZMYHc3PRnIzm6444RITumI4AtGPXDbjQQ8W4tKLYLN7Mut7NjJZT7TwhnquvNFtNpa2N+2n4Po+e1b3.wDI7J6dXnPU8T1KmLtO73rGAPBmSXpAssVQMaR755ydNqOg6qW72vWhxFp0VIJaLS4Gk8XL1KTbrW77rpZ4aqk.mat9c8x16oV6jNUtsc8MpCOk6SO1ySkteXCDZ997nkvmudI74wKgOasD97jkvmuYI74oKzGUunmOQJFGeUDDzqs9eIrrR6waUB8ONKp9HC
    


  • @MikeB I found the problem, the sliders doesn't accept to high values and the audio file I loaded was over 20000 samples, so I divided with 100 to set max values, and when getting new value from sliders I multiplied with 100.

    HiseSnippet 1528.3oc4W0saaTDEdV6rkZSAQTKRbEZkEBYCIdsKsEDHDaShCX0jTq31BhpRzjcGaOMimY0tiSiAUodChGAdU3RdD38fa5a.blY206XGGW2TREB7UdOy4bluy+moSjvmDGKhPVkt23PBx5J1cGykC1b.lxQs2BYcU6tDoSW7vPFwYGBuub.Ziwg33XR.xxp3WqXzpzJH8um+UafYXtOImDB8.A0mrCcHUlSMz6NTFaab.4dzgFbeCu19B9lBlXD.ph1MP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S8FPn8GjuRk2O3kzioMOfbRRJKx.juwxFkNwDN4XyqmWrjD1k9iDy88ltks5j8+s2+m+yU+EOnUa9m+p2xgkoh14HowSd8fjEl4XDzdrAbddn2zwlmgmM1f1yiFuqPU8gi.IsJfN8BcvZkhfQLrb5cMUKXmdfxrLWpSs2FGL2wltgKjEPWV3tpcGpzev7wag4fWnp6hFuoqy+V1s50C5DlC1Ur296t32c2DJWMCJ51ApNvjr01yKzO6WW8G+y+5JXWbeHZMUgjNDduHX7Nk227pT.tEGCtf.Sx6KDR0b7bZc7RJbzMT.0OE2jigQVSqA0nmjG3cANRanxUlLKS2PHYHBCjYp4bLsQNYLmUwkNm3k34lq7u5ma95q4TwkCtufWDWJCicoprtV7iILnzJsizVjd3QL4DplfbWAWDNPvo9SmhJin86ShLg9bsmaKkPYRNkq4sOgQvwF0Bef2NvF+3nYqxdIbEMWdWwhBWumcBbcTMEb9uwLkh++blx9hQRn47tXHQU0JauQC6B8z8I.R3bBS8pFXICkn5uaj0cqK7bT8G+E7K8vlpusROrY1guVtigX+HwA9I6wqxkurlBX2b83fR16p91YxSfrsaTuAzJOfdfuuxcudSDZ9xb8ygLex4PlabNj4lmCYt04PlO8bHymsPYTyht8HoXXRoHPnSK8ymrrlrZfUQzeCLWnIQC
    


  • @ulrik Ulrik, Ulrik Ulrik you are a genius - great - looks a lot more complicated than mine but it works.

    There is still one small problem.
    It is possible and leads to the unloading of the sample if
    the user sets the start knob to 2000 samples, for example.
    and the end knob BELOW 2000.

    Basically, the start knob can only go as far as the start value of the end knob and vice versa.

    The two values must never overlap.

    Another thought experiment will be that a call of the samples via combobox will fetch the SampleLenght - i.e. already outside the inline function.


Log in to reply
 

10
Online

1.6k
Users

4.6k
Topics

42.5k
Posts