Real-time AI Audio Jamming in Your Terminal
Transform your music with PyTorch-powered neural networks
Magenta RT JAM CLI brings real-time AI audio generation to your command line. Feed it your music, and watch as PyTorch-powered neural networks learn and jam along with you in real-time. Originally a complex Colab notebook, now a streamlined CLI that just works.
๐ Key Features:
- ๐ค Live microphone jamming - AI responds to your playing in real-time
- ๐๏ธ Interactive TUI by default - Real-time volume meters and live session control
- ๐ Audio file processing - Enhance existing recordings
- ๐ง Built-in PyTorch models - No complex setup required
- ๐ Rich terminal UI - Beautiful progress bars and live stats
- ๐พ Auto-save sessions - Never lose your jams
- โก GPU acceleration - CUDA & Apple Silicon support
# Run directly from GitHub
uvx --from git+https://github.com/oxysoft/MagentaRT-jamcli jamcli --help
# Or install locally for repeated use
uv tool install git+https://github.com/oxysoft/MagentaRT-jamcli
jamcli --help # Now available globally# Start jamming with TUI (default)! Models download automatically:
uv run jamcli run --input-source mic --model-tag medium
# Or use console mode instead:
uv run jamcli run --input-source mic --model-tag medium --no-tui
# Or if installed globally with uvx:
jamcli run --input-source mic --model-tag mediumThat's it! The AI will start jamming along with whatever you play. The Terminal User Interface with live volume meters is now the default - use --no-tui if you prefer the simple console interface.
The TUI provides a professional full-screen interface with real-time monitoring and is now the default mode:
- Live Volume Meters - Real-time RMS visualization for Input, AI Output, and Mixed audio
- Session Statistics - Runtime, chunks processed, generation rate, latency, and performance metrics
- Interactive Controls - Keyboard shortcuts for session control
- System Status - Model and device status indicators
- Peak Hold Indicators - Volume bars with 1-second peak hold visualization
| Key | Action |
|---|---|
| SPACE | Start/Stop Recording Session |
| R | Reset Statistics |
| Q or Ctrl+C | Quit Application |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ต Magenta RT JAM CLI - Terminal Interface โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Configuration โ Live Volume Levels โ
โ Model: large โ Input โโโโโโโโโโโโ โ
โ Device: gpu โ AI Output โโโโโโโโโโโโ โ
โ Input: mic โ Mixed โโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Session Statistics โ System Status โ
โ Runtime: 0:02:34 โ Status: ๐ด RECORDING โ
โ Chunks: 153 โ Model: โ Ready โ
โ Rate: 0.5 chunks/s โ Audio: โ Connected โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ SPACE: Start/Stop R: Reset Q: Quit โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# Jam with microphone (TUI default)
โฏ uv run jamcli run --input-source mic
# Use console mode instead
โฏ uv run jamcli run --input-source mic --no-tui# Process an audio file
โฏ uv run jamcli run --audio-file path/to/song.wav --model-tag large
# Custom loop settings
โฏ uv run jamcli run --audio-file song.wav --bpm 140 --beats-per-loop 16# Full control over the session (TUI default)
โฏ uv run jamcli run \
--input-source mic \
--model-tag large \
--device gpu \
--bpm 120 \
--beats-per-loop 8 \
--intro-loops 4
# Or force console mode
โฏ uv run jamcli run --input-source mic --model-tag large --no-tuiโฏ uv run jamcli models list
Available PyTorch Audio Models
โโโโโโโโโโณโโโโโโโโโโโโโโณโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโ
โ Model โ Status โ Size โ Description โ Location โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ large โ โ Available โ 7.4 MB โ Large PyTorch audio โ /home/user/.cache/mโฆ โ
โ โ โ โ generation model โ โ
โ โ โ โ 1024d, 16L, 16H โ โ
โ medium โ โ Not Available โ -- โ Medium PyTorch โ Not downloaded โ
โ โ โ โ audio generation โ โ
โ โ โ โ model โ โ
โ โ โ โ 512d, 12L, 12H โ โ
โ small โ โ Available โ 696.0 KB โ Small PyTorch audio โ /home/user/.cache/mโฆ โ
โ โ โ โ generation model โ โ
โ โ โ โ 256d, 8L, 8H โ โ
โโโโโโโโโโดโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโฏ uv run jamcli models download large
โ large model ready โโโโโโโโโโโโโโโโโโโโโโโโโโโโ 100% 0:00:01 56 bytes/s 0:00:00
โ Built-in model 'large' configured at /home/user/.cache/magenta-rt-jamcli/pytorch_audio_large
Downloaded Files in pytorch_audio_large
โโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโณโโโโโโโโโโโโโโโโ
โ File โ Size โ Type โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ config.json โ 235 B โ Configuration โ
โ pytorch_model.bin โ 7.4 MB โ Model weights โ
โโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโผโโโโโโโโโโโโโโโโค
โ Total โ 7.4 MB โ โ
โโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโดโโโโโโโโโโโโโโโโ
โ Model 'large' ready at /home/user/.cache/magenta-rt-jamcli/pytorch_audio_large# Download specific model
โฏ uv run jamcli models download medium --force
# Clear cached models
โฏ uv run jamcli models clear small
โฏ uv run jamcli models clear all --confirmโฏ uv run jamcli devices
Available Audio Devices
โโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโณโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโ
โ ID โ Name โ Max Inputs โ Max Outputs โ Default Rate โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ 0 โ Built-in Microphone โ 2 โ 0 โ 48000 Hz โ
โ 1 โ Built-in Output โ 0 โ 2 โ 48000 Hz โ
โ 2 โ USB Audio Device โ 2 โ 2 โ 44100 Hz โ
โโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโดโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโ
๐ค Testing microphone... โ Microphone working (RMS: 0.001493)
๐ Testing speakers... โ Speakers workingโฏ uv run jamcli sessions
Saved Audio Sessions
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโ
โ Filename โ Size โ Modified โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ jamcli_mixed_20241208_143022.wav โ 45.2 MB โ 2024-12-08 14:32 โ
โ jamcli_output_20241208_143022.wavโ 22.6 MB โ 2024-12-08 14:32 โ
โ jamcli_input_20241208_143022.wav โ 22.6 MB โ 2024-12-08 14:32 โ
โ jamcli_mixed_20241208_142155.wav โ 12.1 MB โ 2024-12-08 14:22 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโฏ uv run jamcli sessions --output-dir /path/to/my/sessionsโฏ uv run jamcli init-config --output my-settings.toml
Setting up Magenta RT JAM CLI configuration
Input source [mic/file] (file): mic
BPM (120): 140
Beats per loop (8): 16
Intro loops (4): 2
Device [cpu/gpu/mps] (cpu): gpu
Sample rate (48000):
Chunk seconds (2.0):
Temperature (1.2): 1.5
Top-k (30): 20
Guidance weight (1.5):
Configuration saved to my-settings.tomlโฏ uv run jamcli run --config my-settings.toml
โฏ uv run jamcli show-config my-settings.toml
Configuration
โโโโโโโโโโโโโโโโโโโณโโโโโโโโโ
โ Setting โ Value โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ Input Source โ mic โ
โ BPM โ 140 โ
โ Beats per Loop โ 16 โ
โ Intro Loops โ 2 โ
โ Device โ gpu โ
โ Model Tag โ large โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโค
โ Sample Rate โ 48000 โ
โ Chunk Seconds โ 2.0 โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโค
โ Temperature โ 1.5 โ
โ Top-k โ 20 โ
โ Guidance Weight โ 1.5 โ
โโโโโโโโโโโโโโโโโโโดโโโโโโโโโHere's what a complete jamming session looks like:
โฏ uv run jamcli run --input-source mic --model-tag large --device gpu
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Magenta RT JAM CLI โ
โ Audio Injection with Magenta RealTime โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Configuration
โโโโโโโโโโโโโโโโโโโณโโโโโโโโโ
โ Setting โ Value โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ Input Source โ mic โ
โ BPM โ 120 โ
โ Beats per Loop โ 8 โ
โ Intro Loops โ 4 โ
โ Device โ gpu โ
โ Model Tag โ large โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโค
โ Sample Rate โ 48000 โ
โ Chunk Seconds โ 2.0 โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโค
โ Temperature โ 1.2 โ
โ Top-k โ 30 โ
โ Guidance Weight โ 1.5 โ
โโโโโโโโโโโโโโโโโโโดโโโโโโโโโ
Continue with these settings? [y/n]: yโ ธ โ Model ready 0:00:01
โ ธ โ Codec ready 0:00:00
โ ธ โ System initialized 0:00:01
โ ธ โ Audio ready 0:00:00
โ Magenta RT system fully initialized
Available Audio Devices
โโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโณโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโ
โ ID โ Name โ Max Inputs โ Max Outputs โ Default Rate โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ 0 โ Built-in Microphone โ 2 โ 0 โ 48000 Hz โ
โ 1 โ Built-in Output โ 0 โ 2 โ 48000 Hz โ
โโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโดโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโ
๐ค Testing microphone... โ Microphone working (RMS: 0.001493)
๐ Testing speakers... โ Speakers workingโญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Starting Audio Injection Session โ
โ Model will join after 26.67 seconds โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Ready to start? [y/n]: y
๐ต Audio session running! Press Ctrl+C to stop
โโโโโโโโโโโโโโโโณโโโโโโโโโโโโณโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโ
โ Audio Stats โ Value โ Performance โ Value โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ Runtime โ 1m 23s โ Latency โ 3.2ms โ
โ Chunks โ 42 โ Processing โ 97.2% โ
โ Input RMS โ 0.045 โ GPU Usage โ 84% โ
โ Output RMS โ 0.156 โ Memory โ 1.2GB โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโ
โ ผ ๐ค Listening... ๐ค AI Jamming ๐ต Mixing... โก GPU Processing^C
Stopping session...
โ Session completed
โ Output saved: jamcli_output/jamcli_output_20241208_143022.wav
โ Input saved: jamcli_output/jamcli_input_20241208_143022.wav
โ Mixed audio saved: jamcli_output/jamcli_mixed_20241208_143022.wav| Model | Size | Parameters | Best For | Speed |
|---|---|---|---|---|
| small | 696 KB | 256d, 8L, 8H | Quick tests, CPU-only | โกโกโก |
| medium | 2.1 MB | 512d, 12L, 12H | Balanced quality/speed | โกโก |
| large | 7.4 MB | 1024d, 16L, 16H | Best quality, GPU recommended | โก |
Models download automatically when needed:
โฏ uv run jamcli run --model-tag medium --input-source mic
# If medium model isn't available, you'll see:
โ medium model ready โโโโโโโโโโโโโโโโโโโโโโโโโโโโ 100% 0:00:01 72 bytes/s 0:00:00
โ Built-in model 'medium' configured at /home/user/.cache/magenta-rt-jamcli/pytorch_audio_medium
Downloaded Files in pytorch_audio_medium
โโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโณโโโโโโโโโโโโโโโโ
โ File โ Size โ Type โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ config.json โ 236 B โ Configuration โ
โ pytorch_model.bin โ 518.4 KB โ Model weights โ
โโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโโโโค
โ Total โ 518.6 KB โ โ
โโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโโโโโ
# Then immediately continues with session setup...# Basic settings
input_source = "mic"
audio_file = "path/to/audio.wav" # Only used if input_source = "file"
bpm = 140
beats_per_loop = 16
intro_loops = 2
device = "gpu" # cpu, gpu, or mps
model_tag = "large"
[audio]
sample_rate = 48000
chunk_seconds = 2.0
[model]
temperature = 1.2 # Creativity (0.1-2.0)
topk = 30 # Sampling diversity
guidance_weight = 1.5 # How much to follow input
model_volume = 0.8 # AI output volume
input_volume = 1.0 # Your input passthrough volume
model_feedback = 0.95 # How much AI hears itself
input_gap = 400 # ms of recent input to silencecpu- Works everywhere, slowergpu- CUDA GPUs, much fastermps- Apple Silicon (M1/M2/M3), optimized for Mac
The CLI automatically detects your hardware and suggests the best option.
# Process all WAV files in a directory
for file in *.wav; do
uv run jamcli run --audio-file "$file" --model-tag large
done# Save sessions to specific location
mkdir ~/my-jams
uv run jamcli run --input-source mic
# Sessions auto-save to jamcli_output/, move them:
mv jamcli_output/* ~/my-jams/# Run with verbose output to see detailed stats
uv run jamcli run --input-source mic --model-tag large 2>&1 | tee session.logโฏ uv run jamcli devices
# If empty, install PortAudio:
# macOS: brew install portaudio
# Ubuntu: sudo apt-get install portaudio19-dev
# Windows: Usually works out of the box# Reinstall with PyTorch dependencies
โฏ uv sync --reinstall# Check CUDA installation
โฏ python -c "import torch; print(f'CUDA: {torch.cuda.is_available()}')"
# Check MPS (Mac)
โฏ python -c "import torch; print(f'MPS: {torch.backends.mps.is_available()}')"- Try a larger model:
--model-tag large - Increase sample rate in config:
sample_rate = 48000 - Use GPU for better real-time performance:
--device gpu
# Install optional audio export dependency
โฏ uv add soundfile# Help for any command
โฏ uv run jamcli --help
โฏ uv run jamcli run --help
โฏ uv run jamcli models --help
# Or install globally for direct access
โฏ uvx --from . jamcli --helpThis CLI transforms the complex Magenta RT Audio Injection notebook into a production-ready tool:
- ๐ง PyTorch Neural Networks - Built-in audio generation models
- ๐ต Real-time Processing - Low-latency audio streaming with crossfading
- ๐ Rich Terminal UI - Progress bars, live stats, beautiful tables
- ๐พ Auto-save - Never lose your creative sessions
- โก Hardware Acceleration - CUDA & Apple Silicon optimized
- ๐ง Zero Configuration - Works out of the box, customize as needed
Apache 2.0 License - Same as the original Magenta project. Model weights under Creative Commons Attribution 4.0.
๐ต Happy Jamming! ๐ต
Made with โค๏ธ for the AI music community