Inspiration

Opening a codebase you've never seen before is overwhelming. You get hundreds of files and no idea where to start. We kept thinking it would be easier if a repo felt like a place you could walk around in, and then we wondered what it would sound like.

What it does

You paste a GitHub link, and Sonyx turns the repo into three things.

  • A 3D world. You can view it as a city, a galaxy or a tree. Every file is a building/planet/leaf and the size and complexity of them depend on the size and complexity of a given file, and imports show up as glowing links between them.
  • A song written from the code. Bigger files hold their notes longer, more complex files make bigger jumps in the melody, and async code drives the rhythm. Every repo ends up sounding different.
  • A Code DNA profile. Each repo gets a score, and you can see how it ranks against others on a live leaderboard.

How we built it

The backend is Spring Boot on Java 21. It analyses the repo and streams results to the browser over WebSockets, so the world starts building while the analysis is still running. The frontend uses React and Three.js for the 3D views. The music is generated live with Tone.js, with no samples, and it always stays in key. Gemini explains what individual files do, TimescaleDB stores the leaderboard, and the whole thing runs on Vultr.

Challenges we ran into

Our first version of the music sounded like random notes, because that's basically what it was. We rebuilt it around real chord progressions and melodies, and that's when it started sounding like a song.

Then the audio began crackling, so we went back and cut its CPU usage by 37%.

Switching between the city, galaxy and tree views also froze the page for a moment. It turned out the shaders were recompiling on every switch, and once we stopped that, the transitions were smooth.

Accomplishments that we're proud of

We haven't seen anyone else turn a codebase into music, and that's the part we're proudest of. We're also really happy with how the 3D worlds turned out, and with how Gemini fits in: you can click a file you don't understand and get a plain explanation of it.

What we learned

Turning data into sound is mostly a design problem. Raw numbers mapped straight to notes sound terrible. It only started sounding good once we made the data follow musical rules. We also learned a lot about performance, since audio and 3D rendering both fall apart fast if you're careless with the CPU and GPU.

What's next for Sonyx

Next is private repos, so you'd sign in with GitHub and explore your own work. We also want to support more languages and resolve imports more accurately, including TypeScript path aliases, Java packages and Python modules, so the links between files show how the code is really connected.

Built With

Share this project:

Updates

Submission history