Emulating an X-Y oscilloscope?
im trying to write a program that would emulate an old analog oscilloscope in X-Y mode, here's what I got so far:
compare to a professionally made software(https://github.com/kritzikratzi/Oscilloscope/releases):
as you can see, on my version, the graph is filled dots(2^14 to be exact), where in the pic below, its forms a much smoother curve, as an oscilloscope should. so my question is, how to "connect the dots" and form a curve?
(adding more dots on screen wont help, as enough dots to form complex moving in a 1024^2 grid is just too much for the cpu to do in real time)
here's my script and a sound file to test(spawn a quad and attach a blank material and also a audio source, make sure the audio's compression format is PCM). https://drive.google.com/open?id=0B1dPrjem8RRdUE52Nkw1UnVSOTg
the main problem here is, that oscilloscopes use a complete different approach for rendering. ins$$anonymous$$d of rastering images it offsets a beam. unity cannot do that and so you have to fake it.
I think there are different approaches to this, but the best I can think of is using a line renderer and pass all the points to it in an ordered fashion. staying with your approach and from my understanding of your code using quads, you'd be better off to programmatically alter a particle system
Answer by somestickman · Dec 14, 2016 at 09:59 PM
@hexagonius so that it appears that it might impossible to render a very low detailed curve in unity, as the function "audiosource.getoutputdata" can only fill an array with a maximum size of what appears to be 2^14, which would greatly reduce the smoothness the result even if the calculated dots are connected with lines. Do you think ther e's a way around the limit, or maybe there is no limit, and my coding is just broken.
And also, do you think that it's possible to use a trail renderer and miniputlate it's location as fast as..say a real oscilloscope would? I converted the project to a particle system, but it has the same problem that the pixel quad thing have, except there's a lot less delay.
Your answer
![](https://koobas.hobune.stream/wayback/20220612102536im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Enemy Spawn waves, not stop keep looping 0 Answers
set value to 0 every forth iteration. 2 Answers
player death sound not playing 1 Answer
Get comments on Unity using Facebook Graph API 0 Answers
how do i read a node value in shader graph with c # code? 0 Answers