betaFeedback

WorksComputer Science

EE-Motion: An EEG-based Web Architecture for Live Affective Music Recommendation

Abstract

Music listening is intrinsically tied to emotion, which drifts continuously within a single session. Although modern browsers interface with wearable brain-computer interfaces, recommendation systems remain structured around discrete logs and lack the infrastructure to integrate continuous physiological signals. Furthermore, existing affect-aware models rely on static user profiles and offline training, failing to serve anonymous newcomers without model retraining. We present a web platform that resolves both challenges. Pairing with a consumer electroencephalogram (EEG) headband over Web Bluetooth, the system captures live EEG, mapping frontal alpha asymmetry and arousal index to normalized valence-arousal proxy coordinates on Russell's circumplex plane. Driven by these coordinates, an affective adapter unifies structurally diverse recommendation backbones under a shared live scoring mechanism. By parameterizing anonymous visitors through a few favorite tracks, the module recommends tracks conditioned on live proxy coordinates. This demonstrates that real-time EEG-derived control signals can steer recommendations without persistent user tables or model retraining.

CCS Concepts

• Information systems → Recommender systems; • Human-centered computing → Interactive systems and tools.

Keywords

Context-Aware Recommendation, Brain-Computer Interfaces, Affective Computing

Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

WWW Companion ’27, Dublin, Ireland

© 2027 Copyright held by the owner/author(s). Publication rights licensed to ACM.

ACM ISBN 978-1-4503-XXXX-X/2027/05

https://doi.org/XXXXXXX.XXXXXXX

Introduction

Music listening experiences are intrinsically governed by a listener’s affective state, which is never static but continuously drifts within a single session [7]. In affective computing and brain-computer interface (BCI) research, this state is commonly described by the continuous valence and arousal (V/A) dimensions of Russell’s circumplex model [3] (measuring emotional positivity and physiological activation, respectively). Indeed, emotion-elicitation studies show that listening to even a single minute of music reliably induces distinct V/A shifts [3], meaning a listener’s mood can fluctuate multiple times throughout a listening session. Despite this continuous drift, contemporary recommender systems remain largely blind to real-time emotional shifts. When systems incorporate affect, they typically infer it from past listening logs, static context attributes, or explicit self-reports [7]. Recent models such as ACE [2], for instance, anchor each user to the V/A centroid of previously consumed items. While effective in offline benchmarks, such static anchors remain fixed even when a listener’s mood departs from their historical average during an active session.

Aligning recommendations with a listener’s immediate affective state requires capturing this signal during the session and passing it to the ranking pipeline at request time. In practice, establishing this live closed loop exposes three deeply connected operational and methodological bottlenecks across the system pipeline.

(i) First, at the serving infrastructure level, production recommendation systems are engineered around episodic logs of discrete actions, such as clicks, plays, and ratings [9]. While context-aware models incorporate situational factors [1], they typically assume discrete attributes known ahead of time. In contrast, continuous physiological telemetry sampled at hundreds of hertz in the browser is noisy and susceptible to artifacts, requiring real-time filtering and feature extraction before yielding a stable affective estimate [6]. Even modern serving frameworks designed for low-latency ranking, such as WarpRec [4], provide no native hook to forward continuous in-browser telemetry directly to custom ranking models.

(ii) Second, at the recommendation model level, streaming this affective signal addresses only half the challenge, because the visitor in front of the screen is typically an anonymous newcomer. Collaborative filtering models allocate static user embedding tables that require expensive retraining or per-user fold-in to represent new visitors, unless users are parameterized purely through consumed items [9]. Sequential architectures, such as self-attentive transformers (e.g., SASRec [8]), elegantly bypass this user-table bottleneck by encoding an ordered sequence of interactions directly into a dynamic user state without persistent user identifiers. Yet, because sequential models operate strictly over discrete item tokens, they lack native mechanisms to fuse external, continuous affective factors during candidate scoring. Compounding this divide, existing affect-aware techniques bind continuous V/A signals directly to model-specific training objectives [2, 7], leaving researchers without a shared abstraction to project live affect into the recommendation process across structurally different models.

(iii) Third, BCIs have historically remained isolated from the web ecosystem. While implicit affect sensing has explored video feeds to detect emotion [7, 11], wearable electroencephalogram (EEG) headsets are able to record raw brain signals from which affective states can be inferred [3, 6]. Although web-based streaming is increasingly explored, accessing wearable BCI telemetry has traditionally relied on third-party drivers. The emerging W3C Web Bluetooth specification1 removes this barrier, enabling browsers to pair directly with Bluetooth Low Energy hardware without local installation. Yet, the web ecosystem still lacks an open, end-to-end architecture to translate continuous in-browser bio-signals into live recommendation context.

To resolve these challenges within a unified system, we present a web platform that connects in-browser bio-sensing directly to real-time music recommendation. The platform integrates two decoupled core components: (1) an in-browser acquisition pipeline that pairs with a consumer EEG device over Web Bluetooth, preprocesses the raw bio-signals in real time, and maps them to normalized valence and arousal proxy coordinates; and (2) an affective adapter that unifies candidate scoring across different model families. This adapter allows anonymous visitors to interact with the system by providing a small set of favorite tracks that capture their musical preferences, while their live EEG signal steers recommendations in real time without model retraining. Consequently, structurally different models, such as graph neural networks [2] and sequential recommendation [8], can be swapped at serving time without modifying the web client or serving infrastructure.

System Architecture

Overview

Live affective music recommendation requires coordinating three distinct operational tasks: in-browser sensor communication, continuous V/A proxy estimation, and low-latency candidate scoring. The system addresses these demands through a decoupled microservice architecture that isolates candidate ranking from sensor-specific processing (see Figure 1). Four independent services carry these responsibilities: (i) the front-end serves the interactive web application to the client browser; (ii) the catalog handles music track metadata retrieval; (iii) the bci-processor is dedicated to real-time EEG preprocessing and affective feature extraction; and (iv) the recommender scores candidates across the catalog using WarpRec [4].

Figure 1. Overview of the Web-based Live Affective Architecture. The browser acquires raw EEG via Web Bluetooth and streams it to the bci-processor for V/A mapping; the affective adapter then scores candidates across swappable WarpRec backbones.

Two core contributions bridge these independent services into an end-to-end pipeline. First, a standalone BCI library connects to the headband via Web Bluetooth and streams EEG data to the bci-processor, which computes normalized V/A proxy coordinates. Second, an affective adapter hooks into WarpRec models with minimal implementation effort. In addition to live V/A projection, this adapter transforms offline models of different families (such as graph neural networks or sequential architectures) into their live affective variants, serving anonymous visitors on the fly without retraining. This architectural separation keeps the recommendation model completely agnostic to the physical origin of the affective signal. The recommender requires only normalized valence and arousal proxy coordinates in [0,1]×[0,1][0, 1] \times[0, 1], obtained from Frontal Alpha Asymmetry (FAA) and Arousal Index (AI) [3] via a fixed-coefficient sigmoid. As long as an input source produces values within this normalized range, the ranking models function identically, regardless of the underlying sensing modality. This property directly unlocks what we call input swappability: the system seamlessly accepts any alternative input that emits the same coordinate format. HTTP and WebSocket protocols decouple these microservices, providing deployment flexibility across heterogeneous topologies. This modularity allows the platform to run either as a self-contained local edge deployment (as in our standalone demonstration) or as a distributed deployment across dedicated nodes.

Brain-Computer Interface Protocol

The BCI workflow operates across two distinct phases: acquisition and processing. EEG signals are acquired from a Muse 2 device2 using Muse-js,3 with four channels (TP9, AF7, AF8, TP10) sampled at 256 Hz. In the bci-processor, a dedicated thread maintains a circular buffer containing 1024 samples per channel, corresponding to 4 s of EEG. Once the buffer is full, the acquired data are retrieved and converted into an MNE Raw data structure [5], where signal quality is assessed using MNE’s Local Outlier Factor (LOF) channel detection function4 to identify channels with anomalous signal characteristics. Visual inspection complements automated assessment, supporting noise identification and headset repositioning. Preprocessing then applies causal bandpass filtering between 1 and 40 Hz, after which NeuroKit25 estimates theta (4–8 Hz), alpha (8–13 Hz), and beta (13–30 Hz) powers. To attenuate short-term fluctuations, a second circular buffer stores 20 successive observations, allowing temporal smoothing to average each feature across these observations, separately for each band and channel. Affective indices are computed once this buffer is full: FAA serves as the valence-related index, consistent with prior evidence, and is computed as log⁡(αAF8/αAF7)\log(\alpha_{AF8}/\alpha_{AF7}), while the AI is defined as (βAF7+βAF8)/(αAF7+αAF8)(\beta_{AF7} + \beta_{AF8})/(\alpha_{AF7} + \alpha_{AF8}) [10]. Here, α\alpha and β\beta denote temporally smoothed powers in the alpha and beta bands. FAA and AI serve as physiological proxy indices rather than validated emotion recognition.

Affective Adapter

The affective adapter operates inside the recommender service as a decoupled module that bridges offline-trained ranking models with live affective serving (Figure 1). Its objective is to equip the recommendation backbones with a live-affect scoring mechanism, allowing them to serve anonymous web visitors without persistent user embeddings or online retraining. The design stems from the affective grounding principles introduced in ACE [2]. Specifically, we abstracted how ACE infuses valence and arousal into representation learning, generalizing its mechanics to support structurally different recommendation families. At serving time, the adapter operates on three inputs: (i) the tracks selected by the user, (ii) the live V/A coordinates, and (iii) the pre-computed item embeddings, each associated with an item-level V/A profile. In response, it outputs the top-kk ranked tracks, conditioned on the input V/A proxy coordinates. This architecture resolves two fundamental bottlenecks of live deployment: anonymous visitor representation and model heterogeneity. First, traditional collaborative filtering models rely on static user embeddings that fail to handle unobserved web visitors [9]. The adapter overcomes this barrier by projecting an anonymous visitor into the latent space via averaging the embeddings of the visitor’s selected tracks, bypassing user tables and eliminating online retraining [9, 12]. Second, recommenders rely on fundamentally different scoring mechanics (e.g., SASRec [8] and ACE [2]). The adapter bridges this divide and makes ranking models fully interchangeable by exposing a serving interface that is based solely on the visitor’s history and live V/A coordinates.

Quantitative Profiling

To isolate platform performance from network delays, we benchmarked the system locally on a MacBook Pro M4 via WarpRec [4] (Figure 2). The system serves the LastFM-VADS catalog, which provides inferred item-level V/A profiles [2]. Although the figure illustrates that candidate scoring in the recommender microservice dominates latency, both ACE and SASRec (extended with the affective adapter) complete well below the 125 ms deadline of the 8 Hz EEG stream, confirming that the architecture operates without buffer accumulation or queuing delays. Finally, serving models via the affective adapter preserves recommendation quality, yielding no statistically significant difference (Wilcoxon signed-rank test, p>0.05p>0.05) in nDCG@10 between live and offline counterparts: 0.0231 (live) vs. 0.0236 (offline) for ACE [2], and 0.0164 (live) vs. 0.0148 (offline) for SASRec [8].

End-to-end latency breakdown and execution trace of a live recommendation cycle for ACE and SASRec

Figure 2. End-to-end latency breakdown and execution trace of a live recommendation cycle for ACE and SASRec. The recommender microservice dominates overall latency, while total cycle time remains strictly below the 125 ms deadline of the 8 Hz EEG stream, preventing queuing delays.

Demonstration and Scenarios

The demonstration invites attendees to experience the system through an interactive web application (Figure 3 and Figure 4). We show the system across two distinct operational scenarios, highlighting both BCI interaction and a hardware-free alternative.

BCI Walkthrough

Figure 3. BCI Walkthrough: (a) input selection, (b) recommender model, (c) favorite tracks selection, (d) device pairing, (e) sensor placement, (f) signal quality check, and (g) live V/A tracking. The manual mode skips (d)-(f) via a draggable 2D cursor.

Recommendation page

Figure 4. Recommendation page: top-10 V/A-conditioned tracks with audio playback and ratings. The plane displays live V/A proxy coordinates, with on-demand re-ranking.

Scenario 1: Interactive BCI Walkthrough

In this primary scenario, attendees experience the complete closed-loop interaction driven by consumer EEG. First, the visitor configures their listening profile by choosing a recommendation model between ACE (live) and SASRec (live) and selecting up to ten favorite tracks from the catalog to initialize preferences (Figure 3a-Figure 3c). Next, the web application connects to a Muse 2 headband over the Web Bluetooth API, displays real-time electrode contact check, and verifies signal stability through the quality gate (Figure 3d-Figure 3f). Once the signal stabilizes, the system continuously maps the incoming EEG stream into normalized V/A proxy coordinates, projecting them onto Russell’s 2D circumplex plane at 8 Hz (Figure 3g). Finally, the system captures the current V/A coordinates and generates a refreshed top-10 recommendation list (Figure 4). Attendees can listen to V/A-conditioned tracks through the embedded player and record three-tier ratings (liked, indifferent, disliked). Explicit session resets clear all in-memory buffers, WebSocket connections, and user data.

Scenario 2: Hardware-Free Exploration

This secondary scenario demonstrates an alternative interaction mode that operates entirely without specialized EEG hardware. The attendee selects the manual flow, bypassing the sensor pairing and calibration screens to navigate Russell’s 2D plane directly with an interactive cursor. Direct manipulation of this 2D cursor across different emotional quadrants (such as calm relaxation or high-arousal focus) enables visitors to inspect how the ranking models dynamically re-score the catalog in real time. This capability is guaranteed by the system’s input swappability feature: the architecture accommodates interchangeable input modalities without downstream modifications, provided that the exchanged data format for valence and arousal coordinates remains identical.

Conclusion

Real-time affective music recommendation has long been constrained by two practical barriers: wearable devices tied to third-party drivers, and recommendation pipelines that depend on static user histories. To overcome both limitations, our web platform pairs consumer EEG hardware directly with the browser via Web Bluetooth. By mapping raw signals onto Russell’s valence-arousal plane, the architecture decouples physiological processing from candidate scoring. This separation enables an affective adapter to serve anonymous visitors on the fly across both graph neural networks and sequential transformer backbones. Under a shared live-affect scoring mechanism, the module infers musical preferences from a few favorite tracks and balances them against the live EEG-derived control signal, bypassing static user embeddings.

Ethical Statement

All EEG signals, affective coordinates, and preferences are processed ephemerally in memory and deleted after each session. The platform uses affective telemetry as a control signal to steer recommendations, rather than for validated emotion recognition or a clinical assessment of emotional health.

References

References

  1. [1]G. Adomavicius and A. Tuzhilin. 2015. Context-Aware Recommender Systems. In Recommender Systems Handbook. Springer, 191–226.
  2. [2]P. Aghilar, S. Rocotelli, V. W. Anelli, A. Bellogín, M. Trizio, and T. Di Noia. 2026. ACE: Semantically-Grounded Graph Alignment via Affective Contrastive Learning. In SIGIR. ACM, 17–28.DOI
  3. [3]S. M. Alarcão and M. J. Fonseca. 2019. Emotions Recognition Using EEG Signals: A Survey. IEEE Trans. Affect. Comput. 10, 3 (2019), 374–393.
  4. [4]M. Avolio, P. Aghilar, S. Rocotelli, V. W. Anelli, C. Mallamaci, V. Paparella, M. Valentini, A. Bellogín, M. Trizio, J. Trotta, A. Ferrara, and T. Di Noia. 2026. WarpRec: Unifying Academic Rigor and Industrial Scale for Responsible, Reproducible, and Efficient Recommendation. CoRR abs/2602.17442 (2026).arxiv.org/abs/2602.17442
  5. [5]A. Gramfort, M. Luessi, E. Larson, D. Engemann, D. Strohmeier, C. Brodbeck, R. Goj, M. Jas, T. Brooks, L. Parkkonen, and M. S. Hämäläinen. 2013. MEG and EEG Data Analysis with MNE-Python. Frontiers in Neuroscience 7 (2013), 267.
  6. [6]X. Gu, Z. Cao, A. Jolfaei, P. Xu, D. Wu, T.-P. Jung, and C.-T. Lin. 2021. EEG-Based Brain-Computer Interfaces (BCIs): A Survey of Recent Studies on Signal Sensing Technologies and Computational Intelligence Approaches and Their Applications. IEEE ACM Trans. Comput. Biol. Bioinform. 18, 5 (2021), 1645–1666.DOI
  7. [7]T. Hasan and R. C. Bunescu. 2025. A Survey of Affective Recommender Systems: Modeling Attitudes, Emotions, and Moods for Personalization. CoRR abs/2508.20289 (2025).arxiv.org/abs/2508.20289
  8. [8]W.-C. Kang and J. J. McAuley. 2018. Self-Attentive Sequential Recommendation. In ICDM. IEEE Computer Society, 197–206.
  9. [9]Y. Koren, R. Rendle, and R. M. Bell. 2022. Advances in Collaborative Filtering. In Recommender Systems Handbook. Springer US, 91–142.
  10. [10]M. Shao, M. Snyder, G. Nejat, and B. Benhabib. 2020. User Affect Elicitation with a Socially Emotional Robot. Robotics 9, 2 (2020), 44.DOI
  11. [11]M. Tkalčić, A. Odić, A. Košir, and J. F. Tasić. 2013. Affective Labeling in a Content-Based Recommender System for Images. IEEE Trans. Multim. 15, 2 (2013), 391–400.DOI
  12. [12]M. Zaheer, S. Kottur, S. Ravankbhsh, B. Poczos, R. Salakhutdinov, and A. J. Smola. 2017. Deep Sets. In NIPS. 3391–3401.

Paper details

vlnc:W_ejjb2r2g
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 11

downloads · 1

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents