Style Conformance for Blind Developers: Sonica

2023-04-05 3 min read Wiresong

Sonica is a VSCode extension that provides audio cues for rulers, principally aimed at visually impaired developers. The primary use case is to be able to easily respect line limits, by having cues when specific positional boundaries get crossed. The code is available on github, and the extension is available via the VSCode extensions interface, as well as in the marketplace. Below, I describe its usage, the developmental background, and potential future development directions.


The primary purpose of the extension is to offer sonic cues for rulers. This is done by enabling the extension (setting the sonica.enabled setting to true), and defining the rulers setting, which is an array of numbers which define the positions at which rulers appear. As you type, Sonica will play an audible click, which pans from left to right, indicating the distance from a ruler. As you cross rulers, persistent tones will play, indicating how many rulers have been crossed.


I was hired by Austin Hicks to work on the initial idea. His workplace mandated a specific line length for formatting purposes. While rulers, in VSCode, are specifically meant to solve this problem, they are both unusable with screen readers and have no sound-based indications. The goal was to make rulers accessible.

The first prototype was based on using a webview. I wanted to use WebAudio for audio generation. It worked well enough, but was a fairly unwieldy solution, and didn’t do audio files well-VSCode’s ffmpeg only supported WAV, so I had to convert and base64-encode audio and store them in a js file. Not the most elegant of setups.

During this time, I started experimenting with additional features relating to audio cues. The primary feature that came out of that was sounds for diagnostics-errors, warnings, and the like. While this feature is redundant now (since VSCode now does these cues natively), it was useful at the time. I really started to run into webview limitations while working on this, however, because different diagnostics required different sounds, and each of them needed to be bundled inside a js file. It got too unwieldy, and I was motivated to shift to a better solution.

The current version uses a Rust subprocess. Unlike the webview (which is easily available on all platforms VSCode runs on), I have to bundle a version of the subprocess executable for Windows, Mac, and Linux. It’s worth it though-that bit is easily enough done with CI, and the extension is much more lightweight and simpler (in code complexity terms) as a consequence.

Future directions

As it stands, Sonica is complete for my purposes. I eventually want to prototype some sort of full 3d context, providing visually impaired coders the ‘semantic context’ that people get by glancing at the screen-but that’s likely another project entirely.