0

I'm a newbie here and start my challenge with Python. Just saw that video and got the idea to force Raspberry Pi to do same job. The idea is to grab a .dwg file and to convert it to an x, y audio signal. Once I'll get an audio signal oscilloscope will do the rest of the job. I will appreciate any advice on how to start solving this problem: how to transform the .dwg file into an audio signal? What libraries would be helpful?

Eskapp
  • 3,419
  • 2
  • 22
  • 39
adamssson
  • 35
  • 4
  • export your dwg to dxf - It is much easier to work with dxf. But I bet it should be much easier to work with raster graphics so I would suggest you to convert your vector graphics into raster image. Right now your question is too broad to generate good answer. – Maxim Sagaydachny May 04 '20 at 09:35
  • Ok, I'll manage to transfer DWG into raster image. Let's start my question here: how to transfer raster image into analog signal and finally export on RPI thru jack output. What libraries I should study to solve my problem? – adamssson May 04 '20 at 16:43
  • Maybe its easier to generate a uncompressed audio file and play that so you don't have performance issues – bb1950328 May 05 '20 at 06:45

2 Answers2

1

Lets get basics of X-Y mode of osciloscope first:

  1. signal at channel 1 moves "dot" up and down
  2. and signal at channel 2 moves "dot" left/right

So signal at channel1 represent Y coordinate of pixel and signal at channel 2 of osciloscope represent X coordinate.

So to "print" monochrome bitmap on oscilloscope by "Oscilloscope Music" method you need to convert all "active"(painted) pixels into array of tuples where each tuple represent coordinates of single pixel and write such array into audio device directly or into stereo audio file.

Here is an example of bitmap of resolution 5x5:

XOOOO
OXOOX
OOXOO
OOOXO
OOOOX

Suppose you prepare instructions for plotter (or matrix printer to move head). Such bitmap can be converted into following array (assuming left-top corner is point [0,0] with Y zxis pointing down):

[ [0,0], [1,1], [4,1], [2,2], [3,3], [4,4] ]

This is a resulting "sound" stream which can be feed into audio system:

  • X coordinate of pixel into left audio channel and then into CH1 of oscilloscope
  • Y coordinate of pixel - into right audio channel and then into CH2 of oscilloscope.

Of course you would need to:

  • resample those numbers on the fly to fit your bitmap into resolution space of oscilloscope
  • and probably optimize jumpings between separate dots to prevent side-effects of RC filters to kick in. These side effects are probably the reason artists prefer to render vectors on the fly to reduce jumps.
Maxim Sagaydachny
  • 2,098
  • 3
  • 11
  • 22
0

All right guys - just found solution on Github: https://github.com/da1l6/mpv MPV player upgrades with Canny filter translate raster images to vector images and by driving GB channels on VGA port give signal to osscilloscope. I believe I will be capable to upgrade software later for DWG/DXF display. For me is not ideal solution but will be ok for start. Now I'm struggling with build this software on win7. This is story for another topic. Thank you all for support.

adamssson
  • 35
  • 4