(A submission for a Hackathon on the topic 'Impractical Inventions')
It is a well-known fact that, today, the world faces a grave threat to its existence. We all have heard of this crisis at some point or another. It is said to have far-reaching implications for all of Earth and its most important fauna.
It, of course, is increasing screentime.
This app lets you strain your eyes lesser by converting images into audio. With a bit of practise, you can train yourself to 'see' sound.
This can also be used by visually-disabled people to access their computers faster and more efficiently. The traditional (TTS) method is far too slow and many applications don't support them fully. In contrast, a 256 by 256 RGB image can usually be played back as audio in under 3 seconds using Auditorise (found in informal tests run on a Windows 11 system).
The frontend of the app is written in Python and the backend is written in COBOL.
You can run this app by downloading the linked release.
This application was made to be backwards-compatible with as many systems as possible, which is why the image-to-audio converter, was written in COBOL.
This language was chosen because it, till today, retains support for programming on punched-cards. As you can expect from a programming language of the name COmmon Business-Oriented Language, it takes backwards-compatibility very seriously.
To add support for a new system, all that is required is to:
- Buy a COBOL compiler compatible with that system
- Wait for the stack of punch-cards containing the compiler and this code to arrive by multiple couriers
- Buy a card-sorting machine to arrange all the punch cards in the right order
- Compile
auditorise-core.cob - Sleep for the night and return next morning to find that the compiler is still running
- Consult your school / college counsellor for moral and emotional support
- And then, write a frontend for the application, with the language / framework of your choice!
In case a frontend does not exist for your system, no problem! You can still run it from the command-line. You only have to input RGB values for about 65536 (256 * 256) pixels.
Also, the compiled executable must be in backwards-compatible/bin/
The app has 4 pages:
- About Page: This file is displayed
- From-Camera Page: Captures an image from your camera and converts it to audio
- From-Screen Page: Takes a screenshot and converts it to audio
- From-Files Page: Convert images (PNG, JPG, JPEG images) from your system into audio
Keybinds for the app:
Alt + a: Opens About PageAlt + c: Opens From-Camera PageAlt + space: Captures image
Alt + s: Opens From-Screen PageAlt + space: Captures image
Alt + f: Opens From-Files PageAlt + p: Play / PauseAlt + q: Quit
The COBOL backend converts a (65536, 3) numpy array (reshaped from (256, 256, 3)) passed
as input in backwards-compatible/__inout__/in.txt into
audio and then writes it into
backwards-compatible/__inout__/out.txt.
It uses a Hilbert curve (a space-filling curve which
preserves locality quite well) to map a 2-dimensional image into a 1-dimensional space (audio).
After that, the COBOL program maps the colour value of each pixel to audio.
Because it is hard for a human to learn to distinguish all 256 values of each colour, it has been divided into 8 bands instead (each spanning a range of 32), which was then written into the output audio.
The mapping is:
REDto amplitude of the output audio- 0 - 8 units of amplitude
- 0 - 4 units below 0, rest above
GREENto some kind of timbre, in the output audio- 0 - 8 units
- 1 unit = 1 / 4 of the total amplitude
BLUEto wavelength of the output audio- 1 - 8 units of time added
The app resizes all input images to size (256, 256), as Hilbert curves are easiest to implement
on squares.
The app uses the tkinter standard library module for its frontend.
The following packages were used:
pillowto read images from file and manipulate themttkthemesfor the UIopencv-pythonto get input imagessounddeviceto play the audionumpyto manipulate the input image and output audio arraystkinterwebto render this MarkDown file, converted to HTML, inside the app
I have also taken utmost care and forethought in the matter of
forwards-compatibility (the opposite of backwards-compatibility).
Therefore, I have included a forwards-compatible version in
forwards-compatible/.
It contains a PDF showing the format of a legal "cease-and-desist" letter, to allow for future mega-corporations to easily sue independent developers like me, and then take credit for our work.
As you can clearly see, I have given a lot of thought into this matter.
(This PDF was taken from eForms.com.)
Install the Python 3 interpreter, if it isn't already present.
Download the latest release from the GitHub repository of this project, and unzip the folder.
Run the following command inside the parent directory to install all the dependencies:
pip install -r backwards-compatible\requirements.txt
Finally, go to backwards-compatible/ and run
main.py from the terminal.
This app is inspired by 3Blue1Brown's video linked here.
This app has only been tested, and built, on Windows. And it has only been run and tested in Python 3.10.
The frontend for this app is written in Python 3. The dependencies are given in
requirements.txt:
cffi==1.15.0
numpy==1.23.4
opencv-python==4.6.0.66
Pillow==9.3.0
pycparser==2.21
sounddevice==0.4.5
tkinterweb==3.15.6
ttkthemes==3.2.2
You can install them by running:
pip install -r backwards-compatible\requirements.txt
GNUCobol v2.0.0 with OpenCobolIDE v4.7.6 was used to compile the COBOL code. This was the command used by the IDE (run over a POSIX compatibility layer):
cobc.exe -x -o bin\auditorise-core.exe -std=default -x auditorise-core.cob
The easiest way to compile the code on Windows is by installing the IDE.
pandoc was used to convert this MarkDown file into HTML, to display it in the About Page:
pandoc -s README.md -o .\backwards-compatible\__assets__\converted-README.html
You can view the converted HTML file here (the links on the page probably won't work if you view it from the browser).
All other files in backwards-compatible/__assets__/ are
original, and made with
(MS) Paint v11.2208.6.0
(Windows 11 version).
The PDF in
forwards-compatible/ was
taken from
eForms.com.