Gary Mooney
qMuVi: quantum Music Video tool
qMuVi is an open-source Python library that turns Qiskit quantum circuits into music videos. It’s available on PyPI and is part of the IBM Qiskit Ecosystem.
Quantum computing is notoriously unintuitive and hard to picture. qMuVi tries to connect a human observer to what’s happening inside a quantum computation. By turning circuits into music videos, it lets you “hear” and “see” how a quantum state evolves as an algorithm runs.
How it works
- Sampling the state. Barrier gates in your circuit mark where qMuVi takes a snapshot of the quantum state. It simulates the circuit with Qiskit Aer, optionally with a noise model, so you can hear how noise changes the result.
- States become notes. Each basis state is mapped to a musical note, and its probability sets how loud it plays. Note maps range from chromatic to C major, F minor and arpeggios, or you can write your own.
- Phase picks the instrument. A noisy state is split into pure states, each of which gets its own collection of instruments. The phase of each basis state then chooses the instrument within that collection.
- Output. qMuVi renders an MP4 music video, along with MIDI and WAV files of the soundtrack.
Try it
pip install qmuvi
import qmuvi
from qiskit import QuantumCircuit
circ = QuantumCircuit(2)
# barriers tell qMuVi where to sample the state
circ.barrier()
circ.h(0)
circ.barrier()
circ.cx(0, 1)
circ.barrier()
qmuvi.generate_qmuvi(circ, "bell_state")
This generates a music video of a Bell state being prepared. There are more examples, and the videos they produce, in the GitHub repository, and full documentation is online.
Origins
qMuVi was created for the IBM Qiskit Hackathon Melbourne 2022, where it won first place from the judges and the community vote. I was the team lead. The project was featured on the IBM Qiskit Blog, and I’ve continued developing it since.
Built with
Python, Qiskit and Qiskit Aer, matplotlib, MoviePy, mido for MIDI, and TiMidity++ for audio synthesis.