Spectrum ballistic (display buffer)
-
@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+0Ew6xAU8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k1hCWkWEnGOwm8gvw4XhqG6e9Buzu17K9fZ8O127gPX+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!
-
@DanH Anyone have snippet for this so I can have a look?
-
@lalalandsynth the default analyser has changed so you should be able to load it up and see, unless you mean rolling your own curves
-
-
@Christoph-Hart I'm sorry to bring bad news the second day of the year, but unfortunately we're not done yet with our friend the buffer...
After a little while (about a minute on my system), the buffer Max/RMS value suddenly cranks up to burn its wings into the sun with a gain of several millions and an erratic spectrum:
This was expected instead:
I remember this was happening already before, so it doesn't seem to be related to the recent mods you've made.
Also the newcopyReadBuffer
method doesn't solve this and it happens even if you don't use it (I just put it in the snippet so we can see the buffer in the watchtable). The problem still happens even if you just call thecreatePath
function so my guess is that it's happening way before at creation of the buffer maybe...HiseSnippet 1581.3oc6Y0raaaDDdoroRjpMPRQO1CD4jLfCiniaZAJZiiksScarifkqQ.JJBVStRZgH2kkbkkUKBPA5k7Jja80nOD8TeQxaP6LbIEIkbbhEpSQPkNocmY14a94aVJp1QRWVbrLhXT63wgLhwJlcFKT8a0mxEj82gX7wlc3Ag9rVQLph0lp5S1dbHMNl4QLLV5wndF0Vlj740ObapOU3xx2hPNQxcYOgGvU461dqui66uG0icLOnf1at09tRQKoubHfokLaRBotCn8XGR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