Energy-based: Detects beats from increases in audio energy (frame-by-frame). Tempo is estimated from the interval between the last two detected beats.
Librosa-based: Uses the librosa library on a sliding buffer of audio to estimate BPM and beat times, then predicts future beats for synchronization.
On each detected beat, the Nao robot performs a short “bop” (body dip + alternating arm raises) with interpolated joint motion. Motion is aligned to beat times so the robot appears to dance in time with the music.
Two Nao robots in the same world listen to the same streamed audio: one uses nao_energy_controller, the other nao_librosa_controller. Behavior can be compared through offline tests to verify tempo extraction and beat alignment.
E-puck runs the emitter controller: reads a WAV file and streams it in chunks over the radio (sample rate first, then PCM16 audio chunks).
Two Nao robots on channel 1: nao_energy_controller (per-chunk energy, bop on threshold, BPM from beat intervals) and nao_librosa_controller (buffered audio, librosa beat tracking, bops on predicted beat times).
Left: energy-based beat detection
Right: librosa beat tracking (starts after a short buffer so it can analyze the audio).
Both listen to the same streamed music.