feat(train): music by cadence in a recording, or the metronome (ADR 0030, D48)

A workout keeps its cadence as a series of its own (steps a minute, every
10 s while moving). The Record sheet offers Music, Metronome or Off on
foot, remembered; Music once a kept track has a tempo. The recorder
measures the cadence over the last 30 s and plays a fitting track (its
tempo, half or double, within 6 %) through Media3's ExoPlayer, retuning
the track playing where it still fits, else crossfading over 3 s; a
plan's new step picks anew. A run starts at the cadence learnt from the
person's runs, which also gives a plan's steps their cadence.

Media3 1.10.1, pinned by Gradle's checksums (trusted on first download
from Google's Maven, 29 Oct 2026), for review:
  media3-common     aar 39686f54ff6baf8cbc841199afd55619533eaef2ab6cd0efc32b8a3c55dd88c3
                    module a81b2f0ebc256fe0e09f05d93c5259ade5bf44707748b9295343bee67575d9c2
  media3-container  aar a198b62c577fa434941282fbfa31eb66ff0ff308a6573edf0b5dd01f4e38445d
                    module e2a1c62c7e5d1013b906bc6ff5056db3e797cda4505e2d7d229524b24ca67a0e
  media3-database   aar 520e6f814e42a7d428db187ac073b453c0fcba0f4f5f4edd1cf33fafd2cfb740
                    module c380fea161e80d8074215a20e86e3dc2c2d825de964ca87aee66c8331f5ae252
  media3-datasource aar e22f9f779047ce951152c793af094593e7cbb52475a82d56fa4f869fd319e700
                    module 9d32d2ec6a983ee9f418bcc05777aa23eee4db37bf794f44fb66a05d6f22e963
  media3-decoder    aar a9fb2b8fa1d54b4a8d6bda98a1c655b04d59c74b3ace7e2503e9e39830f13aee
                    module 388d5226366edd1facf8eec42cb5420871a46032d545286e90eaea8454789580
  media3-exoplayer  aar 19090f829afbbb595d67618f59c212f72b433ac01dc72b47594cf42552c8ed61
                    module ba0b9ef325fa114baa0f2fbdb4caf54029606924be1999f4af02bed5f079756b
  media3-extractor  aar 3c823279356b64f4215a8c6cb1e6bfa60c533351a651786ad6fa69ad001ef1b1
                    module b3eb755d7373e4fd199ff80814005f3b303693dfb8ace16b5b9482655d49d493

Not tried on a phone yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-29 13:31:41 +01:00
commit d5b367e930
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -1061,6 +1061,45 @@ Strava. What was found, 27 Oct:
wait for an unmetered network) and *Delete*, which after asking unmarks every
playlist. Not tried on a phone yet: decoding real files, how often the analysis
lands an octave off (10c counts half and double as fitting).
- **D48 Music in a recording** (recommended, the developer's; 29 Oct; D47's 10c):
- **A workout keeps its cadence** as a series of its own, `cadence` (steps a minute,
a sample every 10 s while moving), sealed and synced as heart rate is; an app
before it skips the kind, so nothing migrates (over each step's time, some 50 KB an
hour for detail nothing needs, and over the total alone, too little to learn
cadence against pace). It is Health Connect's StepsCadenceRecord, to be written
there later.
- **The Record sheet offers Music, Metronome or Off** on foot (running, walking,
hiking), remembered for next time; Music once some kept track has a tempo (over a
switch with the metronome as its fallback, which leaves no metronome to a person
with a library).
- **A change of cadence retunes, else crossfades**: within 6 % the playing track is
sped up or slowed down at once, beyond it the player fades over 3 s into a track
that fits; a plan's new step picks a fitting track at once (over playing the track
to its end, minutes off the beat).
- **Media3 1.10.1 pinned by Gradle's own checksums** (`--write-verification-metadata
sha256`, trusted on first download from Google's Maven, as Polar's SDK was), the
entries added listed in the commit for the developer to review.
- Built: 10c. A recording's `cadence` series is its steps counted in 10 s windows
from its start, a window touching a pause left out (`cadenceOf`); the steps are now
counted on foot whatever auto-pause listens to. The cadence a run's music starts at
is learnt from the person's last ten recorded runs (`cadenceModelOf`, once three of
them have twelve cadence samples with a precise speed each): steps a minute as a
line in speed, its slope kept between 0 and 25, flat where the runs' speeds barely
differ, and a plan's steps get the cadence of their target pace or speed from it
(a step's `cadence`); a walk or a hike starts at 110, a run without the model at
165. In the service (`MusicConductor.kt`, tested on the JVM) the cadence is the
steps of the last 30 s once they span 10 s, forgotten after a pause or a mark,
asked every 5 s; a change under 2 steps a minute does nothing. A track fits at its
tempo, half or double it; among those fitting, each plays once before any plays
again; where none fits, the nearest plays as near as 6 % allows; without tracks the
metronome clicks at the cadence (an AudioTrack's static loop). `MusicPlayer.kt`
plays with Media3's ExoPlayer, the pitch kept, the playing player holding the
audio focus so that the cues duck it; a new track fades in by a second player over
3 s; a file that won't play counts as ended. A pause by hand pauses the music,
auto-pause doesn't (a red light shouldn't stop the song). Music chosen where the
phone no longer keeps a track with a tempo shows and plays nothing. Not tried on a
phone yet: the crossfade, the ducking under the cues, the metronome's click, how
steady the cadence feels.
## Consequences