EmotionFlow is a real-time affect-aware music system. A CNN ensemble (MiniXception + transfer-learning-based MobileNetV2/EfficientNet) classifies 7 facial emotions at 25–30 FPS; a state machine maps those emotions to Spotify playback; a rolling queue manager keeps 2–5 songs buffered per state. Validation accuracy improved from 74.7% to 85.4% through imbalance-aware sampling, label smoothing, Mixup augmentation, and confidence calibration. Inference latency was reduced 3.2× (3.08s → 0.96s) via multithreaded frame processing and optimised I/O pipelines.
Music State Controller — maps the stable emotion to one of 7 playback states; enforces a 3-second hold before any state transition and a 5-second cooldown between switches to prevent thrashing.
Rolling Player Engine — monitors per-state queue depth; auto-refills below 2 songs, caps at 20; scores candidates 0.0–1.0 against target audio features (energy, valence, danceability, tempo, acousticness).