whatisgithub

What is magenta-realtime-2-iphone?

mattmireles/magenta-realtime-2-iphone — explained in plain English

Analysis updated 2026-05-18

19PythonAudience · developerComplexity · 5/5Setup · hard

In one sentence

Python scripts that convert Google's Magenta RealTime 2 music generation model to run continuously on an iPhone's Neural Engine instead of its GPU.

Mindmap

mindmap
  root((Magenta iPhone Port))
    What it does
      Core ML conversion
      Real time music on iPhone
    Tech stack
      Python
      Core ML
      Neural Engine
    Use cases
      On device music generation
      Model porting reference
    Audience
      ML developers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Convert Google DeepMind's Magenta RealTime 2 music model into Apple's Core ML format for iPhone.

USE CASE 2

Run continuous real time AI music generation on iPhone hardware without draining the GPU.

USE CASE 3

Study the documented Core ML export decisions and measurements before converting your own model.

USE CASE 4

Use the pre converted model files hosted on Hugging Face directly in an iOS app.

What is it built with?

PythonCore MLApple Neural Engine

How does it compare?

mattmireles/magenta-realtime-2-iphone16nic/comfyui-agnes-ai6c696e68/gpt_signup_hybrid
Stars191919
LanguagePythonPythonPython
Setup difficultyhardmoderatehard
Complexity5/52/54/5
Audiencedevelopervibe coderdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1day+

Requires converting or downloading Core ML model files and integrating them into an iOS app.

So what is it?

This project takes Google DeepMind's Magenta RealTime 2 music generation model and makes it run on an iPhone without using the GPU. That matters because music generation is continuous: the model has to produce a new frame of audio every 40 milliseconds and keep doing so indefinitely. A phone's GPU can handle that pace for short bursts, but over ten minutes of sustained use it draws too much power and heats up. Apple's Neural Engine, a separate chip inside iPhones designed for machine learning tasks, can run the same work at a fraction of the power draw. The challenge is that Apple's Neural Engine has strict requirements: it only accepts fixed input shapes, it does not tolerate branching logic, and its compiler can silently appear to accept a model while actually routing it to the CPU instead, where it runs 16 times too slow without any error message. The author hit that limit, measured it carefully, and published the result. The solution was to split the model into three separate graphs and route each one to the chip that suits it best. The outcome on an iPhone 12 Pro from 2020: ten unbroken minutes of 48 kHz stereo audio at 25 frames per second, with zero recorded GPU usage from the music process. The project includes validation measurements comparing the output numerically against Google's own reference implementation, showing an output correlation of 0.999985 and a signal quality of 118.85 dB. This repository contains the Python exporter scripts that convert the original model into Apple's Core ML format, along with documentation of the decisions made, including several approaches that were tried and rejected with measurements attached. Pre-converted model files ready to use in an iOS app are hosted separately on Hugging Face. The README is unusually detailed about what was proven versus what remains unvalidated.

Copy-paste prompts

Prompt 1
Explain why this project routes the Magenta RealTime 2 model to the Apple Neural Engine instead of the GPU.
Prompt 2
Walk me through using these Python exporter scripts to convert a similar model to Core ML.
Prompt 3
Help me understand the validation measurements comparing this port against Google's reference implementation.
Prompt 4
Show me how the model was split into three separate graphs to fit Apple Neural Engine's constraints.

Frequently asked questions

What is magenta-realtime-2-iphone?

Python scripts that convert Google's Magenta RealTime 2 music generation model to run continuously on an iPhone's Neural Engine instead of its GPU.

What language is magenta-realtime-2-iphone written in?

Mainly Python. The stack also includes Python, Core ML, Apple Neural Engine.

How hard is magenta-realtime-2-iphone to set up?

Setup difficulty is rated hard, with roughly 1day+ to a first successful run.

Who is magenta-realtime-2-iphone for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.