This is a simple web service that I created as a take home project for a job interview. You can upload an MP3 to the /file-upload HTTP endpoint and the service will tell you how many audio frames the file has. This exercise demonstrated that I could quickly create a simple app based on knowledge from an unfamiliar domain.
To run this application, build the image using Docker Buildx and run a container with the app port (e.g. 8888) exposed like so:
docker buildx build -t mp3-frame-counter:latest .
docker run -p 8888:8888/tcp mp3-frame-counter:latestRun npm install && npm test
Use the following test cases with your own file locations:
- Valid MP3:
curl --location 'localhost:8888/file-upload' \ --header 'Content-Type: audio/mpeg' \ --data-binary '@/home/gregory/src/mp3-frame-counter/__tests__/fixtures/sample.mp3' - Not a valid MP3:
curl --location 'localhost:8888/file-upload' \ --header 'Content-Type: audio/mpeg' \ --data-binary '@/home/gregory/src/mp3-frame-counter/__tests__/fixtures/not-an.mp3'
Initially I implemented the service by researching publicly available documents about the MP3 format. My job interviewer encouraged me to use AI workflows as needed, so I had GitHub Copilot generate some parsing code to get me started. I improved this code, often by hand and sometimes using AI, until my unit tests passed and manual validation succeeded.
I ran into a problem where the frame count for some MP3s was off by one. I didn't have the time to become an expert on every detail of the MP3 spec, so I decided this was the time try my hand at agentic workflows. I tried to find the source of the issue using the free GitHub Copilot agent with GPT-5 mini, but it couldn't identify the issue. I tried again with OpenAI Codex, which was more helpful. It generated a patch that fixed the issue by handling side info.
I think that AI code generation was useful for reacquainting myself with JavaScript's facilities for bitwise operations on binary buffers, and the agentic workflows were useful for diagnosing an issue that it was able to solve. Ultimately I would try to avoid deploying such code into production without researching the problem and coming up with hand-tuned tests, however.
"Sleep and Then" Kevin MacLeod (incompetech.com) Licensed under Creative Commons: By Attribution 4.0 License http://creativecommons.org/licenses/by/4.0/
Fast Fight / Battle Music by Ville Nousiainen. This music is in the public domain. The looped version included in this game was made by XCVG and is also in the public domain.
Most of the test MP3s couldn't be included in the publicly available version of this repository due to copyright concerns, so I committed tests with public domain and Creative Commons MP3 fixtures after committing the some of the code that I implemented to satisfy my tests.