Using an Oscilloscope for Vector graphcis is propably an idea as old as the X/Y-Mode. Apart from Lissajous-Curves, the PC soundcard has become a popular method for drawing vector graphics on oscilloscopes. Left and right channel of the soundcard are connected to the x and y inputs of the scope to drive the electron beam.
While a sound card is essentially a digital to analog converter, it also includes low pass filters and coupling capacitors for removing the DC part of the signal. This improve the audio quality and save your speakers from harmful DC. Howerver, for our purpose these are harmful because the low pass filter limits the speed at which the beam can move and the loss of the DC offset makes the animation whobble around on the screen. The animation must be carefully designed to work around these limitations.
The solution comes from the other digital to analog converter still commonly found on modern PCs: The VGA-Port. While it may be intended to drive raster screens, it essentially a 3 Channel, High-speed (> 100MHz) DAC. Using 2 of these channels (Red and Green) the electron beam of an Oscolloscop can be driven in X and Y directions much like the soundcard method, but much faster and without the harmful filter stages. This makes it almost ideal for drawing vector graphics on a scope.
xrandr --newmode scope 26.7 2048 2049 2060 2060 200 200 216 216 +hsync +vsync xrandr --addmode VGA1 scope xrandr --output VGA1 --mode scope --right-of <PRIMARY-MONITOR>
git clone https://github.com/da1l6/mpv
/path/to/build/mpv --fs --geometry=<WIDTH-PRIMARY-MONITOR>:0 --loop --vf scale=576:512,lavfi=[edgedetect=high=0.04:low=0.03],vector:width=2048:height=200 <VIDEO>
/path/to/build/mpv --fs --geometry=<WIDTH-PRIMARY-MONITOR>:0 --loop --vf scale=576:512,canny:t1=128:t2=130,vector:width=2048:height=200 <VIDEO>
–vf scale:w:h
is used to scale down the image before running it.The trick of changing the brightness of vector paths can be used to display raster images.
The X and Y coordinates (red and green color channels) are counted upwards to make the beam scan the screen line by line, similar to a regular CRT monitor or TV.
The brightness is reproduced by changing the scan speed. Bright areas get more pixels of the vector image and thus appear brighter. Dark areas are assigned less pixels, thus are scanned out more quickly.
/path/to/build/mpv --fs --geometry=<PRIMARY-MONITOR-WIDTH>:0 --loop --vf scale=256:256,vectorraster:width=2048:height=300 <VIDEO>
mpv can capture the screen contents with the help of ffmpeg. This way it is possible to show screen contents (e.g. Games) on the oscilloscope screen.
This works with both raster and pure vector mode. The Image on the right is made using raster mode.
/path/to/build/mpv av://x11grab::0 --demuxer-lavf-o='video_size=<WIDTH>x<HEIGHT>,grab_y=<XPOS>,grab_x=<YPOS>,framerate=30' ...
Video input devices like TV, Webcams and more can be accessed as well:
/path/to/build/mpv tv:// ...
If you don't have access to an old-school analog oscilloscope, a modern DSO can also be used, but the image quality is poor in comparison. The raster image mode is barely useable.
The reason for this is that DSOs use samplig (periodically measuring the input signal). Whatever is measured at the sample time is painted on the screen as a dot. All dots drawn have the same brightness and the sampling is not synchronized with the VGA „pixel“ output clock.
This causes a lot of samples taken in between actual the points of image, making the display very noisy.