Spectrum ballistic (display buffer)
-
@ustk yes this is most likely a multithreading issue between the UI thread and the scripting thread. I‘ll look into it. It‘s on macOS?
-
@Christoph-Hart Thanks, yep macos
-
@ustk I couldn't reproduce it consistently (I can imagine it depends on your hardware because the glitch only happens when both threads access the same data). I've pushed a fix, but I can't ensure it fixes your problem.
-
windows.add("Flat Top"); windows.add("Blackman Harris"); windows.add("Hann"); windows.add("Hamming"); windows.add("Kaiser"); windows.add("Gaussian"); windows.add("Triangle"); windows.add("Rectangle");
It's great to see to customize the spectrum analyzer, well done! In the source code there are various Window Types. While swapping them, I couldn't see any difference on the spectrum except Rectangle type. Is there anything we should know about these?
Except this cubic spectrum, can the spectrum type be changed (for example curvy spectrums like below)?
-
@Christoph-Hart Unfortunately that didn't fix the issue
-
@Christoph-Hart Check at this, it appears that the glitch isn't from createPath but within the buffer itself.
Here I use getReadBuffer/getResizedBuffer with a sinus and you can see the spectral trace of the first harmonic as we should, plus the oscillo trace of the sine as a glitch at the same time. This means the buffer sometimes contains both sets of data so it is probably not clean as it should.
Another issue -> the data are spread only on the first half of the buffer (for instance the full spectrum goes from 0 to 128 in a 256 length resized buffer (or full read buffer), the remaining are zeros)
When using createPath, it isn't the sine that we see as a glitch, but it might be the imaginary part
The problem might not be a thread access issue after all...HiseSnippet 2268.3ocyY0raajbDtojFJqYsMrALB1iSD1CzXkomg5GKua1Xp+nMgsjID0pcMLLLZMSSxFZloYlo4Jwrv.NuB41dKOAAHGyM+JjGibJ6aPRUcOCmYnHsnztqQDrAU+SU8WUc00WUTshDtr3XQDozRGMrOiT5lFsGFJ6sSOJOjzbWRoemQiFGYs8fNcXQV6FQOiG10Zcx1C6SiiYdjRkl+o3dKszBD0O+7S1l5SCcYYSQHGK3trWvC3xrYaU+4be+FTO1Q7fb6ds5McEg6H7EC.bMugMoO08TZW1ATbayYPJUdOOtTD0VRkrXRoE1V3MrcOwYg58eLOlehOCG3PZCJROcCguGhXbVxN839dsRs+XBnkVYdi40di6YrO2iOZ9Lu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8F3WHjYM601zbM6GugI1bfoyFqt4ZlpFDHEaG+8ud71wI+Qr3iYBoiUI1zv4Ao3bwLbV23PnqTnBJel4XMnX9LnpHn3U3yvPymS4wrHyih35M2.BuNBbmWQy31yVof4LAddSnY8.tmmOqk.ZdWEcmdvG8g3QDKoUf8OeRP9uT8W8Ak8Ox27gX39UUVtgk21j.UPOFnn5j5xsrl0krykXu0Gt0AOcOqW7RhGqCcfu73ITI6HWvslsZYmlKfPlhKfT6RcAu+3ht.B4WYWvyZRxapKMSEcmCPCGyRyC15Im0RFux5oas+9aMEuMYZwHjeNmyP4axi0Euz56mFNaVOCmu+d+8+ySl.tT8Cnw+hF6t2Na8pOMMGFPciDu0M4qVAxTdC0LPR3P0eHnkL1GGa4j18hlFC7f7255lV47jko10PlUuFxr10Pl0uFxrw0PlGcMjYyOpL3eSrsFHEAZ5aXhV6oX4JUZuP7qlS88zQ9eP5i+5d
Below I generated two spikes (20Hz & 20kHz) + noise to demonstrate the buffer is going up to SR instead of 20kHz. Maybe a remaining of the real + imaginary part that necessitates doubling the Nyquist length? That isn't as bad as the glitch though because it is easy to limit the drawing to 20kHz...
SR = 48kHz
SR = 96kHz
@Christoph-Hart Any insight on this ? I really need the spectrum to work :)
-
-
@harris-rosendahl yep, curves would be nicer than the square edge current design...
-
@DanH you can implement it yourself with a read buffer and an interpolation of your choice. This way you can make the desired shape (cubic, line, bars, etc...)
-
@ustk said in Spectrum ballistic (display buffer):
@DanH you can implement it yourself with a read buffer and an interpolation of your choice. This way you can make the desired shape (cubic, line, bars, etc...)
Is it possible to give an example for this iteration & read buffer please?
-
@harris-rosendahl For a readBuffer just look at my snippet above
for any data interpolation, type "cubic interpolation code" in your favorite engine and you'll get plenty of math explanations and code examples.
be aware that a buffer goes from 0Hz to SR and is linear. So you have to take only the chunk you want (typically 20Hz-20k) and perform a logarithmic scaling (both for freq and level). You also need to downsample, unless you want to draw 20k pixels in a panel (getResizedBuffer might be preferable if you don't want to make the downsampling yourself)...
This is what the internal createPath of Hise is doing. In comparison, the readBuffer contains the raw data so the whole filtering and shaping part is on your side. But for now it is broken anyway. You can still work with it though, but it can't be used in a final product so much it is glitchy.Yeah, that's a lot to read and learn ahead :)
-
@ustk Thank you!
-
@Christoph-Hart @ustk so on Windows do I need to add ipp when exporting with this new Analyser module?
-
@Christoph-Hart said in Spectrum ballistic (display buffer):
@ustk Yes I've added this recently. if you click on the edit button (where you can assign an external slot), you can see a new entry called "Edit properties". This opens a JSON editor that lets you change the properties:
Be aware that these properties are not stored in the network, but you can set them programmatically using the scripting API:
// only works with ring buffers that you have registered as external. const var dp = Engine.createAndRegisterRingBuffer(0); const var mySpecialProperties = { "BufferLength": 4096, "WindowType": "Triangle", "DecibelRange": [ -90.0, 0.0 ], "UsePeakDecay": false, "UseDecibelScale": true, "YGamma": 1.8, "Decay": 0.2, "UseLogarithmicFreqAxis": true }; dp.setRingBufferProperties(mySpecialProperties);
Can I apply these setting to an EQ displaying in a FloatingTile (not in ScriptNode)?
-
@Lindon I think I've done it recently (just for testing). I've simply copy/pasted the JSON datato the empty floating tile data.
-
@Matt_SF you mean like this?
-
@DanH I think so, it's been a while and I didn't spent much time on it
-
@Matt_SF ok thanks! Doesn't do anything for me sadly...
-
@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.3olaSRLM3H5H1NTzrkbINWYyPtVkLPS0rThyxcTgSGL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ejayFvOPGvNpPH331iF.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 :)