Inspiration
My inspiration for TuneTrace comes from a deep love for music and a desire to understand the stories woven into my favorite songs. As a fan of Turkish music, I was particularly fascinated by how many modern artists incorporate centuries-old folk poetry and historical references into their lyrics. I always found myself pausing a song to search for its meaning, the story behind its creation, and the artists who brought it to life. I wanted to create a seamless experience that answers the question, "What's the story behind this song?" with a single tap, bridging the gap between listening and truly understanding.
What it does
TuneTrace is an iOS app that acts as a "Shazam for context." A user can paste a link to any song from services like YouTube, and the app instantly gets to work. It intelligently extracts the song's true title, then uses a powerful AI to perform a deep analysis. The results screen displays: A Detailed Background: The story behind the song, its motives, inspirations, and any hidden references to poetry or historical events. Artist Information: A summary of the key artists involved. Original Lyrics: The full lyrics presented in their original language. One-Click Translation: If the lyrics are not in English, a "Translate" button appears, providing an instant translation.
How we built it
We built TuneTrace as a fully native iOS application using SwiftUI for a clean, modern, and responsive user interface. The core of the app is a robust, two-step process managed by an actor-based SongInfoService to ensure thread safety during asynchronous operations: Reliable Title Extraction: Instead of a brittle web scraper, we implemented a lightweight and professional solution. The app makes a native URLSession call to fetch the initial HTML of the provided link and uses a regular expression to parse the industry-standard og:title meta tag. This guarantees we get the correct song title quickly and efficiently. AI Analysis & Translation: The extracted title is then sent to the Cohere API. We leveraged its powerful web-search connector to find real-time, accurate information about the song. The entire user-facing experience is driven by a SongInfoViewModel using @Published properties and Combine to reactively manage state—from loading indicators to displaying results or handling errors gracefully.
Challenges we ran into
Our biggest challenge was the "first mile" of data: getting the correct song title. Our initial attempts to have an AI scrape the URL failed due to "hallucinations," and a WebKit-based browser approach was too slow and unreliable. The pivot to parsing the og:title was our major breakthrough. Another significant hurdle was the unpredictable nature of AI responses. The model would occasionally return improperly formatted JSON (like unescaped quotes) or wrap its response in conversational text. We overcame this by engineering very specific, forceful prompts and building a resilient client-side parser that uses regular expressions to find and extract the valid JSON, no matter how it's delivered.
Accomplishments that we're proud of
Building a functional and polished native iOS app in such a short time, especially while learning Swift and SwiftUI, is our biggest accomplishment. We are incredibly proud of the final architecture, which intelligently combines native iOS networking for speed and reliability with a powerful cloud AI for complex analysis. We didn't just build an app; we built a resilient system that solves a complex problem in an elegant way.
What we learned
This hackathon was a masterclass in the realities of working with large language models. We learned that you cannot trust an LLM to be a perfect API. You must code defensively, validate everything, and build robust error handling and data cleaning into your client. We also learned that the most complex-sounding problem (like scraping a dynamic web page) can often be solved with a simple, clever, and more reliable native solution. Finally, we learned that prompt engineering is a powerful tool; a single, well-worded instruction can be the difference between failure and success.
What's next for Tune Trace
The vision for TuneTrace has only just begun. The next steps would be to: Expand Translation: Offer a dropdown to translate lyrics into a wide variety of languages. Deeper Musicology: Add analysis of musical key, tempo, and genre. Direct Integration: Build an app extension to use TuneTrace directly from within Spotify or Apple Music. History & Favorites: Allow users to save their favorite song discoveries into a personal library.
Log in or sign up for Devpost to join the conversation.