Emotional Magenta is the accessibility award winning project from the Music Hackspace Hackathon at Berklee College of Music on June 6-7, 2026. It connects live facial emotion analysis to Magenta Realtime music generation application Collider. Some modifications have been made since.
Music Hackspace Page: https://musichackspace.org/events/hackathon-boston-june-2026/projects/67
Alternate video: https://vimeo.com/1204253845?fl=ip&fe=ec
The current main flow:
- Reads webcam frames and performs periodic emotion analysis.
- Aggregates emotion signals over a time window for stability.
- Launches and updates the revised Collider app with a special emotion prompt node with the latest detected emotion.
main.py: Primary runtime entrypoint (camera + emotion + Collider bridge).src/core/analyzer.py: Emotion analysis and aggregation helpers.magenta-realtime/: Local Magenta Realtime source and Collider example project.scripts/rebuild_all.sh: One-command rebuild/bootstrap script.REBUILD.md: Detailed rebuild notes and options.
- macOS
- Python 3.12+
- Webcam access (for live emotion detection)
- Network access for model downloads (
mrt models ...)
No local build is required for normal use. The repo includes a prebuilt collider_em.app.
- Create and activate a virtual environment:
python3.12 -m venv .venv
source .venv/bin/activate- Install project dependencies:
pip install -e .- Run the app.
python main.py- The first time main.py is run, there is a delay while the analyzer model is downloaded.
- If the collider app crashes, send a keyboard interrupt to stop main.py. Then rerun python main.py and you should be good to go.
If you need to build from source or refresh the checked-in prebuilt app, use these scripts:
Useful environment overrides:
MODEL_NAME(defaultmrt2_base)DOWNLOAD_MODELS(1or0)AUTO_INSTALL_CMAKE(1or0)MAGENTA_REALTIME_BUILD_DIR(defaultmagenta-realtime/build)JOBS(default10)
./scripts/rebuild_all.shOptional overrides for rebuild_all.sh:
MODEL_NAME(defaultmrt2_base)DOWNLOAD_MODELS(1or0)AUTO_INSTALL_CMAKE(1or0)MAGENTA_REALTIME_BUILD_DIR(defaultmagenta-realtime/build)JOBS(default10)
main.py looks for the Collider app in this order:
COLLIDER_APP_PATH(environment variable)prebuilt/collider/collider_em.app(checked-in prebuilt app)magenta-realtime/build/examples/collider/collider_em.app~/Applications/collider_em.app
If the app is missing, run ./scripts/rebuild_all.sh or set COLLIDER_APP_PATH explicitly.
Yes. You can include a built Collider app so users can run immediately without building first.
Recommended approach:
- Build Collider once on a trusted macOS machine using 'scripts/rebuild_all.sh'. This also runs stage_prebuilt_Collider.sh, which moves the newly bulit binary to 'prebuilt/collider/collider_em.app'.
- Commit with Git LFS enabled for
prebuilt/collider/**.
Optional overrides:
SOURCE_APP_PATH=/absolute/path/to/collider_em.appAUTO_STAGE=0(copy only, do not rungit add)
Notes:
Symptoms:
Unable to open camera device 0.
Checks:
- Confirm macOS camera permission is enabled for your terminal app and/or IDE.
- Close other apps that may be holding the camera.
- Re-run from an activated virtual environment.
Symptoms:
- Missing model bundle/state messages.
- Prompt like:
Run mrt models download.
Fix:
mrt models init
mrt models download mrt2_baseAlso verify that these files exist:
models/mrt2_base/mrt2_base.mlxfnmodels/mrt2_base/mrt2_base_state.safetensors
Symptoms:
Collider app not found in expected locations.
Fix:
./scripts/rebuild_all.shOr set an explicit app path:
export COLLIDER_APP_PATH="/absolute/path/to/collider_em.app"
python main.pySymptoms:
- Import errors for
magenta_rt,opencv-python, ordeepface.
Fix:
source .venv/bin/activate
pip install -e .If needed, recreate the environment with Python 3.12.
Symptoms:
cmake: command not found.
Fix:
- Install CMake and verify it is on
PATH. - Or run the helper script with auto-install enabled:
AUTO_INSTALL_CMAKE=1 ./scripts/rebuild_all.shSymptoms:
- Process exits with code
130.
Explanation:
- Exit code 130 usually means the process was interrupted (for example, Ctrl+C).
If this was unintentional, restart with:
python main.pyThis project's own code is licensed under the Apache License 2.0 — see LICENSE for details.
Third-party components have their own licenses (Apache 2.0):
- magenta-realtime: Apache 2.0 — see third_party/licenses/magenta-realtime-LICENSE
- sequence-layers: Apache 2.0 — see third_party/licenses/sequence-layers-LICENSE
For full attribution details, see THIRD_PARTY_NOTICES.md.