A system that converts human movement into sound by treating video motion as input to a spectral synthesizer. Upload a video file to analyze body motion, and each frame of movement is transformed into a slice of a spectrogram.
Motion direction shapes frequency content, motion magnitude determines amplitude, and the resulting time:frequency matrix is resynthesized into audio. The output is a sound texture tightly coupled to how the performer moves.
The final result is an audiovisual piece: motion-visualized video paired with motion-generated sound.
Project Documentation: Google Doc
- Open a terminal (macOS/Linux) or PowerShell (Windows).
- If
gitis not installed:- macOS:
xcode-select --install - Windows: install from https://git-scm.com/download/win and restart PowerShell.
- macOS:
- Clone:
git clone https://github.com/rahiii/Camera-as-Synth.git
cd Camera-as-SynthIf you prefer a zip, download from GitHub, unzip, then cd into the folder.
If you have sample videos from Google Drive, place them in Samples/ (or use the provided ones already in Samples/).
Mac/Linux:
python3.10 -m venv venv
source venv/bin/activateWindows:
py -m venv venv
venv\Scripts\activatepip install -r requirements.txtRequired packages:
Flask- Web framework (for local web interface)opencv-python- Video processing and optical flownumpy- Numerical operationsmediapipe- Pose detection and segmentationlibrosa- Audio analysis and synthesissoundfile- Audio file I/Oscipy- Scientific computing (filtering, etc.)moviepy- Video/audio mergingmatplotlib- Plotting and spectrogram visualization
The pose_landmarker_full.task file must be in the project root directory. If missing, download it from MediaPipe Pose Solutions.
python main.pyWhen prompted:
- Enter video path: Type path to video file (e.g.,
Samples/dance.mp4) - Press Enter: Use webcam as input source
python app.pyThen open in your browser:
http://localhost:5000
You can upload a video, use sample videos, view/download the processed result, and interact with the spectrogram (click/drag to scrub playback).
Edit config.py to customize:
WIDTH = 640 # Video width
HEIGHT = 480 # Video height
SHOW_SKELETON = False # Display pose skeleton overlayfinal_performance.mp4- Final video with synthesized audio (saved in project root)
temp_video.avi- Temporary video file (deleted after processing)temp_audio.wav- Temporary audio file (deleted after processing)
Camera-as-Synth/
├── main.py # CLI entry point
├── app.py # Local Flask web application
├── config.py # Configuration settings
├── requirements.txt # Python dependencies
├── pose_landmarker_full.task # MediaPipe pose model
├── templates/
│ └── index.html # Web interface template
├── static/
│ ├── style.css # Web interface styles
│ └── script.js # Web interface JavaScript
├── engine/
│ ├── audio.py # Audio synthesis engine
│ ├── visuals.py # Visual processing (segmentation, flow)
│ ├── pose.py # Pose detection
│ └── data.py # Data collection
├── Samples/ # Sample videos
├── uploads/ # Temporary upload folder
└── outputs/ # Generated videos and spectrograms
-
Video Capture: Processes uploaded video files using OpenCV
-
Body + Motion Extraction:
- MediaPipe Selfie Segmentation: Isolates human from background to focus analysis on body movement
- Optical Flow: Calculates motion vectors between frames using DIS (Dense Inverse Search) or Farneback algorithm
- Motion vectors are masked by segmentation (only human movement analyzed)
- MediaPipe Pose Detection: Tracks body landmarks for gesture recognition and synthesis control
-
Motion → Spectrogram Mapping:
- Motion direction (0-360°) maps to frequency bins via histogram distribution
- Motion magnitude (speed) maps to amplitude in each frequency bin
- Creates a 3-layer spectral representation (low, mid, high) weighted by motion speed
- Each frame becomes a time slice in the final spectrogram matrix
-
Audio Resynthesis:
- Griffin-Lim algorithm converts the spectrogram back to audio waveform
- Spectral shaping: Frequency masking based on musical scales (circle of fifths), selected by horizontal body position
- Mode-based synthesis applies additional effects based on motion patterns (see Audio Modes below)
- Pose data informs synthesis parameters (torso activity, arm spread, gesture type)
- Audio is time-stretched to match video duration
-
Video/Audio Merging: Combines motion-visualized video with synthesized audio using MoviePy
This structure stays general so you can later replace or swap models (MediaPipe, another segmentation model, different flow algorithms, tracking methods, etc.) without rewriting the core description.
This project extends existing experimental sonification work by linking embodied motion to spectral sound structures rather than discrete musical events. Optical flow supplies raw motion energy, while MediaPipe segmentation introduces intentionality by focusing only on human movement.
The result is a fluid, gesture-responsive sonic texture that lives between:
- Computer vision (optical flow, segmentation, pose tracking)
- Spectral music techniques (Griffin-Lim resynthesis, frequency-domain manipulation)
- Gesture-controlled performance systems (real-time motion-to-sound mapping)
- Contemporary audiovisual art (synchronized visual and sonic textures)
The system functions as a "camera synthesizer": an instrument where the performer plays sound through full-body motion.
The system automatically selects synthesis modes based on motion patterns and detected gestures:
- FM: Fast motion with torso activity
- Rhythmic: High motion variance creates rhythmic gating patterns
- Granular: Wide arm spreads trigger granular processing
- Harmonic: Raise-arms gestures generate harmonic arpeggios
- Doppler FM: Spin gestures create frequency-shifted effects
- Ambient: Low motion, stillness produces ambient textures
If you encounter RuntimeError: No ffmpeg exe could be found:
- The
imageio-ffmpegpackage should automatically download ffmpeg binaries on first import - Try running your script again - it should download ffmpeg automatically
- If it still fails, ensure
imageio-ffmpegis installed:pip install imageio-ffmpeg
If you see FileNotFoundError for pose_landmarker_full.task:
- Download the model from MediaPipe Pose Solutions
- Place
pose_landmarker_full.taskin the project root directory
- Large video files: Processing may take significant time and memory. Consider using
MAX_VIDEO_DURATION_LOCALinconfig.pyto limit processing duration - Webcam not working: Check that your camera is not being used by another application
- Low frame rate: Ensure your video has a valid FPS (the system defaults to 30 FPS if detection fails)
If packages aren't found after installation:
- Ensure your virtual environment is activated (you should see
(venv)in your terminal prompt) - Try reinstalling:
pip install --upgrade -r requirements.txt