Spectrum ballistic (display buffer)
-
@DanH I'll try again in a minute, I'm just compiling the last commit
-
@DanH Yep you're right, it's not working... Maybe I'm confusing this with something else I did... If I come up with a solution I'll post it here.
-
@DanH @Lindon this is one way to do it, but it uses a scriptnode analyzer :
HiseSnippet 1487.3oc2XstaaaCElJNpaw8BVGJF1OEJ1OT.RMr2Z6FPQQcrSbavZR8hSSGPwP.iDsMWnH0jnSh6PA1O2i0dD1ivdD5av14PJYIk3kk5s1ATmzByyEpOdt7cnR+DU.KMUkPbVYuowLhy0bGLUpG2cLkKIasAw4FtaSS0rDOqnNSiooorPhiSsGiBbVYYh4yadTGpfJCXEhHj8U7.1S4Qbcgz9s+VtPziFx1iGUx561dq.krqRnl.3olaSRLM3H5H1NTzrkbINWYyPtVkLPS0rThyxcTgSGLVchzZ+97T9gBFtnEY.rQVw8ThPDw32IcGyEg8yO2oDhia+hnPMaT3VtayC4yjWDM9DiBuBOJGObVpJ7pUAdsJCulkf2bfjSIHsrER2zcPPBOVWnAwyUc2RBImgTHrWFJVaIK8vZtcUfERciH5QrdIvhYd3e+lMWyC9uUeP85PnOU6cLMwKVJVWRESeEjzenWt6iX5tpnXkDV3e6R1bav6BmoYRG.Iw.F3uobB8dCdZrfNsyjgCyU6eaZoModoMsQHUSabnw1lvtTcaO214aNBU1fTltOj0z6pln4Rl+vIx.MWI8GsZ8et9JiPCr0Z9MOsWuVMwefcAzLDJOA2jPQytr.MUNRv70i4o3y8op.pnCpMEdpP3qQlWU2O6GqlvD5I8o5w18vbxhgkPr+kv+fey26WvCAqVsPvSX7Qi09q9Cq40x7bd87NmXaTRWpPbHzuTbPMmyy7HgPYgjrvaifDFTvZP3aAfd4c.HYvkwk6zZFHsOzDVLF+8yPcELqoIVT625dq9fbD6oj6nzrmkA85utt2YUMb3b0gEoIJg.1v4o19nt.G8kShNjkrFTBKlvlYHz7Usi18uuitLgSfsmojgJ4VRt9Ywrr0mummj0nAe64asAjdPZfLYfcwrDMGgfyFriANUKovJtavRORqhM1l0cBzjZi1qmSYPkLAgGhRJkFHmNi682Nr8zYK9kuq8IXdelf+XR6wl79LIs+w1jySQAjipvIBptJiINlHSADzqPSgTQxTtdZ4wHmkFc4KGMZAK+bCuWR3dS29bcv34i2klCdgzz6Z7lMT55taB8qA5Bvtrauu+Bm.8VCk+woQtVrTOqzBd9HPp6lSPWAN6LIpBMM1A43.GtrwSN+paQyXLRXjv1S0Gr2OkFEKX6BGi07NTnBNZ.+Ury2AGaQVGzB+fwTITomtHM5W4RO5t0EN5lXm2LZapNgCMXtPLvNzpaF5vXvRX+tccSbMVFMfICMK9S3SlxVyBXfxV4JKQUrCSehJ4HSVJ66vYASIWyM0DjOX3osHqKDpSPBBdVQMjbLx5qDSiGqj7.Tj0hbjtdDLkSmC2mPS2ixEXWv9PlzrIejayFvOPGvNpPH331iF.Awo3nDrUB4AgZUfwOXVMaEbUoXA1h7K+YiH.bhL7Y3U+pUhDzVRhqfFwkr65Vo6iZggyj8wbKBTBtm1XiEenottCGpIUP50skuorFnpEETnJnl8zbx6yT5eVIHxgqXbZ9FuITXFBsgF2yyz8oIvke0LKkP4EcTpihnlT+BMvnLAyMrJup6.HYYtvlIU8Yl0dufdLy6wLHMhTkstfWA32uruBP7k9U.dFb+qiY6kPkowpzJa7.VDeOXhWZYgOOEtjK6m1EKyKKuqhlLWUu4Q8fC4b8Y.UOIwzuj2JThzu1klosLgQ0YgkreNztK+t58RduNP8e+7++adMpUxw3.N1kto7Xl.ZRLX7SgthgzIBctzpE4aqjpbRxhJfcY.C+nQXibA1m6AZcsFtXdgja0dWlfQKWM+EseJTERS11vSsPwhVu0uR4byWetqEtdXmo2GF2aq1G72aq0+WWE48wyHhFjnNHvdCNrV9iMRfysz7WFZE2sw0dsHGam76h2KgDALhGDDfg66.wm46yWt.97UKfO2cA74dKfO2eA74qW.e9lKzGbXz5SzpHaqHHn+l1603rojBUxlpdxeA7SAq9M
You'll have to thank @ustk for his previous R&D on the matter :)
-
@Matt_SF said in Spectrum ballistic (display buffer):
@DanH @Lindon this is one way to do it, but it uses a scriptnode analyzer :
HiseSnippet 1487.3oc2XstaaaCElJNpaw8BVGJF1OEJ1OT.RMr2Z6FPQQcrSbavZR8hSSGPwP.iDsMWnH0jnSh6PA1O2i0dD1ivdD5av14PJYIk3kk5s1ATmzByyEpOdt7cnR+DU.KMUkPbVYuowLhy0bGLUpG2cLkKIasAw4FtaSS0rDOqnNSiooorPhiSsGiBbVYYh4yadTGpfJCXEhHj8U7.1S4Qbcgz9s+VtPziFx1iGUx561dq.krqRnl.3olaSRLM3H5H1NTzrkbINWYyPtVkLPS0rThyxcTgSGLVchzZ+97T9gBFtnEY.rQVw8ThPDw32IcGyEg8yO2oDhia+hnPMaT3VtayC4yjWDM9DiBuBOJGObVpJ7pUAdsJCulkf2bfjSIHsrER2zcPPBOVWnAwyUc2RBImgTHrWFJVaIK8vZtcUfERciH5QrdIvhYd3e+lMWyC9uUeP85PnOU6cLMwKVJVWRESeEjzenWt6iX5tpnXkDV3e6R1bav6BmoYRG.Iw.F3uobB8dCdZrfNsyjgCyU6eaZoModoMsQHUSabnw1lvtTcaO214aNBU1fTltOj0z6pln4Rl+vIx.MWI8GsZ8et9JiPCr0Z9MOsWuVMwefcAzLDJOA2jPQytr.MUNRv70i4o3y8op.pnCpMEdpP3qQlWU2O6GqlvD5I8o5w18vbxhgkPr+kv+fey26WvCAqVsPvSX7Qi09q9Cq40x7bd87NmXaTRWpPbHzuTbPMmyy7HgPYgjrvaifDFTvZP3aAfd4c.HYvkwk6zZFHsOzDVLF+8yPcELqoIVT625dq9fbD6oj6nzrmkA85utt2YUMb3b0gEoIJg.1v4o19nt.G8kShNjkrFTBKlvlYHz7Usi18uuitLgSfsmojgJ4VRt9Ywrr0mummj0nAe64asAjdPZfLYfcwrDMGgfyFriANUKovJtavRORqhM1l0cBzjZi1qmSYPkLAgGhRJkFHmNi682Nr8zYK9kuq8IXdelf+XR6wl79LIs+w1jySQAjipvIBptJiINlHSADzqPSgTQxTtdZ4wHmkFc4KGMZAK+bCuWR3dS29bcv34i2klCdgzz6Z7lMT55taB8qA5Bvtrauu+Bm.8VCk+woQtVrTOqzBd9HPp6lSPWAN6LIpBMM1A43.GtrwSN+paQyXLRXjv1S0Gr2OkFEKX6BGi07NTnBNZ.+Ury2AGaQVGzB+fwTITomtHM5W4RO5t0EN5lXm2LZapNgCMXtPLvNzpaF5vXvRX+tccSbMVFMfICMK9S3SlxVyBXfxV4JKQUrCSehJ4HSVJ66vYASIWyM0DjOX3osHqKDpSPBBdVQMjbLx5qDSiGqj7.Tj0hbjtdDLkSmC2mPS2ixEXWv9PlzrIejayFvOPGvNpPH331iF.Awo3nDrUB4AgZUfwOXVMaEbUoXA1h7K+YiH.bhL7Y3U+pUhDzVRhqfFwkr65Vo6iZggyj8wbKBTBtm1XiEenottCGpIUP50skuorFnpEETnJnl8zbx6yT5eVIHxgqXbZ9FuITXFBsgF2yyz8oIvke0LKkP4EcTpihnlT+BMvnLAyMrJup6.HYYtvlIU8Yl0dufdLy6wLHMhTkstfWA32uruBP7k9U.dFb+qiY6kPkowpzJa7.VDeOXhWZYgOOEtjK6m1EKyKKuqhlLWUu4Q8fC4b8Y.UOIwzuj2JThzu1klosLgQ0YgkreNztK+t58RduNP8e+7++adMpUxw3.N1kto7Xl.ZRLX7SgthgzIBctzpE4aqjpbRxhJfcY.C+nQXibA1m6AZcsFtXdgja0dWlfQKWM+EseJTERS11vSsPwhVu0uR4byWetqEtdXmo2GF2aq1G72aq0+WWE48wyHhFjnNHvdCNrV9iMRfysz7WFZE2sw0dsHGam76h2KgDALhGDDfg66.wm46yWt.97UKfO2cA74dKfO2eA74qW.e9lKzGbXz5SzpHaqHHn+l1603rojBUxlpdxeA7SAq9M
You'll have to thank @ustk for his previous R&D on the matter :)
sadly not a path I can go down now...
-
@Matt_SF Thanks. A potential solution perhaps. It's still glitchy like @ustk pointed to originally and I'm still not crazy about the blocky lines Any chance of reinstating the old Analyser on top of these or adding a curvier Window Type @Christoph-Hart ?
-
@Christoph-Hart This bug hasn't been yet resolved... Is it still the best way to draw a buffer, or something replaced it?
This topic from above seems the best example for reproducing it:
https://forum.hise.audio/topic/5791/spectrum-ballistic-display-buffer/17 -
@Christoph-Hart Any idea to sort this out?
-
Has anyone ever released a product that uses a buffer drawing, or am I the only one counting on it at the moment?
-
@ustk I'm working on a project - far from being released - but I sure am counting on this one :)
-
@ustk said in Spectrum ballistic (display buffer):
Has anyone ever released a product that uses a buffer drawing, or am I the only one counting on this at the moment?
My current update uses the parametric EQ’s analyser with laf and source code tweaks because drawing the analyser in a panel was buggy. I would love this to be fixed however.
-
@Christoph-Hart Even coming back after months here I still feel like a beggar asking for fixes and this is very frustrating... This would make a great Christmas present though!
-
@Christoph-Hart Bumpy bump
-
The problem with your snippet is that there is no synchronization between your slow Hisescript loop that creates the path and the audio thread that pushes new signals to the FFT - this is why I added the special
createPath()
method (that also tries to reduce the path points to optimize the drawing performance).If I use the
ScriptRingBuffer.createPath()
method the artifacts will disappear completely and I can render it with 30fps.HiseSnippet 2245.3ocyYEzaajaElx1TNRqSPVffhdbpwdPAvqxLxxN1cQajksksPrcDr75cMBVDPMCkDgmYn5LTwVcQ.ROz+.81dq+B58dK+E5Oidp6+fzGImQyLxRwxt6FTYaLhju2ie7wG+dONtU.2lFFxCP4Jb1nATTtUvsG4K5uaeByG0bOTteCtQiyLpOraWZfwdAjqX98L1.Uez.RXH0AkK2hGHkMWgkPpO+7KpSbI91zjtPny4La5QLOlHo2V0dIy0sAwgdFyKkzUq0zl6uK2kODv0hXSz.h8kjdzSHRwV.ixkeeGlfGzVPDzPTtkpycF0tO+Jes7myBYcboxFVn1fgzc2f65HQrrWzt8YtNshW+gHvJsR7FKp8FOAeLygMt+DuxiUCXjnQZ+QtExBuEy.OqzvyLE7lBjxkBRXMj9Rba6.1.QxHR77E3l9BZPWB31SCkSF5sGKbfKYjdGDPCN2BfSVaDzB+0Ew6xAU8Ek8HWRaD.MFapRVULMWyXSSym9MEAwB4tzx1tTRP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127gPX+UUjN1voNxSEzKCTT2q51WYMqInWKj2z9zcN4f8MN5UHGZWxPWw4Sot1wtfGNeU1NKW.BMCW.pxs5Bd+4YcAHzuvtfCahRuTKLWkfmBPilXklFr0hlqB3KLNXmiOdmY3sQyJFA8yobFJeSZrt7sVs+rvYyZI378O4e7edwTvk51AZ7uLdu82cmK97bUQOhc.+M1QunEfo7Apd.RXe0+pmB3iksMrhuKiNiF3AYuw1Nt34oqSk6gNqeOzo58PmMtG5r48PmmeOzYqOoNx+qW6LTv8zYxgNZsuJKWtb66KeQcp2ZG5+B7.yn4C
Edit: the second example you posted somehow creates the glitches with the createPath method too. I'll check again if I can spot something.
-
Alright I think I solved it.
The problem was indeed a multithreading issue, but not between reading and writing (this was already handled), but between reading into the buffer and then applying the FFT. The createPath() could be called between those steps and then you would get some glitch values (I could reproduce it very reliably in Debug mode with the 32768 sample size).
I've fixed it now so it should not glitch anymore, but I might have to do a bit of profiling to find out whether the two threads wait on each other for too often.
-
@Christoph-Hart It's building at the moment so I'll test this right away.
Your snippet usingcreatePath()
strangely crashes (before I could test the fix commit at least), but this might be because I was compiling at the same time, it's strange nonetheless...The reason I don't use
createPath()
is because I want to perform my own interpolation in order to smoothing out the blocky look of the path. I remember looking to add a smoothing option to the method and not succeeding, but I might try again since this would be way more efficient if made natively rather than in a paint routine... -
@Christoph-Hart Nothing changed here
- I still have the same glitch when using a readBuffer,
- Hise still crashes after a few seconds to 1-2min with your snippet (so using
createPath()
)
-
I remember looking to add a smoothing option to the method and not succeeding, but I might try again since this would be way more efficient if made natively rather than in a paint routine...
Yes, definitely. Painting a path with thousands of data points in a 30 Hz framerate is pushing the scripting engine a bit too much.
I'll see if I can add a quick smoothing option but the
createPath()
function should be used definitely (we'll address that crash later). -
@Christoph-Hart said in Spectrum ballistic (display buffer):
Yes, definitely. Painting a path with thousands of data points in a 30 Hz framerate is pushing the scripting engine a bit too much.
Only the number of pixels in a panel if downsampling, but still a native smoothing would be better for sure
getReadBuffer
is still needed, like for instance when making 3rd octave frequency bar graph or with other step values, you need to make a custom downsampling function.
I'm just not surecreatePath
will answer all cases -
Alright, two early christmas presents for Greg:
- I've changed the
createPath()
method (and the default FFT path rendering) to use quadratic curves for lower bins so the days of the ugly tetris visuals are over. - I've added a function
copyReadBuffer
that makes sure that there is no multithreading issue when using the readbuffer. So instead of callinggetReadBuffer()
you need to callcopyReadBuffer()
with a preallocated buffer object and then use this for further path calculations.
I needed to change two lines in your example to make it work with the new method (see the comments):
// Create a buffer with the same length as the read buffer reg buff0 = Buffer.create(Panel1.data.buffer0.getReadBuffer().length); // [..] Panel1.setTimerCallback(function() { // use copyReadBuffer which uses the synchronisation locks // like createPath() this.data.buffer0.copyReadBuffer(buff0); // ... from then on it's the same
- I've changed the
-
@Christoph-Hart looks great thank you!