Inspiration

I built a VR exercise game for people with Parkinson's, and I rode along to a local Parkinson's exercise group. The instructor runs the class from a phone and a speaker. The music is 50s and 60s, Motown, old country, some 70s rock, and the instructor changes it on purpose: a different song, a different pace, the volume dropped mid-song, so the walkers have to adapt without losing their focus on their task at hand, whether physical or cognitive.

Physical therapists call the first part rhythmic auditory cueing. A steady beat at or slightly above a person's step rate helps lengthen and steady the stride, and it works best with music the walker loves. The second part is dual-task training. Both are done today by hand, by an instructor guessing which of the class's favorite songs are safe to walk to.

They often are not. "Crazy" by Patsy Cline is a beloved song in a swaying 12/8 feel. The beat can be counted two ways, so a walker who steps to it lands unevenly. Nothing in a streaming app tells you that.

What it does

An instructor describes the class in plain words. Second Wind turns that into a walk the class will want to keep moving to, and shows every song it refused and why.

  1. Claude reads the class. Given "Eight regulars, Motown and old country, a lot of Patsy Cline. Earl always asks for Lynyrd Skynyrd. Two of them use canes. I like to switch the music on them," Claude picked four artists to cover the room, chose a drill, and turned on gentle changes "because two people use canes." When something important is unclear, it asks one question.
  2. Qloo finds what they will love. Each favorite is sent to Qloo's taste graph on its own, with the class's age, and the results are interleaved so one style cannot drown out another.
  3. Every beat is measured. Second Wind decodes a 30-second preview of each song and measures the tempo from the audio, then checks it against the catalog's listed tempo.
  4. Songs that would trip someone up are held out. Swaying 12/8 and waltz-feel songs, and songs whose beat cannot be trusted, are refused, each with a plain reason the instructor can play and hear.
  5. The walk is built. A steady walk runs from just under the pace to just above it. A drill moves the pace every two songs, always back through the home pace, flips the style inside each pair, and drops the volume partway through some songs. Each change comes with a cue to call out.
  6. Claude briefs the instructor. It reads what was kept and refused and writes a short note: in one live run, that Patsy Cline's "Crazy," "She's Got You" and "So Wrong" were held out for sway, and that "Free Bird" could not be measured with confidence.

The refusals are on screen as a funnel. For the Temptations and Patsy Cline at 100 steps a minute: 83 songs checked from 14 artists Qloo matched to the class's taste, 59 outside the pace, 7 held out because the beat sways or cannot be trusted, 13 kept.

Full songs open in Amazon Music, Spotify, Apple Music or YouTube Music, whichever the class uses.

How we built it

  • Qloo supplies taste: who else fans of each favorite artist love, weighted by age. Without Qloo this is a tempo filter over a generic catalog.
  • Claude (Sonnet) handles the two jobs that need reading and judgment: turning an instructor's description into settings, and briefing the instructor afterward. Claude never adds a song or overrides a rule; everything it returns is checked against the same limits as the form.
  • Tempo measurement is plain JavaScript: mp3 decoding in WebAssembly, a spectral-flux onset envelope, and a periodicity search that also scores how strongly a three-against-two reading competes. That score is what catches the sway.
  • A table of 2,615 songs was measured ahead of time with the same code, so common songs load instantly on a small server.
  • Node.js on Render, with the agent's progress streamed to the page as it works.

Challenges we ran into

  • Catalog tempos are unreliable. Across 232 songs, the listed tempo was missing for about a third and doubled or halved for many more. Measuring from the audio fixed both.
  • Calibrating sway on real songs. Every verified 12/8 ballad scored 1.03 or higher on the triplet measure; the most swing-like straight songs scored up to 0.97. Songs between 0.95 and 1.0 now need the catalog to confirm the beat before they are kept.
  • A small bug with a real cost. Smoothing the audio while downsampling made "So Wrong" read as a straight 74 BPM walking song. Removing the smoothing restored the sway reading, and the whole table was measured again.

Accomplishments that we're proud of

  • The app says no far more than it says yes, and it shows its work for every no.
  • Drill mode came straight from watching a real instructor, and so did the rule that every pace change passes through the home pace.
  • Claude asked, unprompted, whether walkers with canes needed gentler changes. That question is now a setting.

What we learned

Taste and safety are separate problems. Qloo is right about what a 75-year-old Motown fan will love; it cannot know that the song sways. The value is in putting them together and letting each decide what it is good at.

What's next for Second Wind

Testing with the class and its physical therapist, who should set the size of drill changes, then any instructor who runs a class to music: stroke and cardiac rehab, senior fitness, and eventually spin classes, running groups and planned workouts, block by block.

Built With

Share this project:

Updates

Submission history