Inspiration

We all lose focus at our desks, and phone blockers and website blockers are easy to ignore. For the "Composition" theme we turned your focus into a piece of music. If you stay focused, it's calm. The more distracted you get, the more chaotic the music becomes.

What it does

A laptop webcam detects when you pick up your phone, look away, or get drowsy. That drives an escalation level from 0 to 4:

  • Music that gets faster and louder with each level, and ducks under spoken ElevenLabs lines that call you back.
  • An Arduino Nano Every box with green and red LEDs, a buzzer and a 7-segment focus timer.
  • A dashboard that writes your session as a one-handed jazz score on a real treble clef. It's a calm ppp theme while you focus, then ballad, swing, bebop and frantic chromatic runs as you get more distracted. You can play it back, save it as an image, and play it on a piano.

How we built it

  • MediaPipe face landmarks and YOLO26n phone detection in Python on the webcam feed.
  • A FastAPI server with an escalation engine (grace time, hysteresis and a configurable rise time), pygame audio with crossfades, and ElevenLabs voice lines.
  • The Nano sketch runs the LEDs, buzzer and timer over serial.
  • A vanilla JS dashboard with live score drawing and Web Audio playback.
  • Built with Claude, Python and Arduino.

Challenges we ran into

  • Getting the camera, server, audio and Arduino talking to each other reliably.
  • A hysteresis bug that kept the level from returning to 0.
  • Tuning the detection so looking away and drowsiness didn't give false alerts.
  • Making the generated music sound musical instead of random.

Accomplishments that we're proud of

  • It works end to end with real hardware.
  • Your distraction becomes a piece of music you can keep and play.
  • The escalation feels gentle at first and hard to ignore at level 4.

What we learned

  • Computer vision, serial protocols and audio ducking.
  • How to design escalation that nudges instead of nagging.
  • Mapping behaviour onto musical ideas such as tempo, dynamics and scale.

What's next for Focus Composer

  • Phone-free study sessions with friends and shared scores.
  • Passive-buzzer melodies on the Arduino.
  • Personal calibration and a long-term focus history.

Built With

Share this project:

Updates

Submission history